Show that, given regular expression $R$, we can decide whether $L(R)$ is prefix-free

292 Views Asked by At

Suppose language $L$ is called prefix-free if no member is a proper prefix of another. For instance, cat is a proper prefix of category and so $L = \{cat,category,ego,go,rye\}$ is not prefix free.

Show that given regular expression $R$ we can decide whether $L(R)$ is prefix-free.

2

There are 2 best solutions below

2
On BEST ANSWER

If $R$ is a regular expression representing a language $L$ , then the language $L'$ of strict prefixes of $R$ is also regular (exercise: build a regular expression or an automaton for it), and then checking $L'\cap L=\emptyset$ is decidable, and answers the question whether $L$ is prefix-free.

0
On

convert it to a dfa and work from there. #itsduein85minutes