Given two regular languages (fx given by it's accepting regular expression), is there an algorithm to determine if one is a subset of the other?
Asked
Active
Viewed 171 times
2
-
Please ask only one question per post. I suggest that you split this into two posts, and ask each question in a separate post. I've edited this post to focus on the first question. You can post your second question in a separate post (using the 'Ask Question' button). I expect that the former is likely answered in standard textbooks on automata theory. What resources have you consulted? What have you found so far? – D.W. Apr 04 '23 at 17:08
-
It is interesting that we can test inclusion when we can test equivalence, because regular languages/expressions are closed under union: $L\subseteq R$ iff $L\cup R = R$. – Hendrik Jan Apr 04 '23 at 18:55
1 Answers
1
Yes, there is an algorithm for it, but there is unlikely to be an efficient algorithm.
Notice that you can convert between a regular expression and a NFA in polynomial time. Moreover, determining whether one regular language is a subset of another, if both are represented as NFAs, is PSPACE-complete. Therefore, there is unlikely to be a polynomial-time algorithm for this, unless there is a huge surprise in complexity theory.
See Is there an efficient test for if an NFA accepts a subset of another NFA?. Related: Is language decideable (subset)?.

D.W.
- 159,275
- 20
- 227
- 470