1

In my class we have discussed the fact that, given a representation $\langle R\rangle$ of a regular expression $R$, we can decide whether it accepts any string by first finding an equivalent NFA, and then seeing if there is a path from the start to an accepting vertex. This can be done in polynomial time.

However, we have also said that it is NP-hard to determine whether $L(R)\ne\{0,1\}^*$. That is to say, the language $\{\langle R\rangle: R \text{ is a RE and } L(R)\ne\{0,1\}^*\}$ is NP-hard.

I'm having a hard time reconciling these two facts. To decide whether $L(R)\ne \{0,1\}^*$, it is equivalent to decide whether $\overline{L(R)} \ne \emptyset$, which we can do in polynomial time. I'm sure there's something I'm misunderstanding but I can't tell what.

Addem
  • 387
  • 1
  • 13

1 Answers1

2

Deciding emptiness of a regular expression is easy, but constructing the complement is not.

The paper Succinctness of the Complement and Intersection of Regular Expressions by Gelade and Neven (arXiv:0802.2869, published at STACS 2008) suggests this construction (from regexp to regexp of the complement) is doubly exponential. See Thm 4.1(2).

Let $\Sigma$ be a four-letter alphabet. For every $n \in \mathbb N$, there is a regular expression $r_n$ of size $\mathscr O(n)$ such that any regular expression $r$ defining $Σ^* \setminus L(r_n)$ is of size at least $2^{2^n}$.

Hendrik Jan
  • 31,459
  • 1
  • 54
  • 109