{'fraction_non_alphanumeric': 0.037984522320975975, 'fraction_numerical': 0.007671251394004934, 'mean_word_length': 4.340552246886843, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Restricted Hidden Cardinality Constraints in Causal Models

Causal models with unobserved variables impose nontrivial constraints on the distributions over the observed variables. When a common cause of two variables is unobserved, it is impossible to uncover the causal relation between them without making additional assumptions about the model. In this work, we consider causal models with a promise that unobserved variables have known cardinalities. We derive inequality constraints implied by d-separation in such models. Moreover, we explore the possibility of leveraging this result to study causal influence in models that involve quantum systems.


Introduction
In causal studies, systems of variables are described by causal models [20,24], which are composed of two elements: (i) the graphical representation of relationships between variables in a model, encoded in a directed acyclic graph, and (ii) the mathematical description of conditional probability distribution of each variable given its causal parents. When a causal model involves hidden (i.e., unobserved) variables, any characterization of the model verifiable by observations should only include observed variables. Therefore, one of the objectives of causal inference is to eliminate all hidden variables from inequalities and equalities that describe the model. In principle, this can be achieved using the Tarski-Seidenberg quantifier elimination method [13]. However, its complexity is such that only models with few variables can be solved using this technique, hence the reason for the many attempts to simplify the problem. For example, one can derive a set of incomplete constraints on probability distributions in latent causal models [9,27,16,22,26]. As these models impose highly nontrivial constraints on the probability distributions, Chaves et al. [6] derive constraints expressed using entropies. Interestingly, the entropic framework originates from the foundations of quantum mechanics [5,12]. Furthermore, causal effects in latent causal structures can be estimated by limiting the causal influence between a confounder and its children [23,25]. Unfortunately, these methods only provide the necessary, but not sufficient, constraints for complete characterization of a causal model.
The field of causal inference is relevant to a wide range of disciplines. Curiously, quantum correlations seem to have no satisfactory explanation via classical causal models. The most famous example is Bell's theorem [2]. The underlying causal structure of a Bell experiment was investigated in [28]. It was shown that it is impossible to explain Bell-inequality violations using a classical causal model without fine-tuning. As this result only holds for the framework of classical causal inference, it appears that quantum theory calls for a quantum generalization of this formalism. Many works attempt to describe causality in quantum systems by generalizing classical concepts to the quantum formalism, for example: quantum Reichenbach's principle [1], quantum Bayes' theorem [18] and quantum randomized trial [21].
We suggest that studying classical causal models with hidden variables can provide a valuable insight into quantum causality.
In this work, we analyze causal models with hidden variables that exhibit d-separation relations, under the assumption that the cardinality of the unobserved variables is known. We derive inequality constraints on the probability distribution over observed variables in such scenarios. We discuss possible applications of these constraints, both in classical causal inference and in quantum causality.

Outline
Section 2 reviews the framework of graphical causal models and the definition of nonnegative rank. Section 3 contains the main results. It begins with description of nonnegative rank as a measure of dependence. Afterwards, it provides constraints implied by d-separation in causal models with hidden variables. Section 4 describes applications of constraints derived in Section 3. Section 5 shows that our constraints are sufficient, but not necessary for identifying direct causal influence. Finally, Section 6 discusses possible generalisations of our constraints to the quantum formalism. Lastly, Section 7 concludes the previous sections.

Preliminaries Graphical Causal Models
In this section, we briefly recall basic notions and important results from graph theory and causal inference.
Consider a system of causally related events. We represent each event by a random variable and we denote the set of variables that corresponds to the system of events as V. In general, V can contain both observed and unobserved variables.
The variables in V, and relations between them, can be represented by a graph. Graphs consist of vertices and edges. We call a graph a causal graph, if the edges that connect the vertices are directed and correspond to causal relations. For example, a causal graph X → Y indicates that the variable X has a direct causal influence on Y . Here, X is said to be a parent of Y . We denote all parents of a random variable V in a graph G by pa G (V ).
In causal inference studies, relationships between variables are illustrated by Directed Acyclic Graphs (DAGs) 1 . A causal model consists of a DAG G over a set of variables V and a joint probability distribution P V . Causal models provide not only a probabilistic, but also a causal interpretation of the relationships between variables in a system.
Properties of a DAG that represents variables in V imply properties of the distribution P V . The essential one is the Markov condition which states that P V can be decomposed as Naturally, this condition can be tested only if all variables in V are observed. It means that given a DAG G and a probability distribution P V , with all variables in V being observed, the Markov condition enables us to test the compatibility of G and P V . However, when some variables in V are unobserved, testing compatibility is a hard task, as we already mentioned in the introduction.
A different property of DAGs that is important in causal inference studies is d-separation. Before we formally define it, let us recall the notion of blocking a path.
Let p be a path in a DAG G . We say that p is blocked by a set of vertices Z if and only if • p contains a fork structure (X ← Z → Y ) or a chain structure (X → Z → Y ) in which the middle vertex Z is in Z, or • p contains a collider structure (X → Z ← Y ) in which neither the middle vertex Z nor any of its descendants is in Z.
Definition 1 (d-separation) X and Y are said to be d-separated by a set Z, (X ⊥ d Y|Z), if and only if Z blocks every path from a vertex in X to a vertex in Y.
Any d-separation relation (X ⊥ d Y|Z) in G implies that X and Y are conditionally independent given Z, (X ⊥ Y|Z), in the corresponding distribution P XYZ .
Notice that testing whether conditional independence relations implied by G hold is only possible when all variables in X, Y and Z are observed. When dealing with unobserved variables, conditional independence relations are sometimes impossible to evaluate.

Nonnegative factorization
We now review the definitions of nonnegative matrix factorization and nonnegative rank as they will play an important role in our results.
Nonnegative matrix factorization is a group of algorithms used for factorizing a nonnegative matrix (matrix with no negative entries) into two or more nonnegative matrices. The problem of performing a nonnegative matrix factorization is not always tractable, nevertheless numerical approximations of this task exist. This method is used in many fields of science, such as astronomy, bioinformatics and machine learning, as they study data with positive entries [3,4,19]. Furthermore, the nonnegative rank, which we define below, plays a critical role in communication theory as it characterizes randomized communication complexity and randomized correlation complexity [15,29].
Formally, given a nonnegative matrix M ∈ R n×m + , a nonnegative factorization of M means factorizing it into M = UV, where U ∈ R n×r + and V ∈ R r×m + are nonnegative. The nonnegative rank of M, rank + [M], is the smallest number r for which such a factorization can be found. Equivalently, the nonnegative rank of M is the smallest number for which M can be decomposed into a positive sum over r nonnegative rank-1 matrices [7]. For the purpose of this paper, we formalize the definition of the nonnegative rank in a following way.
Definition 2 (nonnegative rank) Let P XY be a (|X| × |Y |)-dimensional nonnegative matrix. The nonnegative rank of P XY is defined as where P (z) X is a nonnegative |X|-dimensional row vector and each P

Rank constraints for causal models
In this section, we explore a relation between the nonnegative rank of a probability distribution over two variables, and the causal relation between these variables.

Nonnegative rank as a measure of dependence
We start by making a trivial observation that any joint probability distribution over two variables can be represented as a nonnegative matrix P XY , with entries P xy = P X=x,Y =y = P(X = x,Y = y). Notice that although we donote P xy using the bold font, it is a single element of the matrix P XY . If X and Y are independent, P XY can be factorized as P XY = P X P Y . Then, it follows from Definition 2 that P XY has nonnegative rank 1. Conversely, as the correlation between X and Y increases, so does the nonnegative rank of their distribution. It means that the nonnegative rank of a probability distribution can be interpreted as a measure of dependence between two variables.
Consider an example in which the dependence between X and Y is only due to a third variable, denoted by Z. Let Z take r different values, i.e., the cardinality of Z is r, which we denote |Z| = r. Throughout this paper we take r to be the minimum cardinality of Z for which X and Y are conditionally independent. If X and Y are conditionally independent given Z, the probability distribution must factorize as: Here, P X|Z=z (P Y |Z=z ) is a conditional probability distribution over X (Y ) given that Z takes a particular value Z = z. This factorization is equivalent to the one given in Eq. (2), with rank + [P XY ] = r. We summarize this result in the following Proposition.
Proposition 1 Let P XY ∈ R n×m + represent a joint probability distribution on random variables X and Y that have finite cardinalities, |X| = n and |Y | = m. The following are equivalent: 1. There exists a nonnegative factorization of P XY with rank + [P XY ] = r.
Notice that the set of products {Q Y } z form a valid probability distribution. We denote it as Further, define the following vectors: We can now decompose P XY as It is now clear that one can define the following conditional probabilities Y , and decompose P XY as which is the factorization from Eq. (3). 2 =⇒ 1: Assume P XY can be factorized as in Eq. (3). Then, since P Z=z is just a positive number, it follows trivially that rank + [P XY ] = r. This proposition was also stated in Refs. [14], [17,Appendix 7.5] and [8,Proposition 2].
Recall that we assumed that r is the minimum cardinality of Z for which X and Y are conditionally independent. The direction (2 =⇒ 1) of Proposition 1 is true due to this assumption. In general, the cardinality of Z can be greater than rank + [P XY ], which we exploit in the next Subsection.

Restricted cardinality constraints
Consider the example from the previous Subsection, where Z is assumed to be the only source of dependence between X and Y . If Z is an observed variable, it is straightforward to verify whether this hypothesis holds. However, if Z is unobserved, constraints implied by conditional independence relations are impossible to directly evaluate. We now show that knowledge about the cardinality of Z is enough to test conditional independence relations in some cases.
Let us interpret Proposition 1 from the perspective of causal models. If P XY can be factorized as in Eq. (3), then there exist a hypothetical variable Z, with cardinality |Z| = r, and probability distribution P Z that makes X and Y conditionally independent. In graphical causal models, the notion of conditional independence is captured by d-separation. If two variables X and Y are conditionally independent given Z, a DAG that illustrates the causal structure of X, Y and Z must satisfy the following two properties. First, there must be no direct causal influence between X and Y (no direct arrow form X to Y , or from Y to X). Second, Z must d-separate X and Y . Three examples of causal structures that satisfy these properties are depicted in Figure 1. Circles correspond to observed variables, and dashed circles correspond to unobserved variables. In Figure 1 (a), Z is a common cause of X and Y . In Figure 1 (b), Z is a causal mediary between X and Y . Finally, in Figure 1 (c), a d-separating set Z = {Z 1 , Z 2 } consists of both a common cause and a causal mediary. In the first two examples, the cardinalities of the d-separating variables are given by |Z|. In the third example, the cardinality of the d-separating set is equal to |Z 1 | × |Z 2 |.
From Proposition 1, the variable that d-separates X and Y must have at least cardinality r, which is given by rank + [P XY ]. This result is summarized in the corollary below. Corollary 1 The nonnegative rank of the matrix P XY whose components are P xy = P(X = x,Y = y) constitutes a lower bound for the cardinality of a variable Z that d-separates X and Y, The constraint given in Eq. (4) enables to verify whether conditional independence relations implied by a DAG hold, even when the d-separating variable is unobserved. The knowledge about Z required to evaluate the bound is only its cardinality. In the next section, we give examples that use Corollary 1 to test conditional independence relations in DAGs with latent variables.

Applications
In this section, we give two applications of Corollary 1. First, we describe its potential to improve causal discovery algorithms. In particular, we consider a scenario in which our constraint witnesses direct causal influence between two variables in a presence of a confounder. Second, we reprove two results from communication theory: characterization of randomized correlation complexity and randomized communication complexity.

Witnessing Causal Influence
Imagine that two ternary events, X and Y (|X| = |Y | = 3), are observed to exhibit some statistical dependence. Additionally, assume they share an unobserved common cause U which is known to have cardinality |U| = 2. Two possible hypotheses regarding the causal relations between X, Y and U are illustrated in Fig. 2. In Fig. 2 (a), one believes the statistical dependence is purely due to a common cause, whereas in Fig. 2 (b), X additionally has a direct causal influence on Y . In Fig. 2 (a), U d-separates X and Y . From Corollary 1, we know that Therefore, if rank + [P XY ] > 2, one can discard the hypothesis of Fig. 2 (a) and conclude that there must be a direct causal influence of X on Y as in Fig. 2 (b).
As an example, suppose P XY is given by the probability distribution from Table 1. In this case, the nonnegative rank of P XY is equal to 3. One can certify that rank + [P XY ] is greater than |U|, and only the causal hypothesis of Fig. 2 (b) is compatible with this probability distribution. In this example, observing rank + [P XY ] = 3 witnesses direct influence between X and Y . Y 0 1 2 0 0 1 /6 1 /6 X 1 1 /6 0 1 /6 2 1 /6 1 /6 0 Table 1: An example of a probability distribution P XY , with |X| = |Y | = 3.
The example above shows the essence of Corollary 1. It captures the fact that strong correlation between high cardinality variables, when no direct influence between them exists, must be explained by a high cardinality common cause. This dependence was also noticed in Ref. [17,Corollary 1], where the authors show that the graphs illustrated in Fig. 2 (a) and Fig. 2 (b) may sometimes be distinguished under the presumption that the confounder has small cardinality, i.e., |U| < min {|X|, |Y |}.
Corollary 1 can also be applied to scenarios where the common cause is partially observed. We define a partially observed set as a set in which only some variables are observed. An example of a partially observed common cause C = {Z,U} is illustrated in Fig. 2. In Fig. 2 (c), X and Y share two common causes: an unobserved one, denoted by U, and an observed one, denoted by Z. In Fig. 2 (d), X additionally influences Y .
In Fig. 2 (c), Z is an observed variable, and we can condition the values of X and Y on its particular value, Z = z. Let P (z) XY denote the probability distribution over X and Y conditioned on a particular value z of Z, P z xy = P(X = x,Y = y|Z = z). After conditioning, U d-separates X and Y (given Z = z) in Fig. 2 (c). The constraint given by Corollary 1 in this case is Given P (z) XY for all z, any violation of this condition witnesses direct causal influence between X and Y , just like in the example with an unobserved common cause.
Corollary 1 can also be used to solve a converse problem. Suppose a distribution P XY is observed, where variables X and Y are known to share an unobserved common cause Z (or more generally, are d-separated by Z). If nothing is known about Z, constraint from Eq. (4) can be used to lower bound its cardinality.

Distribution generation
Recall a distribution generation protocol that is often discussed in communication theory [29,15]. Suppose two parties, Alice and Bob, are responsible for generating random variables X and Y respectively, such that X and Y have a prespecified joint distribution P XY . Our goal is to quantify how much information must be communicated or shared to generate P XY .
In the literature about this problem two scenarios have been developed and studied separately. In the first scenario, Alice and Bob each receive information from a third party before they generate X and Y . We denote the information they share by Z. In this protocol, no communication between Alice and Bob is allowed. The information Z distributed this way is often referred to as a random seed. The minimum size of a seed that must be given to Alice and Bob in order to produce the required distribution P XY is called the randomized correlation complexity of the joint distribution, and is denoted RCorr[P XY ]. Here, a size of a seed is the number of bits that is distributed to each party, and is given by log 2 (|Z|). In the second scenario, one-way communication between Alice and Bob is allowed. After generating X, Alice sends a message to Bob through an intermediary, which we denote M. The minimum number of bits Alice needs to communicate to Bob such that they can produce the target distribution is called the randomized communication complexity, and is denoted RComm[P XY ]. The number of bits communicated between the parties is given by log 2 (|M|).
It has been shown that RCorr[P XY ] and RComm[P XY ] are equal, and are fully characterized by log 2 (rank + [P XY ]) [29]. We now show that given Corollary 1, this result follows trivially from a causal analysis of the problem. To begin, we note that in the first scenario, the seed Z is distributed to both Alice and Bob, hence it can affect both X and Y . Graphically, this scenario corresponds to Fig. 1 (a), where Z is a common cause of X and Y . In the second scenario, the message M can depend on the random variable X, which in turn affects how Bob generates Y . This scenario is illustrated by a causal structure in Fig. 1 (b), with M playing the role of Z in the figure.
We now observe that X and Y are d-separated by Z and M respectively in the two scenarios. Finally, we analyze a more involved protocol, in which Alice and Bob share a seed Z 1 , and Alice can communicate to Bob through a mediary Z 2 . This scenario is illustrated in Fig. 1 (c). The cardinality of the d-separating set Z = {Z 1 , Z 2 } is equal to |Z 1 | × |Z 2 |. It follows from Corollary 1 that and log 2 (|Z 1 | × |Z 2 |) ≥ log 2 (rank + [P XY ]).
We can intuitively view the constraint on |Z 1 | × |Z 2 | as defining a trade-off between the amount of information shared through a seed and the amount transferred using communication. This perspective enables studying relatively complex problems in which the size of the seed or the capacity of the communication channel is constrained. Similarly, if one of these cardinalities is unobserved, information about the other can be used to bound it, using Corollary 1.

A Specific Case with Additional Constraints
The inequality given in Corollary 1 gives a sufficient, but not a necessary condition for identifying causal relations between variables. In this Section, we give an example of a correlation that satisfies the constraints implied by the d-separation relations in a model, but nevertheless imposes new constraints that require additional causal mechanisms. Let us revisit the causal hypotheses illustrated in Fig. 2 (c) and Fig. 2 (d). Assume X, Y and Z are binary observed variables, and U is a binary unobserved variable. In this scenario, P (z) XY is a 2 × 2 matrix and the constraint given in Corollary 1 is always satisfied. This is the case because rank + [P (z) XY ] ≤ 2 and |U| = 2. However, this is not enough to conclude that the causal relations between X, Y , Z and U are those illustrated by Fig. 2 (c). In this Section, we give an example of a probability distribution P (z) XY that satisfies the above conditions, and requires a direct causal influence as in Fig. 2 (d). First, we consider a specific probability distribution P (z) XY , with |X| = |Y | = |Z| = |U| = 2, under the causal hypothesis of Fig. 2 (c). Then, we show that the causal structure of Fig. 2 (c) implies some nontrivial constraints that must be satisfied in order to explain the specific form of P (z) XY . We start with a reminder that an intuitive way of describing an outcome of a random variable is with its expectation value. Let V = {V 1 , ...,V n } be a set of n binary variables that each take a value in {−1, 1}. The conversion formula between the probability distribution P(V) = P(V 1 , ...V n ) and the expectation values of variables in V can be written as Let us consider a special case when X and Y are observed to be perfectly positively correlated for both possible values of Z, Assume that this perfect correlation arises due to the causal mechanism encoded in Fig. 2 (c). Eq. (6) implies that (a) X|Z,U = ±1; and for both values of Z and U, that is, X and Y need to depend deterministically on Z and U (Eq. (7a)) in the same way (Eq. (7b)).
Our goal is to derive constraints on X|Z = z that arise due to this condition. If any nontrivial constraints exist, the causal hypothesis of Fig. 2 (c) explains the perfect correlation between X and Y only if they are satisfied. Violation of these constraints calls for an additional causal mechanism (additional to ones in Fig. 2 (c)) that explains the dependence between X and Y .
In order for the constraints on X|Z = z to be verifiable, they can only depend on the observed variables. We perform a quantifier elimination using the known constraints to eliminate the unobserved variable from the set of inequalities and equalities. We find that either It then follows from XY |Z = z = 1 that These constraints show that for the special case being considered, one of the following conditions must be true for the marginal expectation values of X conditional on Z: 1. X|Z = z has the same magnitude for z = 1 and z = −1 (it is equal up to a sign); or 2. X|Z = z is deterministic and does not depend on U at all for one value of Z = z.
The same holds for Y |Z = z . If any of these conditions on X|Z = z and Y |Z = z are violated, then we conclude that perfect positive correlation between X and Y cannot be explained by the causal structure encoded in Fig. 2 (c). An additional causal influence between X and Y is needed to explain the considered correlation, for example the one in Fig. 2 (d).
This is an example of a correlation between X and Y wherein the constraint induced by Corollary 1 is satisfied for the d-separation relation pertinent to the causal hypothesis of Fig. 2 (c), but nonetheless this correlation is incompatible with this causal hypothesis.

Towards Quantum Causality
We now give a different perspective on the motivation behind studying causal models with hidden common causes. In this Section, we show that DAGs with unobserved common causes can act as classical analogues of models in which a quantum common cause is shared.
Consider a scenario in which two parties share a source of entangled quantum systems and use it to output a classical correlation P AB . The structure of this protocol is illustrated in Fig. 3. The quantum seed that is distributed to Alice and Bob is denoted by ρ C , quantum systems are represented by double wires and classical variables are represented by single wires. Under the assumption that only one copy of ρ C is available in this protocol, some form of a quantum copy operation must be performed on it before the distribution. As quantum systems cannot be cloned, the quantum decomposition operation introduced in [1] is applied. It is represented with the white dot symbol and implies the decomposition of the Hilbert space H C into a direct sum of tensor products. This operation decomposes ρ C into factors on H C B carried to Bob and H C A carried to Alice. The outputs of this operation are denoted by ρ A and ρ B . Assume P AB is generated by one of the two protocols. The first protocol is illustrated in Fig. 3 (a). Here, Bob and Alice perform measurements M A and M B on their share of the system ρ C to generate classical variables A and B, respectively. The second protocol is encoded in Fig. 3 (b). It allows for classical communication from Bob to Alice before Alice outputs A. In this protocol, the value of A is an output of a gate U AB that depends on the value of B. The main challenge of analyzing these protocols is the restriction on acquiring information about quantum systems relative to classical systems. Once a quantum state is sharply measured, it is projected to a post-measurement state that corresponds to the choice of measurement. This feature of quantum theory prevents the observer from making passive observations of quantum common causes. However, the observer can possess some limited information about the quantum system, for example, its dimension. This situation is analogous to a classical causal model involving an unobserved common cause with restricted cardinality. In such models, the observer has limited knowledge about the classical common cause, namely, its cardinality. This perspective on the problem allows to see the similarities between classical causal models illustrated in Figs. 2 (a) and (b), and circuits in Figs. 3 (a) and (b).
Although Corollary 1 only concerns classical causal models, a similar concept is used in communication theory [29,11], where models with a quantum seed can be characterized using positive semidefinite rank [15]. Therefore, Corollary 1 has the potential to be further extended to models that include quantum systems. Specifically, knowledge about the dimension of a quantum common cause could play a role similar to that of the cardinality of a classical common cause. Formally, the minimum dimension of the local Hilbert space of a shared entangled state needed to generate P AB is defined as quantum correlation complexity. It is characterized by the positive semidefinite rank of P AB [15], where positive semidefinite rank is defined as follows. Let dim(ρ A ) and dim(ρ B ) be the dimensions of the local Hilbert space of Alice and Bob, respectively.
Definition 3 (positive semidefinite rank) Let P AB be a dim(ρ A ) × dim(ρ B )-dimensional nonnegative matrix. The positive semidefinite rank of P AB is defined as where E a and F b are r × r positive semidefinite matrices.
Assume dim(ρ A ) = dim(ρ B ) = d. It follows that for the hypothesis illustrated in Fig. 3 (a)  For example, for the probability distribution P XY defined in Table 1, rank + [P XY ] = 3, while rank PSD [P XY ] = 2 (see Example 2.6 in [10]). It means that the dimension of a quantum resource needed to generate P XY is smaller than the cardinality of a classical resource needed for this task. Examples of this form have been studied before [29], and they show an advantage of quantum resources over classical ones. We finish by noting that a similar approach can be used to analyse a protocol in which a quantum message is sent from Bob to Alice (the quantum analogue of Fig. 1 (b)). Similarities between classical and quantum protocols for correlation generation suggest that classical results, like the one given in Corollary 1, can be used to set the stage for the quantum equivalent of causal analysis.

Conclusions
We derived universal constraints for causal models in which the cardinality of an unobserved d-separating variable is known. While the majority of existing methods of constraining distributions compatible with latent causal structures do not use any information about unobserved variables, our result relies on having knowledge of the cardinality of an unobserved variable. We showed that our result has applications in causal analysis. Furthermore, we recognized the analogy between classical causal models with hidden common causes and models that involve quantum systems. As we identify a new way of bounding causal effects in models with hidden variables, we set the stage for quantum extensions of this formulation.