3

Is there an efficient algorithm to solve the following decision problem?

Given a finite set $S$ and a set of relations $\mathcal R$ from $S$ to $S$, determine whether there is any sequence of relations $r_1,r_2,\ldots,r_k\in\mathcal R$ such that $$r_1\circ r_2\circ \ldots\circ r_k = \emptyset$$ where $\circ$ is the usual composition of relations and $\emptyset$ is the empty relation.


This question came up as a simplification of some problems that arose while trying to implement and somewhat generalized version of the foetus termination checking algorithm in an efficient way. The question is mostly of theoretical interest to me - for the most part, I would expect inputs to such an algorithm to be small, especially after applying various algorithms that can handle common special cases of this problem. The question is interesting to me since it doesn't seem to be related to any other decisions problems I'm aware of, even after several days of thinking.

There are several ways to solve this in general, but all that I know of require at least exponential time in $|S|$.

The most obvious way (and, essentially, what the paper suggests) would be to take the closure of $\mathcal R$ under $\circ$ and just check whether $\emptyset$ is in this closure - although such a closure may contain many elements, so this is potentially very expensive (e.g. it only takes two elements of $\mathcal R$ to generate the the $|S|!$ elements of the symmetric group).

A somewhat more efficient way would be to consider the set $P(S)$ of subsets of $S$ and to consider a directed graph upon it where there is an arrow from $A$ to $B$ whenever $B=r[A]$ for some $r\in\mathcal R$ (where $r[A]$ is the image of $A$ under the relation $r$ - that is, all $y$ such that $(x,y)\in r$ for some $x\in A$). We could then search for a path from $S$ to $\emptyset$ in this graph. This is an improvement over the naive algorithm, since a straightforwards implementation of this would only have time complexity $O(|R|\cdot 2^{|S|})$ (at worst - I haven't proven any lower bound on the time complexity, just this upper bound).

Is this decision problem one that's been studied? Does it have a good algorithm or a reduction to a known hard problem?

1 Answers1

3

Your problem is equivalent to NFA (non)universality.

Consider an NFA on alphabet $\Sigma$, states $Q$, initial state $q_i$, final states $F$, and a transition relation.

We construct an instance of your problem as follows:

  • The set $S$ is $Q$.
  • For each $\sigma \in \Sigma$, there is a relation $R_\sigma$ consisting of pairs $(q,r)$ such that the NFA contains a transition from $q$ to $r$ labelled $\sigma$.
  • There is a relation $R_f$ consisting of pairs $(q,q_i)$ for all $q \in F$.

Suppose that the NFA doesn't accept some word $w = \sigma_1 \ldots \sigma_n$. I claim that $$ R_f \circ R_{\sigma_1} \circ \cdots \circ R_{\sigma_n} \circ R_f = \emptyset. $$ Indeed, suppose that $(q,q_f)$ belongs to the relation on the left. Thus there exist $q_0,\ldots,q_n$ such that:

  • $q R_f q_0$: thus $q_0 = q_i$.
  • $q_0 R_{\sigma_1} q_1, \ldots, q_{n-1} R_{\sigma_n} q_n$: thus the NFA could be at state $q_n$ after reading $w$, implying that $q_n \notin F$.
  • $q_n R_f q_f$: impossible, since $q_n \notin F$.

Conversely, suppose that the NFA accepts all words; in particular, $q_i \in F$, since the NFA accepts the empty word. This assumption directly implies that if $R$ is a composition of relations $R_\sigma$ (where $\sigma \in \Sigma$) then there exists $q_f \in F$ such that $q_i R q_f$. We think of such compositions as new relations $R_w$, where $w \in \Sigma^*$.

Consider now an arbitrary composition of relations $R_w,R_f$, we the added restriction that no two $R_w$'s appear next to each other. We claim that for any such composition $R$:

  • If $R$ ends with $R_w$, then there exists $q_f \in F$ such that $q_i R q_f$.
  • If $R$ is empty or ends with $R_f$, $q_i R q_i$.

This is clear for the empty composition (which fits both cases). Now we consider two cases:

  • If $R = S \circ R_w$, then according to the inductive hypothesis, $q_i S q_i$, and so $q_i R q_f$ for some $q_f \in F$ as mentioned above.
  • If $R = S \circ R_f$, then $q_i S q_f$ for some $q_f \in F$ (since $q_i \in F$), and so $q_i R q_i$.

This shows that no composition is empty.

Summarizing, there is an empty composition of relations iff the NFA is not universal. Since NFA universality is PSPACE-hard, so is your problem (recall PSPACE=coPSPACE). On the other hand, your problem is the special case of NFA non-universality in which all states are initial and accepting: the relations correspond to the alphabet of the NFA, just as in the construction above. Since NFA universality is in PSPACE (even when several initial states are allowed!), so is your problem. The problem is thus PSPACE-complete.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514