11email: {christel.baier, florian.funke, simon.jantsch,
jakob.piribauer, robin.ziemek}@tu-dresden.de
Probabilistic causes in Markov chains
Abstract
The paper studies a probabilistic notion of causes in Markov chains that relies on the counterfactuality principle and the probability-raising property. This notion is motivated by the use of causes for monitoring purposes where the aim is to detect faulty or undesired behaviours before they actually occur. A cause is a set of finite executions of the system after which the probability of the effect exceeds a given threshold. We introduce multiple types of costs that capture the consump-tion of resources from different perspectives, and study the complexity of computing cost-minimal causes
1 Introduction
The study of cause-effect relationships in formal systems has received considerable attention over the past 25 years. Notions of causality have been proposed within various models, including structural equation models [37, 27, 26], temporal logics in Kripke structures [10, 3] and Markov chains [34, 35], and application areas have been identified in abundance, ranging from finance [32] to medicine [33] to aeronautics [30]. These approaches form an increasingly powerful toolkit aimed at explaining why an observable phenomenon (the effect) has happened, and which previous events (the causes) are logically linked to its occurrence. As such, causality plays a fundamental building block in determining moral responsibility [9, 5] or legal accountability [20], and ultimately fosters user acceptance through an increased level of transparency [36].
Despite the variety of models, application areas, and involved disciplines, all approaches essentially rely on (one of) two central paradigms that dictate how causes are linked to their effects: the counterfactuality principle and the probability-raising property. Counterfactual reasoning prescribes that an effect would not have happened if the cause had not occurred. Probability-raising states that the probability of the effect is higher whenever the cause has been observed.
The contribution of this paper is twofold: First, we define a novel notion of cause for -regular properties in stochastic operational models. Second, we study the complexity of computing optimal causes for cost mechanisms motivated by monitoring applications.
The causes presented in this paper combine the two prevailing causality paradigms mentioned above into a single concept. More specifically, a -cause for an -regular property in a discrete-time Markov chain is a set of finite executions of the system such that the probability that occurs after executing is at least , where is typically larger than the overall probability of . The counterfactuality principle is invoked through the additional requirement that almost every execution exhibiting the event contains a finite prefix which is a member of the -cause. This condition makes our approach amenable to the needs of monitoring a system at runtime.
Imagine a critical event that the system should avoid (e.g., a fully automated drone crashing onto the ground), and assume that a -cause for this event is known (e.g., physical specifications foreshadowing a crash). Typically, the probability threshold – which can be thought of as the sensitivity of the monitor – should be lower if the criticality of the event is higher. As the system is running, as soon as the execution seen so far is part of the -cause, the monitor can trigger an alarm and suitable countermeasures can be taken (e.g., manual control instead of automated behavior). As such, our approach can be preventive in nature.
The monitoring application outlined above suggests computing a -cause from the model before the system is put to use. However, multiple -causes may exist for the same property, which raises the question which one to choose. Cyber-physical systems consume time, energy and other resources, which are often subject to budget restrictions. Furthermore, the intended countermeasures may incur different costs depending on the system state. Such costs can be modelled using state weights in the Markov chain, which induce weight functions on the finite executions either in an accumulative (total resource consumption) or instantaneous (current consumption intensity) fashion. On top of this model, we present three cost mechanisms for causes: (1) The expected cost measures the expected resource consumption until the monitor triggers an alarm or reaches a safe state, (2) the partial expected cost measures the expected consumption where executions reaching a safe state do not incur any cost, and (3) the maximal cost measures the maximal consumption that can occur until an alarm is triggered.
non-negative weights | in (7) | pseudo-polyn. (4) | in (9) |
accumulated | -hard (6) | ||
arbitrary weights | in (7) | -hard (6) | pseudo-polyn. (9) |
accumulated | in | ||
arbitrary weights | in (4.4) | in (4.4) | in (4.4) |
instantaneous |
Figure 1 summarizes our results regarding the complexity of computing cost-minimal -causes for the different combinations of weight type and cost mechanism. To obtain these results we utilize a web of connections to the rich landscape of computational problems for discrete-time Markovian models. More precisely, the results for the expected cost rely on connections to the stochastic shortest path problem (SSP) studied in [4]. The pseudo-polynomial algorithm for partial expected costs on non-negative, accumulated weights uses partial expectations in Markov decision processes [38]. The -hardness result is proved by reduction from the cost problem for acyclic Markov chains stated in [24]. The pseudo-polynomial algorithm for the maximal cost on arbitrary, accumulated weights applies insights from total-payoff games [6, 8].
Full proofs missing in the main document can be found in the appendix.
1.0.1 Related Work.
The structural model approach to actual causality [27] has sparked notions of causality in formal verification [10, 3]. The complexity of computing actual causes has been studied in [16, 17]. A probabilistic extension of this framework has been proposed in [21]. Recent work on checking and inferring actual causes is given in [29], and an application-oriented framework for it is presented in [30]. The work [34] builds a framework for actual causality in Markov chains and applies it to infer causal relationships in data sets. It was later extended to continuous time data [32] and to token causality [35] and has been refined using new measures for the significance of actual and token causes [28, 45].
A logic for probabilistic causal reasoning is given in [44] in combination with logical programming. The work [43] compares this approach to Pearl’s theory of causality involving Bayesian networks [37]. The CP-logic of [44] is close to the representation of causal mechanisms of [14]. The probability-raising principle goes back to Reichenbach [39]. It has been identified as a key ingredient to causality in various philosophical accounts, see e.g. [15].
Monitoring -regular properties in stochastic systems modeled as Hidden Markov Chains (HMCs) was studied in [40, 23] and has recently been revived [18]. The trade-off between accuracy and overhead in runtime verification has been studied in [2, 41, 31]. In particular [2] uses HMCs to estimate how likely each monitor instance is to violate a temporal property. Monitoring the evolution of finite executions has also been investigated in the context of statistical model checking of LTL properties [13]. How randomization can improve monitors for non-probabilistic systems has been examined in [7]. The safety level of [19] measures which portion of a language admits bad prefixes, in the sense classically used for safety languages.
2 Preliminaries
2.0.1 Markov chains.
A discrete-time Markov chain (DTMC) is a tuple , where is a finite set of states, is the initial state, and is the transition probability function where we require for all . For algorithmic problems all transition probabilities are assumed to be rational. A finite path in is a sequence of states such that for all . Let . Similarly one defines the notion of an infinite path . Let and be the set of finite and infinite paths. The set of prefixes of a path is denoted by . The cylinder set of a finite path is . We consider as a probability space whose -algebra is generated by such cylinder sets and whose probability measure is induced by (see [1, Chapter 10] for more details).
For an -regular language let . The probability of in is defined as . Given a state , let , where is the DTMC obtained from by replacing the initial state with . If is clear from the context, we omit the subscript. For a finite path , define the conditional probability
Given , let . For such reachability properties we have for any . We assume all states . Furthermore, define a weight function on as a map . We typically use it to induce a weight function (denoted by the same letter) by accumulation, i.e., . Finally, a set is called prefix-free if for every we have .
2.0.2 Markov decision processes.
A Markov decision process (MDP) is a tuple , where is a finite set of states, is a finite set of actions, is the initial state, and is the transition probability function such that for all states and actions we have . An action is enabled in state if and we define . We require for all states .
An infinite path in is an infinite sequence such that for all we have . Any finite prefix of that ends in a state is a finite path. A scheduler is a function that maps a finite path to an enabled action . Therefore it resolves the nondeterminism of the MDP and induces a (potentially infinite) Markov chain . If the chosen action only depends on the last state of the path, i.e., , then the scheduler is called memoryless and naturally induces a finite DTMC. For more details on DTMCs and MDPs we refer to [1].
3 Causes
This section introduces a notion of cause for -regular properties in Markov chains. For the rest of this section we fix a DTMC with state space , an -regular language over the alphabet and a threshold .
Definition 1 (-critical prefix)
A finite path is a -critical prefix for if .
Definition 2 (-cause)
A -cause for in is a prefix-free set of finite paths such that
-
(1)
almost every has a prefix , and
-
(2)
every is a -critical prefix for .
Note that condition (1) and (2) are in the spirit of completeness and soundness as used in [11]. The first condition is our invocation of the counterfactuality principle: Almost every occurrence of the effect (for example, reaching a target set) is preceded by an element in the cause. If the threshold is chosen such that , then the second condition reflects the probability-raising principle in that seeing an element of implies that the probability of the effect has increased over the course of the execution. For monitoring purposes as described in the introduction it would be misleading to choose below as this could instantly trigger an alarm before the system is put to use. Also should not be too close to as this may result in an alarm being triggered too late.
If coincides with a reachability property one could equivalently remove the almost from (1) of Definition 2. In general, however, ignoring paths with probability zero is necessary to guarantee the existence of -causes for all .
Example 1
Consider the DTMC depicted in Figure 3. For , a possible -cause for in is given by the set since both and reach with probability greater or equal than . The sets and are not -causes: is not prefix-free and for the path has no prefix in . Another -cause is .
Example 2
It can happen that there does not exist any finite -cause. Consider Figure 3 and . Since , the singleton is not a -cause. Thus, for every either or is contained in any -cause, which must therefore be infinite. There may also exist non-regular -causes (as languages of finite words over ). For example, for the -cause is non-regular.
Remark 1 (Reduction to reachability properties)
Let be a deterministic Rabin automaton for and consider the product Markov chain as in [1, Section 10.3]. For any finite path there is a unique path whose projection onto the first factor is . Under this correspondence, a bottom strongly connected component (BSCC) of is either accepting or rejecting, meaning that for every finite path reaching this BSCC the corresponding path in satisfies , or respectively, [1, Section 10.3]. This readily implies that almost every has a -critical prefix and that, therefore, -causes exist for any .
Moreover, if is the union of all accepting BSCCs in , then
(3.1) |
holds for all finite paths of [1, Theorem 10.56]. Hence every -cause for in induces a -cause for in by taking . Vice versa, given a -cause for in , then the set of projections of paths in onto their first component is a -cause for in . In summary, the reduction of -regular properties on to reachability properties on the product also induces a reduction on the level of causes.
Remark 1 motivates us to focus on reachability properties henceforth. To apply the algorithms presented in Section 4 to specifications given in richer formalisms such as LTL, one would first have to apply the reduction to reachability given above, which increases the worst-case complexity exponentially.
In order to align the exposition with the monitoring application we are targeting, we will consider the target set as representing an erroneous behavior that is to be avoided. After collapsing the target set, we may assume that there is a unique state , so is the language we are interested in. Further, we collapse all states from which is not reachable to a unique state with the property . After this pre-processing, we have . Define the set
of all acceptable final states for -critical prefixes. This set is never empty as for all .
There is a partial order on the set of -causes defined as follows: if and only if for all there exists such that . The reflexivity and transitivity are straightforward, and the antisymmetry follows from the fact that -causes are prefix-free. However, this order itself has no influence on the probability. In fact for two -causes with it can happen that for we have . This partial order admits a minimal element which is a regular language over and which plays a crucial role for finding optimal causes in Section 4.
[Canonical -cause]propositioncanonicalpath Let
Then is a regular -cause (henceforth called the canonical -cause) and for all -causes we have .
We now introduce an MDP associated with whose schedulers correspond to the -causes of . This is useful both to represent -causes and for algorithmic questions we consider later.
Definition 3 (-causal MDP)
For the DTMC define the -causal MDP associated with , where is defined as follows:
Given a weight function on , we consider also as weight function on .
Example 3
Figure 4 demonstrates the -causal MDP construction of . The black edges are transitions of , probabilities are omitted. Let us assume . To construct one adds transitions for the action , as shown by red edges.
Technically, schedulers are defined on all finite paths of an MDP . However, under any scheduler, there are usually paths that cannot be obtained under the scheduler. Thus we define an equivalence relation on the set of schedulers of by setting if . Note that two schedulers equivalent under behave identically.
Lemma 1
There is a one-to-one correspondence between equivalence classes of schedulers in w.r.t. and -causes in for .
Proof
Given a -cause for in , we construct the equivalence class of scheduler by defining if , and otherwise . Vice versa, given an equivalence class of schedulers, we define the -cause
Since can only be chosen once on every path in , it is easy to see that implies . Note that every is a -critical prefix since it ends in and every path in is covered since either is chosen or ends in . Furthermore, the second condition makes prefix-free. ∎
3.1 Types of -causes and induced monitors
We now introduce two classes of -causes which have a comparatively simple representation, and we explain what classes of schedulers they correspond to in the -causal MDP and how monitors can be derived for them.
Definition 4 (State-based -cause)
A -cause is state-based if there exists a set of states such that .
State-based -causes correspond to memoryless schedulers of which choose exactly for paths ending in . For DTMCs equipped with a weight function we introduce threshold-based -causes:
Definition 5 (Threshold-based -cause)
A -cause is threshold-based if there exists a map such that
where .
Threshold-based -causes correspond to a simple class of weight-based schedulers of the -causal MDP, which base their decision in a state only on whether the current weight exceeds the threshold or not. Intuitively, threshold-based -causes are useful if triggering an alarm causes costs while reaching a safe state does not (see Section 4.2): The idea is that cheap paths (satisfying ) are picked for the -cause, while expensive paths are continued in order to realize the chance (with probability ) that a safe state is reached and therefore the high cost that has already been accumulated is avoided.
The concept of -causes can be used as a basis for monitors that raise an alarm as soon as a state sequence in the -cause has been observed. State-based -causes have the advantage that they are realizable by “memoryless” monitors that only need the information on the current state of the Markov chain. Threshold-based monitors additonally need to track the weight that has been accumulated so far until the threshold value of the current state is exceeded. So, the memory requirements of monitors realizing a threshold-based -cause are given by the logarithmic length of the largest threshold value for -states. All algorithms proposed in Section 4 for computing cost-minimal -causes will return -causes that are either state-based or threshold-based with polynomially bounded memory requirements.
3.2 Comparison to prima facie causes
The work [34] presents the notion of prima facie causes in DTMCs where both causes and events are formalized as PCTL state formulae. In our setting we can equivalently consider a state as the effect and a state subset constituting the cause. We then reformulate [34, Definition 4.1] to our setting.
Definition 6 (cf. [34])
A set is a -prima facie cause of if the following three conditions hold:
-
(1)
The set is reachable from the initial state and .
-
(2)
-
(3)
The condition we discussed for -causes is hard-coded here as (3). In [34] the value is implicitly existentially quantified and thus conditions (2) and (3) can be combined to for all . This encapsulates the probability-raising property. However, may be reached while avoiding the cause , so -prima facie causes do not entail the counterfactuality principle. Definition 2 can be seen as an extension of -prima facie causes by virtue of the following lemma:
Lemma 2
For every -prima facie cause induces a state-based -cause.
Proof
Let be a -prima facie cause. By condition (1) and (2) of Definition 6 we have . Since every path reaching trivially visits a state in , the set is a state-based -cause. ∎
4 Costs of -causes
In this section we fix a DTMC with state space , unique initial state , unique target and safe state and a threshold . As motivated in the introduction, we equip the DTMC of our model with a weight function on states and consider the induced accumulated weight function . These weights typically represent resources spent, e.g., energy, time, material, etc.
4.1 Expected cost of a -cause
Definition 7 (Expected cost)
Given a -cause for in consider the random variable with
Since , paths not falling under the two cases above have measure . Then the expected cost of is the expected value of .
The expected cost is a means by which the efficiency of causes for monitoring purposes can be estimated. Assume a -cause is used to monitor critical scenarios of a probabilistic system. This means that at some point either a critical scenario is predicted by the monitor (i.e., the execution seen so far lies in ), or the monitor reports that no critical scenario will arise (i.e., has been reached) and can therefore be turned off. If the weight function on the state space is chosen such that it models the cost of monitoring the respective states, then estimates the average total resource consumption of the monitor.
We say that a -cause is -minimal if for all -causes we have . By , we denote the value of any -minimal -cause .
theoremexpcostComplexity
-
(1)
Given a non-negative weight function , the canonical -cause from Remark 1 is -minimal.
-
(2)
For an arbitrary weight function , an -minimal and state-based -cause and can be computed in polynomial time.
Proof
The statement (1) follows from the fact that if holds for two -causes, then we have , which is shown in the appendix. The value can then be computed in polynomial time using methods for expected rewards in Markov chains[1, Section 10.5].
To show (2), we reduce our problem to the stochastic shortest path problem (SSP)[4] from to . By Lemma 1 equivalence classes of schedulers in are in one-to-one correspondence with -causes in . Let be a -cause associated with a representative scheduler . One can show that is equal to the expected accumulated weight of paths under scheduler in upon reaching . A scheduler minimizing this value can be computed in polynomial time by solving the SSP in [4], and the algorithm returns a memoryless such . It follows that is an -minimal and state-based -cause. ∎
4.2 Partial expected cost of a -cause
In this section we study a variant of the expected cost where paths with no prefix in the -cause are attributed zero costs. A use case for this cost mechanism arises if the costs are not incurred by monitoring the system, but by the countermeasures taken upon triggering the alarm. For example, an alarm might be followed by a downtime of the system, and the cost of this may depend on the current state and history of the execution. In such cases there are no costs incurred if no alarm is triggered.
Definition 8 (Partial expected cost)
For a -cause for in consider the random variable with
The partial expected cost of is the expected value of .
The analogous statement to Definition 7 (1) does not hold for partial expected costs, as the following example shows.
Example 4
Consider the Markov chain depicted in Figure 5. For and we have . The canonical -cause is with . Now let be any -cause for . If the path belongs to , then it contributes to . If instead the paths and belong to , they contribute . So, the latter case provides a smaller if , and the -minimal -cause is therefore
For , the expected cost of this -cause is . So, it is indeed smaller than .
theorempexpcostPseudoP Given a non-negative weight function , a -minimal and threshold-based -cause , and the value , can be computed in pseudo-polynomial time. has a polynomially bounded representation.
Proof
For the pseudo-polynomial time bound we apply the techniques from [38] to optimize the partial expected cost in MDPs to the -causal MDP . It is shown in [38] that there is an optimal scheduler whose decision depends only on the current state and accumulated weight and that such a scheduler and its partial expectation can be computed in pseudo-polynomial time. It is further shown that a rational number can be computed in polynomial time such that for accumulated weights above , an optimal scheduler has to minimize the probability to reach . In our case, this means choosing the action . Due to the special structure of , we can further show that there is indeed a threshold for each state such that action is optimal after a path ending in if and only if . So, a threshold-based -minimal -cause can be computed in pseudo-polynomial time. Furthermore, we have for each state and as has a polynomially bounded representation the same applies to the values for all states . ∎
Since the causal MDP has a comparatively simple form, one could expect that one can do better than the pseudo-polynomial algorithm obtained by reduction to [38]. Nevertheless, in the remainder of this section we argue that computing a -minimal -cause is computationally hard, in contrast to (cf. Definition 7). For this we recall that the complexity class [22] is characterized as the class of languages that have a probabilistic polynomial-time bounded Turing machine such that for all words one has if and only if accepts with probability at least (cf. [25]). We will use polynomial Turing reductions, which, in contrast to many-one reductions, allow querying an oracle that solves the problem we reduce to a polynomial number of times. A polynomial time algorithm for a problem that is -hard under polynomial Turing reductions would imply that the polynomial hierarchy collapses [42]. We reduce the -complete cost-problem stated in [24, Theorem 3] to the problem of computing .
theorempexpcostPP Given an acyclic DTMC , a weight function and a rational , deciding whether is -hard under Turing reductions.
Proof
We sketch a Turing reduction from the following problem which is shown to be -hard in[24]: Given an acyclic DTMC over state space with initial state , absorbing state such that , weight function and natural number , decide whether
In an acyclic Markov chain the values of have a polynomially bounded binary representation as shown in the appendix. This allows for a binary search to compute with polynomially many calls to the corresponding threshold problem. We use this procedure in a polynomial-time Turing reduction.
Let now be a Markov chain as in [24, Theorem 3] and let be a natural number. We construct two Markov chains and depicted in Figure 6. The -minimal -cause in both Markov chains consists of all paths reaching with weight and all paths reaching that do not have a prefix reaching with weight . The difference between the values in the two Markov chains depends only on the probability of paths in the minimal -cause collecting the additional weight in . This probability is . By repeatedly using the threshold problem to compute in and as described above, we can hence decide the problem from [24, Theorem 3]. More details can be found in the appendix. ∎
4.3 Maximal cost of a -cause
In practice, the weight function on the Markov chain potentially models resources for which the available consumption has a tight upper bound. For example, the amount of energy a drone can consume from its battery is naturally limited. Instead of just knowing that on average the consumption will lie below a given bound, it is therefore often desirable to find monitors whose costs are guaranteed to lie below this limit for (almost) any evolution of the system.
Definition 9 (Maximal cost)
Let be a -cause for in . We define the maximal cost of to be
The maximal cost of a -cause is a measure for the worst-case resource consumption among executions of the system. Therefore, by knowing the minimal value for -causes one can ensure that there will be no critical scenario arising from resource management. {restatable}theoremmaxcostSummary
-
(1)
Given a non-negative weight function , the canonical -cause is -minimal and can be computed in time polynomial in the size of .
-
(2)
For an arbitrary weight function a -minimal and state-based -cause and can be computed in pseudo-polynomial time.
-
(3)
Given a rational , deciding whether is in .
Proof
To show (1) it suffices to note that for non-negative weight functions is monotonous with respect to the partial order on -causes. Therefore is -minimal. For (2) we reduce the problem to a max-cost reachability game as defined in [6]. The algorithm from [6] computes the lowest maximal cost and has a pseudo-polynomial time bound. By virtue of the fact that the minimizing player has a memoryless strategy we can compute a set of states on which a -minimal -cause is based upon. In order to show (3) we reduce the max-cost reachability game from (2) further to mean-payoff games, as seen in [8]. Mean-payoff games are known to lie in [8]. ∎
4.4 Instantaneous cost
The given weight function on states can also induce an instantaneous weight function which just takes the weight of the state visited last, i.e., . This yields an alternative cost mechanism intended to model the situation where the cost of repairing or rebooting only depends on the current state, e.g., the altitude an automated drone has reached.
We add the subscript ‘’ to the three cost variants, where the accumulative weight function has been replaced with the instantaneous weight function , the error state is replaced by an error set and the safe state is replaced by a set of terminal safe states . Thus we optimize -causes for in .
theoreminstcost For , , and a cost-minimal -cause and the value of the minimal cost can be computed in time polynomial in . In all cases can be chosen to be a state-based -cause.
Proof
We first note that can be reduced to by setting the weight of all states in to . We then construct an MDP (different from ) which emulates the instantaneous weight function using an accumulating weight function. Thus, finding an -minimal -cause reduces to the SSP from [4], which can be solved in polynomial time. The solution admits a memoryless scheduler and thus is state-based in this case.
For we order the states in by their cost and then start iteratively removing the states with lowest cost until is not reachable anymore. The set of states which where removed induce a state-based -minimal -cause . This gives us a polynomial time procedure to compute and . ∎
5 Conclusion
We combined the counterfactuality principle and the probability-raising property into the notion of -causes in DTMCs. In order to find suitable -causes we defined different cost models and gave algorithms to compute corresponding cost-minimal causes.
Cyber-physical systems are often not fully probabilistic, but involve a certain amount of control in form of decisions depending on the system state. Such systems can be modeled by MDPs, to which we intend to generalize the causality framework presented here. Our approach also assumes that the probabilistic system described by the Markov chain is fully observable. By observing execution traces instead of paths of the system, generalizing the notion of -causes to hidden Markov models is straightforward. However, the corresponding computational problems exhibit additional difficulties which we address in future work.
References
- [1] Baier, C., Katoen, J.P.: Principles of Model Checking (Representation and Mind Series). The MIT Press, Cambridge, MA (2008)
- [2] Bartocci, E., Grosu, R., Karmarkar, A., Smolka, S.A., Stoller, S.D., Zadok, E., Seyster, J.: Adaptive Runtime Verification. In: Runtime Verification. pp. 168–182. Springer Berlin Heidelberg (2013). https://doi.org/10.1007/978-3-642-35632-2_18
- [3] Beer, I., Ben-David, S., Chockler, H., Orni, A., Trefler, R.: Explaining counterexamples using causality. In: Computer Aided Verification (CAV’09). pp. 94–108. Springer Berlin Heidelberg (2009). https://doi.org/10.1007/978-3-642-02658-4_11
- [4] Bertsekas, D.P., Tsitsiklis, J.N.: An analysis of stochastic shortest path problems. Math. Oper. Res. 16(3), 580–595 (1991)
- [5] Braham, M., van Hees, M.: An anatomy of moral responsibility. Mind 121 (483), 601–634 (2012)
- [6] Brihaye, T., Geeraerts, G., Haddad, A., Monmege, B.: To Reach or not to Reach? Efficient Algorithms for Total-Payoff Games. In: Proceedings of the 26th International Conference on Concurrency Theory (CONCUR’15). LIPIcs, vol. 42, pp. 297–310 (2015). https://doi.org/10.4230/LIPIcs.CONCUR.2015.297
- [7] Chadha, R., Sistla, A.P., Viswanathan, M.: On the expressiveness and complexity of randomization in finite state monitors. J. ACM 56(5) (2009). https://doi.org/10.1145/1552285.1552287
- [8] Chatterjee, K., Doyen, L., Henzinger, T.A.: The Cost of Exactness in Quantitative Reachability. In: Models, Algorithms, Logics and Tools. pp. 367–381. Springer International Publishing, Cham (2017). https://doi.org/10.1007/978-3-319-63121-9_18
- [9] Chockler, H., Halpern, J.Y.: Responsibility and Blame: A Structural-Model Approach. J. Artif. Int. Res. 22(1), 93–115 (Oct 2004)
- [10] Chockler, H., Halpern, J.Y., Kupferman, O.: What causes a system to satisfy a specification? ACM Transactions on Computational Logic 9(3), 20:1–20:26 (2008)
- [11] Cini, C., Francalanza, A.: An LTL Proof System for Runtime Verification. In: Baier, C., Tinelli, C. (eds.) Tools and Algorithms for the Construction and Analysis of Systems. pp. 581–595. Springer Berlin Heidelberg (2015)
- [12] Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, Third Edition. The MIT Press, 3rd edn. (2009)
- [13] Daca, P., Henzinger, T.A., Křetínský, J., Petrov, T.: Faster Statistical Model Checking for Unbounded Temporal Properties. In: Tools and Algorithms for the Construction and Analysis of Systems. pp. 112–129. Springer Berlin Heidelberg (2016). https://doi.org/10.1007/978-3-662-49674-9_7
- [14] Dash, D., Voortman, M., De Jongh, M.: Sequences of Mechanisms for Causal Reasoning in Artificial Intelligence. In: Proceedings of the 23rd International Joint Conference on Artificial Intelligence. p. 839–845. IJCAI ’13, AAAI Press (2013)
- [15] Eells, E.: Probabilistic Causality. Cambridge Studies in Probability, Induction and Decision Theory, Cambridge University Press (1991)
- [16] Eiter, T., Lukasiewicz, T.: Complexity results for explanations in the structural-model approach. Artificial Intelligence 154(1-2), 145–198 (2004)
- [17] Eiter, T., Lukasiewicz, T.: Causes and explanations in the structural-model approach: Tractable cases. Artificial Intelligence 170(6-7), 542–580 (2006)
- [18] Esparza, J., Kiefer, S., Kretinsky, J., Weininger, M.: Online monitoring -regular properties in unknown Markov chains. Arxiv preprint, 2010.08347 (2020)
- [19] Faran, R., Kupferman, O.: Spanning the spectrum from safety to liveness. Acta Informatica 55(8), 703–732 (2018). https://doi.org/10.1007/s00236-017-0307-4
- [20] Feigenbaum, J., Hendler, J.A., Jaggard, A.D., Weitzner, D.J., Wright, R.N.: Accountability and Deterrence in Online Life. In: Proceedings of WebSci ’11. ACM, New York, NY, USA (2011). https://doi.org/10.1145/2527031.2527043
- [21] Fenton-Glynn, L.: A Proposed Probabilistic Extension of the Halpern and Pearl Definition of ‘Actual Cause’. The British Journal for the Philosophy of Science 68(4), 1061–1124 (2016)
- [22] Gill, J.: Computational complexity of probabilistic Turing machines. SIAM Journal on Computing 6(4), 675–695 (1977). https://doi.org/10.1137/0206049
- [23] Gondi, K., Patel, Y., Sistla, A.P.: Monitoring the Full Range of -Regular Properties of Stochastic Systems. In: Proceedings of VMCAI’09:. pp. 105–119. Springer Berlin Heidelberg (2009). https://doi.org/10.1007/978-3-540-93900-9_12
- [24] Haase, C., Kiefer, S.: The Odds of Staying on Budget. In: Automata, Languages, and Programming. pp. 234–246. Springer Berlin Heidelberg (2015). https://doi.org/10.1007/978-3-662-47666-6_19
- [25] Haase, C., Kiefer, S.: The Complexity of the Kth Largest Subset Problem and Related Problems. Inf. Process. Lett. 116(2), 111–115 (2016). https://doi.org/10.1016/j.ipl.2015.09.015
- [26] Halpern, J.Y.: A Modification of the Halpern-Pearl Definition of Causality. In: Proceedings of IJCAI’15. p. 3022–3033. AAAI Press (2015)
- [27] Halpern, J.Y., Pearl, J.: Causes and Explanations: A Structural-Model Approach: Part 1: Causes. In: Proceedings of the 17th Conference in Uncertainty in Artificial Intelligence (UAI). pp. 194–202 (2001)
- [28] Huang, Y., Kleinberg, S.: Fast and Accurate Causal Inference from Time Series Data. In: Proceedings of FLAIRS 2015. pp. 49–54. AAAI Press (2015)
- [29] Ibrahim, A., Pretschner, A.: From Checking to Inference: Actual Causality Computations as Optimization Problems. In: Proceedings of ATVA’20. pp. 343–359. Springer Internat. Publishing, Cham (2020). https://doi.org/10.1007/978-3-030-59152-6_19
- [30] Ibrahim, A., Pretschner, A., Klesel, T., Zibaei, E., Kacianka, S., Pretschner, A.: Actual Causality Canvas: A General Framework for Explanation-Based Socio-Technical Constructs. In: Proceedings of ECAI’20. pp. 2978 – 2985. IOS Press Ebooks (2020). https://doi.org/10.3233/FAIA200472
- [31] Kalajdzic, K., Bartocci, E., Smolka, S.A., Stoller, S.D., Grosu, R.: Runtime Verification with Particle Filtering. In: Runtime Verification. pp. 149–166. Springer Berlin Heidelberg (2013). https://doi.org/10.1007/978-3-642-40787-1_9
- [32] Kleinberg, S.: A Logic for Causal Inference in Time Series with Discrete and Continuous Variables. In: Proceedings of IJCAI’11. pp. 943–950 (2011)
- [33] Kleinberg, S., Hripcsak, G.: A review of causal inference for biomedical informatics. J Biomed Inform. 44(6), 1102–12 (2011). https://doi.org/10.1016/j.jbi.2011.07.001
- [34] Kleinberg, S., Mishra, B.: The Temporal Logic of Causal Structures. In: Proceedings of the Twenty-Fifth Conference on Uncertainty in Artificial Intelligence (UAI). pp. 303–312 (2009)
- [35] Kleinberg, S., Mishra, B.: The Temporal Logic of Token Causes. In: Proceedings of KR’10. p. 575–577. AAAI Press (2010)
- [36] Miller, T.: Explanation in Artificial Intelligence: Insights from the Social Sciences. Artificial Intelligence 267 (06 2017). https://doi.org/10.1016/j.artint.2018.07.007
- [37] Pearl, J.: Causality. Cambridge University Press, 2nd edn. (2009)
- [38] Piribauer, J., Baier, C.: Partial and conditional expectations in Markov decision processes with integer weights. In: Proceedings of FoSSaCS’19. Lecture Notes in Computer Science, vol. 11425, pp. 436–452. Springer (2019)
- [39] Reichenbach, H.: The Direction of Time. Dover Publications (1956)
- [40] Sistla, A.P., Srinivas, A.R.: Monitoring Temporal Properties of Stochastic Systems. In: Logozzo, F., Peled, D.A., Zuck, L.D. (eds.) Verification, Model Checking, and Abstract Interpretation. pp. 294–308. Springer Berlin Heidelberg (2008)
- [41] Stoller, S.D., Bartocci, E., Seyster, J., Grosu, R., Havelund, K., Smolka, S.A., Zadok, E.: Runtime Verification with State Estimation. In: Runtime Verification. pp. 193–207. Springer Berlin Heidelberg (2012). https://doi.org/10.1007/978-3-642-29860-8_15
- [42] Toda, S.: PP is as Hard as the Polynomial-Time Hierarchy. SIAM Journal on Computing 20(5), 865–877 (1991). https://doi.org/10.1137/0220053
- [43] Vennekens, J., Bruynooghe, M., Denecker, M.: Embracing Events in Causal Modelling: Interventions and Counterfactuals in CP-Logic. In: Logics in Artificial Intelligence. pp. 313–325. Springer Berlin Heidelberg (2010)
- [44] Vennekens, J., Denecker, M., Bruynooghe, M.: CP-logic: A language of causal probabilistic events and its relation to logic programming. Theory and Practice of Logic Programming 9(3), 245–308 (2009). https://doi.org/10.1017/S1471068409003767
- [45] Zheng, M., Kleinberg, S.: A Method for Automating Token Causal Explanation and Discovery. In: Proceedings of FLAIRS’17 (2017)
6 Appendix
We will denote nondeterministic finite automata as tuples , where is the set of states, is the alphabet, is the initial state, is the transition function, and are the final states. A transition is also denoted by .
*
Proof
The first condition ensures that every path in is a -critical prefix for in . The second condition ensures that no proper prefix is a -critical prefix, and therefore is prefix-free. Clearly, every path reaching passes through since is itself an element in . These properties together show that is a -cause.
Let be another -cause for in and consider an arbitrary path . This means . If we have for all that , then and there is nothing to prove. Therefore assume that there exists such that . For minimal such we have and thus .
To prove that is regular, consider the deterministic finite automaton for , , , and final states . The transition relation is given by
i.e., all states in are terminal. We argue that this automaton describes the language :
If then there are no transitions possible and and by definition.
Let and let be a word accepted by . By definition we have For any state visited by we know that since is terminal. This means and thus .
Now let and . A run for in is possible, since we have an edge for every transition in except for outgoing edges of . These exceptions are avoided, since for we have and thus no state but the last one is in . On the other hand is in by assumption and thus the word is accepted by . ∎
In the following proof, let for .
*
Proof
To show (1), we claim that for two -causes and with we have . Let and be the corresponding random variables of and , respectively. We prove by showing for almost all that . In the argument below we ignore cases that have measure .
From it follows that . We now deal separately with the three cases obtained by the partition
For both random variables consider the unique prefix of in the respective -cause. For any we know by definition of that there is with . Therefore
For the random variable takes the unique prefix in , whereas takes the path such that . Since , we have almost surely that , and therefore
For both random variables evaluate the same path and therefore . Therefore we have for any that .
To compute consider the DTMC but change the transitions such that every state in is terminal. The value is then the expected reward defined in [1, Definition 10.71]. Expected rewards in DTMCs can be computed in polynomial time via a classical linear equation system [1, Section 10.5.1].
We show (2) by reducing the problem of finding an -minimal -cause to the stochastic shortest path problem (SSP) [4] in . For a scheduler of of denote the corresponding -cause for in by (cf. Lemma 1). In [4] the authors define the value expected cost of a scheduler in an MDP. This value with respect to the target set coincides with .
The SSP asks to find a scheduler in minimizing the expected cost. It is shown in [4] that a memoryless such and the value can be computed in polynomial time. The scheduler corresponds to an -minimal state-based -cause . ∎
*
Proof
Consider a scheduler of with weight function and recall that denotes Markov chain induced by . Define the random variable
The partial expectation of a scheduler in is defined as the expected value of . The minimal partial expectation is . It is known that there is a scheduler obtaining the minimal partial expectation [38].
Then a -cause and the corresponding scheduler satisfy . A cost-minimal scheduler for the partial expectation in an MDP with non-negative weights can be computed in pseudo-polynomial time by [38]. In this process we also compute .
Furthermore, we can show that once the action is optimal in a state with accumulated weight , it is also optimal for all weights : Suppose choosing is optimal in some state if the accumulated weight is . Let be the partial expected accumulated weight that the optimal scheduler collects from then on and let . The optimality of implies that . For all , this implies as well. We conclude the existence of such that is optimal if and only if the accumulated weight is at least . If is not enabled in a state , we have . Therefore is a threshold-based -cause defined by . As shown in [38], there is a saturation point such that schedulers minimizing the partial expectation can be chosen to behave memoryless as soon as the accumulated weight exceeds . This means that can be chosen to be either at most or for each state . The saturation point and hence all thresholds have a polynomial representation. ∎
*
Proof
We provide a Turing reduction from the following problem that is shown to be -hard in [24]: Given an acyclic DTMC over state space with initial state , absorbing state such that , weight function and natural number , decide whether
Given such an acyclic DTMC we construct the two DTMCs and depicted in Figure 7. We consider the -minimal -causes for in for and . Suppose a path arrives at state with probability and accumulated weight . We have to decide whether the path or the extension should be included in the cost-minimal -cause. The path has weight and probability . We observe that is the optimal choice if
This is the case if and only if . If , and , both choices are equally good and we decide to include the path in this case. Hence, the -minimal -causes for in is
Similarly in the following -cause is -minimal:
Therefore we have
We conclude that
In the sequel we prove that we can use an oracle for the threshold problem for to compute the values
This in turn allows us to compute and thus to decide the problem from [24].
In any acyclic Markov chain , the following holds: We assume that the transition probabilities are encoded as fractions of coprime integers. Therefore we can compute the product of all denominators to get a number in polynomial time and with polynomially bounded encoding. The maximal weight of a path in can be computed in linear time and has a polynomially bounded encoding. Therefore the minimal is an integer multiple of and there are at most many different values for . This in particular applies to the value of the -optimal -cause.
Note that there are still exponentially many possible values for the minimal partial expected costs in both Markov chains . A binary search over all possible values with polynomially many applications of the threshold problem:
Is for a rational ?
is possible, nevertheless. We therefore can apply this binary search to find the exact value for both DTMCs by solving polynomially many instances of the threshold problem. This gives us a polynomial Turing reduction to the problem stated in [24]. ∎
*
Proof
We start with some preliminary considerations. If there exists a path entirely contained in containing a cycle with positive weight, then of any -cause is : Consider a such a positive cycle reachable in . Then there are paths in which contain this cycle arbitrarily often. For any -cause almost all of these paths need a prefix in . Since no state in the positive cycle nor in the path from to the cycle is in , such prefixes also contain the cycle arbitrarily often. This means these prefixes accumulate the positive weight of the cycle arbitrarily often. Therefore, all -causes contain paths with arbitrary high weight. Thus, before optimizing we check whether there are positive cycles reachable in the induced graph of on . This can be done in polynomial time with the Bellman-Ford algorithm [12]. Henceforth we assume there are no such positive cycles.
For (1) we show that for two -causes with we have . Let be arbitrary. Since is a -critical prefix (and ), there is a path with . Since is a -cause, there exists . The assumption and the fact that both and are prefix-free then force to be a prefix of . Hence , and since was arbitrary, it follows that . This implies that is -minimal.
Computing for a non-negative weight function can be reduced to the computation of the longest path in a modified version of . There can be cycles with weight in , but in such cycles every state in the cycle has weight . Therefore we collapse such cycles completely without changing the value . We further collapse the set into one absorbing state . Computing now amounts to searching for a longest path from to in this modified weighted directed acyclic graph. This can be done in linear time by finding a shortest path after multiplying all weights with . Therefore the problem can be solved in overall polynomial time [12].
For (2) we reduce the problem of finding a -minimal -cause to the solution of a max-cost reachability game as defined in [6]. Define the game arena with
where is a copy of . The copy of state in will be written as . There is an edge between states and in if and only if one of the following conditions holds:
-
(1)
, and ,
-
(2)
, and for with we have ,
-
(3)
, and , or
-
(4)
and .
We equip with a weight function by mirroring the weight function of in the following way:
-
(1)
for , and
-
(2)
for ,
-
(3)
for ,
In [6] the authors define a min-cost reachability game. For our purposes we need the dual notion of a max-cost reachability game, which is obtained by just changing the total payoff of a play avoiding the target set to be instead of . The objective of player with vertices is then to maximize the total payoff of the play, while player with vertices wants to minimize the total payoff. By changing from min-cost to max-cost reachability games, the results of [6] concerning strategies for and are reversed.
We consider the max-cost reachability game on with target . Define as the total payoff if both sides play optimally if the play starts in . We have if there is a positive cycle reachable in by the above argumentation. In contrast we always have since is reachable and can be avoided by . We proceed to show that our reduction is correct.
Claim
There is a - correspondence between strategies of and -causes in for .
Proof (of the claim)
Let be a strategy for and consider the set of consistent plays starting in that we denote by . Every play that reaches corresponds to a -critical prefix. To see this, omit all states contained in from the play. If reaches and the last state before is in then omit as well. The resulting path in is a -critical prefix. Let be the set of -critical prefixes obtained in this way from plays in reaching .
To see that any path to in has a prefix in , let be the strategy of player that moves along the steps of . In the resulting play, either player moves to from some state according to and the corresponding prefix of is in , or the play reaches from a state not in and hence the path itself belongs to . Since the strategy has to make decisions for every , every path has a prefix in . is prefix-free since a violation of this property would correspond to a non-consistent play, since can only choose the edge to once. Therefore is a -cause in for .
Since the reverse of this construction follows along completely analogous lines, we omit it here.
Claim
We have .
Proof (of the claim)
Recall that the value is defined as the total payoff of the unique play , where is the optimal strategy of and is the optimal strategy of . For each strategy for , let be the corresponding -cause as provided by the above claim. The optimal strategy for against has to avoid and hence has to create a play that ends in . The total payoff of the induced play is equal to the weight of the corresponding path and the total payoff that can achieve is precisely . The optimal strategy for hence corresponds to a -minimal -cause and .
Now we apply the results for max-cost reachability games to -causes. This means we can use [6, Algorithm 1] to compute the value of the game for all states in pseudo-polynomial time. This includes the value . From the values of the game starting at different states, an optimal memoryless strategy for can be derived by fixing a successor for each state with and
Since the strategy is memoryless, we get a set for which chooses the edge to . By the construction from before the -minimal -cause obtained in this way is state-based.
For (3) we note that the decision problem “Is ?” is in by a reduction to mean-payoff games, as shown in [8]. The reduction introduces an edge from back to and removes the state from the game. We have that in the original max-cost reachability game if and only if the value of the constructed mean-payoff game is at most . The reason is that the value of the mean-payoff game is at most if there is a strategy for such that can neither force a positive cycle in the original max-cost reachability game nor reach with positive weight in the original game. We adapt the construction to show that the decision problem “is ?”, for , is also in . This can be achieved by adding an additional vertex with weight to , removing the edge between and and adding two new edges, one from to and one from to . The value of the resulting mean-payoff game is then at most if there is a strategy for such that can neither force a positive cycle in the original max-cost reachability game nor reach with weight above in the original game. ∎
*
Proof
Recall that we now work with a set of error states instead of a single state and a set of terminal safe states such that if and only if . We first note that for an instantaneous weight function we reduce partial expected cost to expected cost and therefore only need to consider one case: Given a weight function , consider the weight function obtained from by forcing for all . Then the partial expected cost with respect to equals the expected cost with respect to .
For we construct an MDP , where is a disjoint copy of in which all states are terminal. The copy of state in will be written as . We define for , and for . The action is not enabled states outside of , and the action is not enabled in . We define the weight function by
The construction is illustrated in Figures 9 and 9: Consider the DTMC depicted in Figure 9. The transition probabilities are omitted. It is enough to know and . The constructed MDP can be seen in Figure 9, where the black edges are inherited from , and the red edges are added transitions belonging to the action .
For the constructed MDP we consider the accumulated weight function. This emulates an instantaneous weight function for the random variable of . A scheduler of this MDP corresponds to a -cause for in the same way as established in Lemma 1. Therefore the problem of finding an -minimal -cause for instantaneous weight in for is equivalent to finding a cost-minimal scheduler in for . This is again the stochastic shortest path problem for , which can be solved in polynomial time by [4]. Since the SSP is solved by a memoryless scheduler, the -minimal -cause is state-based.
For the computation of the minimal value of , we enumerate the set as where such that for all . Now we iteratively remove states in increasing order starting with . After removing a state , we check whether is reachable in the resulting Markov chain. If this is the case, we continue by removing the next state. If is not reachable anymore, the set induces a state-based -cause . This follows from the fact that each path from the initial state to contains a state in and that . Furthermore, . Let be the largest number less than such that . There is no -cause in which all paths end in as was still reachable after removing these states from . So, there is no -cause with . Therefore, is indeed a -minimal -cause. Since , the procedure terminates at the latest when the states in are removed. Hence the algorithm finds a state-based -minimal -cause in polynomial time. ∎