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.


Popular posts from this blog

Model Checking Markov Chains Against Unambiguous Automata: The Qualitative Case

This is my first blog post. The purpose of this blog is to describe some neat ideas from my research. Ideally only one idea per post, which explains the title of this blog.

Today I start with a classical topic from probabilistic verification: model checking Markov chains against $\omega$-regular specifications. I will focus on specifications given by Büchi automata, which are automata like this one:

This Büchi automaton accepts all infinite words over $\{a,b\}$ that start with $a$. The automaton is nondeterministic. The automaton is also unambiguous, which means that every infinite word has at most one accepting run.

A Markov chain, on the other hand, generates infinite words. A Markov chain looks like this:

For instance, with probability $\frac12 \cdot \frac12 \cdot 1 = \frac14$ it generates an infinite word that starts with $a b a$. For simplicity, we consider only a very simple Markov chain in this post:

This Markov chain generates an infinite word over $\{a,b\}$ uniformly at r…

Unambiguous Automata: From PSPACE to P

Computer science is about leveraging mathematical structure, for instance, in order to accelerate algorithms. More often than we'd like we can't accelerate much: For instance, checking two NFAs for language inclusion or equivalence is PSPACE-complete. Even the problem whether an NFA accepts all words is PSPACE-complete. For DFAs, those problems are easy. This means that for NFAs we can't do much better than determinizing (using the subset construction and incurring an exponential blowup) and solving the resulting DFA problem.

In this post I'll discuss an automata problem that seems to call for determinization and is, in fact, PSPACE-complete for NFAs. But there is an efficient algorithm for unambiguous automata.

Here is an example of an unambiguous automaton:
The notion of accepting states is not used in this post. By unambiguousness I just mean that the automaton has no diamonds, that is, for any states $q, r$, any word $w$ labels at most one path from $q$ to $r$. (…

Infinitely many states and no memory

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 state are squares:
The random states come with a distribution over successor states, but in the controlled states a controller chooses a successor state (or a probability distribution over the successor states). For instance, the controller could stay on the leftmost column forever, by always choosing to go one state down. Or the controller could go right at some point; in the random state a successor is picked randomly, either the initial state or the state on the right, according to the blue probabilities.

What objective should the controller aim at? In this post, the objective will be the following: visit green states infinitely often, and red states only finitely often. Here is the previous MDP with colours:
Since the controller wants to visit (infinitely many) green states…