The language of a DFA can be the empty set (by defining no final states), but can a Regular Expression do that?
If Regular Expression cannot do that, does it mean that DFA and Regular Expression are not equivalent (in at least some cases)?
The language of a DFA can be the empty set (by defining no final states), but can a Regular Expression do that?
If Regular Expression cannot do that, does it mean that DFA and Regular Expression are not equivalent (in at least some cases)?
According to Wikipedia:
Given a finite alphabet $\Sigma$, the following constants are defined as regular expressions:
(empty set) $\emptyset$ denoting the set $\emptyset$.
...
... a string that contains only an empty-set symbol is a regular expression, which represents the empty language.
re.fullmatch('a{0}', '')
in Python, which is kind of an alternative to empty set symbol.
$\endgroup$
Commented
Apr 6, 2020 at 22:28
Complementing xskxzr's answer, let me mention that if $L$ is a non-empty regular language, then $L$ has a regular expression not involving $\emptyset$; so we only need $\emptyset$ to accommodate the empty language.
This claim can be proved in many ways. One option is by induction on regular expressions. Let us prove the following claim by induction: if $r$ is a regular expression, then either $L[r] = \emptyset$, or $L[r] = L[s]$ for some $\emptyset$-free regular expression $s$.
We need to consider six cases: