SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Figure 7: Example SCM for the Application of CONSOLIDATE. The figure shows a toy SCM for demonstrating application of the CONSOLIDATE algorithm. Consider the following SCM with its structural equations and resulting graph (endogenous variables are  $B, C, D, E, F, G, H$  with only one exogenous  $A$  with each structural equation highlighted on the r.h.s., note that the subscript on  $f_{-}$  denotes the variable to be determined e.g.  $B \gets f_{B}(A)$ ). In the first step, the algorithm's user decides on a partition. Let's consider for instance the following partition i.e., allowed intervention and consolidation sets:  $\mathcal{A} = \{\{E, F, G\}, \{B, C\}, \{D, H\}\}; \mathbf{E} = \{C, F, H\}; \mathcal{I} = \{\{do(D = true)\}, \{do(D = false)\}, \{do(G = false)\}\}$ .
$$
f _ {B} (A) := \left\{ \begin{array}{l l} 0 & \text {if} A \leq 5 \\ 1 & \text {if} A > 5 \end{array} \right. \quad \begin{array}{l l} f _ {E} (A) := A \% 5 = 0 \\ f _ {F} (A) := A \% 10 = 0 \end{array}
$$
$$
f _ {C} (B) := \left\{ \begin{array}{l l} \text {t r u e} & \text {i f} B = 0 \\ \text {f a l s e} & \text {i f} 0 \leq B \leq 1 0 \\ \text {t r u e} & \text {o t h e r w i s e} \end{array} \right. \qquad \qquad f _ {G} (E, F) := E \wedge F   f _ {D} (C) := \neg C   f _ {H} (C, G) := C \vee G
$$
consolidation as a tool for obtaining more interpretable SCM. Towards this end, consolidation might help us in detecting similar structures within an SCM. Doing so eases understanding of causal systems, as the user only has to understand the general mechanisms of a particular SCM once and is then able to apply the gained knowledge to all newly appearing SCM of the same type.
D.2 Firing Squad Example
While the dominoes and tool wear examples where mainly considering the consolidation of sequential structures, we want to briefly demonstrate the consolidation of structural equations that are arranged in a parallel fashion. We consider a variation of the well known firing squad example [Hopkins and Pearl, 2007] with a variable number  $N$  of rifleman. A commander  $(C)$  gives orders to rifleman  $(R_{i}, i \in \{1 \dots N\})$ , which shoot accurately and the prisoner  $(P)$  dies. For the sequential stacking of equations we found that interventions exert an 'overwriting' effect. That is, every intervention fixes the value of a variable, making the unfolding of the following equations independent of all previous computations. To yield a similar effect for parallel equations we need to block all paths between the cause and effect. In this scenario, this can easily be expressed by using an all-quantifier. When consolidating the SCM, we consider only the captain  $C$  and prisoner  $P$ ,  $\mathbf{E} = \{C, P\}$ , while allowing for any combination of interventions that prevent the rifleman from shooting  $\mathcal{I} = \mathcal{P}(\{do(R_{i} = 0)\}_{i \in \{1 \dots N\}})$ . After consolidation, we obtain the following equation:
$$
\mathbf {P} := \left\{ \begin{array}{l l} \text {l i v e s} & \text {i f} C = 0 \lor (\forall S _ {i}. d o (S _ {i} = 0) \in \mathbf {I}) \\ \text {d i e s} & \text {e l s e} \end{array} \right.
$$
As with the dominoes example, we are again in a situation where the consolidated equation intuitively summarizes the effects of individual: "The prisoner lives if the captain does not give orders, or if all riflemen are prevented from shooting".
D.3 Step-by-step CONSOLIDATE Application
In this section we provide a step-by-step application of the CONSOLIDATE algorithm given in Algorithm 1. Consider the SCM shown in Figure 7 with its structural equations and resulting graph. The endogenous variables are  $B, C, D, E, F, G, H$  with only one exogenous  $A$ . Structural equation are highlighted on the right-hand side. Note that the subscript on  $f_{x}$  denotes the variable to be determined e.g.  $B \gets f_{B}(A)$ .
In a first step, the algorithm's user has to decide on a suitable partition. Consider for instance the following partition (indicated by dashed lines in the figure), the following allowed intervention and consolidation set:
$$
\mathcal {A} = \{\{E, F, G \}, \{B, C \}, \{D, H \} \}
$$
$$
\mathcal {I} = \{\{d o (D = \text {t r u e}) \}, \{d o (D = \text {f a l s e}) \}, \{d o (G = \text {f a l s e}) \} \}
$$
$$
\mathbf {E} = \{C, F, H \}
$$
The following example presents a step-by-step application of the CONSOLIDATE algorithm for the cluster  $\mathbf{A}_1 = \{E,F,G\}$ :
Step 3:  $\mathbf{E}_1\gets \{E,F,G\} \cap \{C,F,H\} = \{F\}$
Step 4:  $\mathbf{E}_1^{\prime}\gets \{F\} \cup (\mathrm{pa}(\mathbf{V}\setminus \{E,F,G\})\cap \{E,F,G\})$
$$
= \{F \} \cup (\{A, B, C, G \} \cap \{E, F, G \}) = \{F, G \}
$$
Step 5:  $\mathbf{U}_{\mathbf{A}_1} \gets \mathrm{pa}(\{E, F, G\}) \setminus \{E, F, G\} = \{A, E, F\} \setminus \{E, F, G\} = \{A\}$
Step 6:  $\mathcal{I}_{\mathbf{A}_1} \gets \left\{\{do(X_i = v) \in \mathbf{I}: X_i \in \{E, F, G\}\} : \mathbf{I} \in \mathcal{I}\right\} = \left\{\{do(G = \text{false})\}\right\}$
Step 7:  $\rho_{\mathbf{E}_1^{\prime}}\gets \{f_E(A):= A\bmod 5 = 0;$
$$
\begin{array}{l} f _ {F} (A) := A \bmod 1 0 = 0; \\ f _ {G} (E, F) := E \wedge F \} \\ \end{array}
$$
Step 8:  $\rho_{\mathbf{E}_1'}^{\star} \gets \arg \min \mathcal{K}(\rho_{\mathbf{E}_1'}) = \{$
$$
\rho_ {F} (A) := A \bmod 1 0 = 0;
$$
$$
\rho_ {G} (F, \mathbf {I} _ {\mathbf {A} _ {1}}) := F \wedge \left(d o (G = \text {f a l s e}) \notin \mathbf {I} _ {\mathbf {A} _ {1}}\right) \}
$$
Step 9:  $\mathcal{M}_{\mathbf{A}_1,\mathbf{E}}\gets (\{F,G\} ,\{F\} ,\rho_{\mathbf{E}_1'}^{\star},\{\{do(G = \mathrm{false})\} \} ,P_A)$
Note how computing  $f_{E}$  is no longer required. In a similar fashion, equations in  $\mathbf{A}_2$  resemble a chain that can be composed:  $f_{C} \circ f_{B}$  (previously called 'stacked'; cf. Sec. 4.1). Since  $|\mathrm{Img}(f_B)| = 2$ , at least one of the three conditions of  $f_{C}$  (since  $f_{C}$  is a 3-case function) will be discarded. (Eventually yielding  $\rho_{\mathbf{E}_2'}^\star \gets \{\rho_C(A) := A \leq 5\}$ ). As  $D$  is not in  $\mathbf{E}$  and not required by any other sub SCM it can be marginalized.  $A_3$  then reduces to  $\rho_{\mathbf{E}_3'}^\star \gets \{\rho_H(C, G) := C \lor G\}$ .
D.4 Revealing Agent Policy: Causal Graph and Equations
In this section we explicitly list the structural equations representing observed interactions between a platformer environment and a possible rule based agent. The resulting causal graph is shown in Fig.8 at the end of the appendix. Except for the parentless variables 'coin Reward', 'powerup Reward', 'enemy Reward', 'flag Reward', 'player_position', 'position Coin', 'position_powerup', 'position_enemy', 'position_flag' and 'target_flag', which are exogenous and determined by the environment, all variables are considered endogenous:
player_position, positioncoin, position_powerup, position_enemy, position_flag  $\in [0..1]^2$
coin Reward := 3; powerup Reward := 1; enemy Reward := 9; flag Reward := 2
With  $X$  in  $\{\mathrm{coin},\mathrm{powerup},\mathrm{energy},\mathrm{flag}\}$
distance  $\_ X\coloneqq \|$  position  $X -$  player_position  $X\| _2$
near  $X\coloneqq$  distance  $X <   3.0$
targeting_cost  $X \coloneqq 1.0 + 0.5 \times \text{distance}_X$
targetcoin  $\coloneqq$  targeting_costcoin  $<  <$  enemy Reward
target_powerup := targeting_cost_powerup < powerup Reward
target_enemy := targeting_cost_enemy < enemy Reward ∧ powered_up
target_flag := True
powered_up := target_powerup
towardscoin  $\coloneqq$  targetcoin  $\wedge$  coinreward  $>\max (\{X\_$  reward|target  $X\} _{X\in \{\mathrm{powerup,energy,flag}\}})$
towards_powerup := target_powerup ∧ powerup Reward > max((X Reward|target_X)_{X \in \{coin, enemy, flag\}})
towards_enemy := target_enemy ∧ enemy Reward > max(\{X Reward|target_X\}_{X \in \{\text{enemy, powerup, flag}\}})
towards_flag := target_flag ∧ flag Reward > max(\{X Reward | target_X\}_{X \in \{\text{coin}, \text{powerup}, \text{enemy}\}})
jump := near_enemy  $\wedge$  -powered_up
$\begin{array}{r}\mathrm{planning\_sequence}_i:= \left\{ \begin{array}{ll} \mathrm{finished} & \mathrm{if~towards\_flag}\wedge (\mathrm{flag}\in \bigcup_{j = 1}^{i - 1}\mathrm{planning\_sequence}_j)\\ \mathrm{coin} & \mathrm{if~towards\_coin}\wedge (\mathrm{coin}\notin \bigcup_{j = 1}^{i - 1}\mathrm{planning\_sequence}_j)\\ \mathrm{powerup} & \mathrm{if~towards\_powerup}\wedge (\mathrm{powerup}\notin \bigcup_{j = 1}^{i - 1}\mathrm{planning\_sequence}_j)\\ \mathrm{enemy} & \mathrm{if~towards\_enemy}\wedge (\mathrm{enemy}\notin \bigcup_{j = 1}^{i - 1}\mathrm{planning\_sequence}_j)\\ \mathrm{flag} & \mathrm{if~towards\_flag}\wedge (\mathrm{flag}\notin \bigcup_{j = 1}^{i - 1}\mathrm{planning\_sequence}_j)\\ \mathrm{finished} & \mathrm{else} \end{array} \right. \end{array}$
score := 20 - time_taken
+ coin Reward if coin  $\in$  planning_sequence
+ powerup Reward if powerup  $\in$  planning_sequence
+ enemy Reward if enemy  $\in$  planning_sequence  $^i$  ∧ powerup  $\in$  planning_sequence
+flag Reward if flag  $\in$  planning_sequence
E Mathematical symbols and notation
The following table contains mathematical functions and notation used throughout the paper.
Notation	Meaning
X; X	A (set of) variable(s).
x; x	Value(s) of X; X.
Xi	The i-th variable of X.
XS	The subset {Xi : i ∈ S} of X.
PX	A probability distribution over variables X.
x ~ PX	A value x sampled from a distribution over X.
P(·)	The power set.
f ∘ g	Function composition, (f ∘ g)(x) = f(g(x)).
ΠXi∈X xi	N-ary Cartesian product over the domain of X.
||·||2	l2vector norm.
U(a,b)	Uniform Distribution.
N(μ, σ2)	Normal Distribution.
Bern(p)	Bernoulli distribution; Takes value 1 with probability p and 0 otherwise.
PM	Probability distribution over the SCM M.
PIM	Probability distribution over the SCM M under intervention I.
Vi	An endogenous variable of an SCM M.
Ui	An exogenous variable of an SCM M.
fi	Structural equation of the variable Xi.
Figure 8: Causal graph of an agent policy. The causal graph of a greedy agent inside an platformer environment. The parentless variables are exogenous. Their value is determined via the game environment. The final 'score' variable is left out for clarity.