Skip to main content

Model Checking Markov Chains Against Unambiguous Automata: The Quantitative Case

In my first post I promised to give a polynomial-time procedure to compute the probability that an infinite word (chosen uniformly at random) is accepted by a given unambiguous Büchi automaton. For example, let's take this Büchi automaton again:
Let's call the probability $x_1, x_2, x_3$, depending on the start state: \[ \begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix} := \begin{pmatrix} \text{Pr(state $1$ accepts a random word)}\\ \text{Pr(state $2$ accepts a random word)}\\ \text{Pr(state $3$ accepts a random word)} \end{pmatrix} \] I showed in the first post that $x_1, x_2, x_3$ are nonzero in this example. In order to compute the $x_i$ we set up a linear system of equations and solve it. We have \[ x_1 \ = \ \frac12 \cdot x_{1,a} + \frac12 \cdot x_{1,b}\,, \] where $x_{1,a}$ and $x_{1,b}$ denote the (conditional) probabilities that state $1$ accepts a random word, under the condition that the word starts with $a$ and $b$, respectively.
  • $x_{1,b} = 0$ because state $1$ has no $b$-labelled outgoing transitions;
  • $x_{1,a} = x_1 + x_3$ because state $1$ has $a$-labelled transitions to states $1$ and $3$. You might be afraid that we are double-counting events here, but we are not: by unambiguousness, it is impossible that the same word, say $w$, is accepted by both states $1$ and $3$, because then state $1$ would accept the word $a w$ along two different paths.
In this way we obtain a linear system of equations for $x_1, x_2, x_3$: \[ \begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix} \ = \ T \begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix}\,, \] where $T = \frac12 T(a) + \frac12 T(b)$ is the average of the transition matrices for the letters $a$ and $b$. We have three equations for three unknowns, but unfortunately the equations are dependent and do not have a unique solution. For instance, $x_1 = x_2 = x_3 = 0$ is a trivial solution.

The equation system above says that the probabilities $x_1, x_2, x_3$ are the entries of an eigenvector of $T$, corresponding to eigenvalue $1$. It follows from the Perron-Frobenius theorem for irreducible matrices that all such eigenvectors are scalar multiples of each other. So we just need to add one independent equation to the system in order to make the solution unique. What should that equation be?

I claim that this additional equation can be $x_1 + x_3 = 1$ or $x_2 = 1$ (either works). The relevant feature of $\{1,3\}$ and $\{2\}$ is that they can be reached from start state $1$ but cannot reach the empty set $\emptyset$ in the determinization of our automaton:
Here is why the equalities $x_2 = 1$ and $x_1 + x_3 = 1$ hold:
  • Clearly, we have $x_2 \le 1$. We also have $x_1 + x_3 \le 1$ because otherwise some word, say $w$, would be accepted by both states $1$ and $3$, and so state $1$ would accept the word $a w$ along two different paths.
  • These inequalities cannot be strict. Let's argue for $x_1 + x_3 \ge 1$. Recall that no word leads from $\{1,3\}$ to the empty set $\emptyset$. So for any finite word $v$, the probability that state $1$ or state $3$ accepts $v w$ (where $w$ is a random infinite word) is at least $\min\{x_1, x_2, x_3\}$, which is bounded away from $0$. Applying a general probability principle (Lévy's zero–one law) we can conclude that the probability that state $1$ or state $3$ accepts a random infinite word is $1$. Hence $x_1 + x_3 \ge 1$.
We conclude $x_1 + x_3 = 1$ and $x_2 = 1$. Combining one of these equations with the previous system we obtain: \[ \begin{aligned} \begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix} &\ = \ \underbrace{ \begin{pmatrix} \frac12 & 0 & \frac12 \\ \frac12 & \frac12 & \frac12 \\ 0 & \frac12 & 0 \end{pmatrix} }_T \begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix} \\ x_1 + x_3 &\ = \ 1\,, \end{aligned} \] which has a unique solution: \[ \begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix} = \begin{pmatrix} 1/2 \\ 1 \\ 1/2 \end{pmatrix} \]
In general, assume the states are $1, \ldots, n$. Without much loss of generality we can assume (as before) that every state is accepting and is reachable from every other state. Here is how to compute the probabilities $x_1, \ldots, x_n$:
  1. Determine in polynomial time if all $x_i$ are zero, as shown in the first post. If that's not the case, then all $x_i$ are nonzero, as the states can reach each other.
  2. Compute the average transition matrix $T$ and set up the linear system \[ \begin{pmatrix} x_1 \\ \vdots \\ x_n \end{pmatrix} \ = \ T \begin{pmatrix} x_1 \\ \vdots \\ x_n \end{pmatrix}\,. \]
  3. Compute a set of states $\alpha \subseteq \{1, \ldots, n\}$ that can be reached from a single state but cannot reach the empty set $\emptyset$ in the determinization. I explained in the previous post how this can be done in polynomial time, without computing the determinization. Add to the linear system the extra equation \[ x_{i_1} + \cdots + x_{i_k} = 1\,, \quad \text{where }\{i_1, \ldots, i_k\} = \alpha\,. \]
  4. Solve the linear system.
The whole procedure can be generalized to the case where the random word is produced by a Markov chain:
Given a Markov chain and an unambiguous Büchi automaton, one can compute in polynomial time the probability the automaton accepts a word randomly generated by the Markov chain.
Using an unpublished result (modifying step 3. above), one can sharpen the theorem by replacing "polynomial time" with the complexity class "NC", which captures problems that can be efficiently solved in parallel. This leads to an automata-theoretic PSPACE procedure for model-checking Markov chains against LTL specifications, which is optimal.

The material from this post is from a CAV'16 paper by Christel Baier, Joachim Klein, Sascha Klüppelholz, David Müller, James Worrell, and myself.

Comments

Popular posts from this blog

Oxford Admissions

An initial draft of this post was about how to make rankings more meaningful, a piece of mathsy computer science, as you expect it from this blog. My motivation is personal: I'm involved in selecting CS undergraduate students. Some people might be curious how Oxford admissions work: it's certainly a favourite subject for UK politicians and news media. Therefore I decided to postpone my original plan and to write this post about Oxford admissions. I hope I'm not playing with too much fire and the blog will not suddenly become famous for the wrong reasons!

The tenor in newspapers and political campaigns is that the Oxbridge admissions process is “opaque” and unfair. Here I am going to offer transparency and some comments on fairness. The views expressed here are my own, and may not necessarily coincide with the university's views.

Oxford's goal is to admit the strongest applicants. One can disagree with this basic premise, but we try to admit those applicants who w…

Tell me the price of memory and I give you €100

Markov Decision Processes (MDPs) are Markov chains plus nondeterminism: some states are random, the others are controlled (nondeterministic). In the pictures, the random states are round, and the controlled states are squares:
The random states (except the brown sink state) come with a probability distribution over the successor states. In the controlled states, however, a controller chooses a successor state. What does the controller want to achieve? That depends. In this blog post, the objective is very simple: take a red transition. The only special thing about red transitions is that the controller wants to take them. We consider only MDPs with the following properties:
There are finitely many states and transitions.The MDP is acyclic, that is, it has no cycles.There are a unique start state from which any run starts (in the pictures: blue, at the top) and a unique sink state where any run ends (in the pictures: brown, at the bottom). No matter what the controller does, the sink…

Probabilistic Models of Computation

This post has 0 ideas. At least, no ideas that are younger than 50 years or so. I'm talking about the two most fundamental models of probabilistic computation and the two most fundamental results about them, according to my subjective judgement.

Every computer scientist knows finite automata: State $1$ is the start state, and state $3$ is the only accepting state. Some words are accepted (i.e., have an accepting run), for instance the word $aa$. Other words are rejected (i.e., have no accepting run), for instance the word $ba$. Most questions about finite automata are decidable. For instance, the emptiness problem, which asks whether the automaton accepts at least one word. This problem is decidable in polynomial time: view the automaton as a graph, and search the graph for a path from the initial state to an accepting state. One can also decide whether two given automata are equivalent, i.e., do they accept the same words? This problem is computationally hard though: PSPACE-co…