I'm really confused about this, can some one please help me understand this better.
If r and s are regular expressions then is it always true that (r+s)=r+s*?
Are r and s sets and does the plus mean the union?
I'm really confused about this, can some one please help me understand this better.
If r and s are regular expressions then is it always true that (r+s)=r+s*?
Are r and s sets and does the plus mean the union?
On
$r$ and $s$ are regular expressions, which represent regular sets. If $r$ and $s$ are regular expressions that represent sets $R$ and $S$, then the regular expression $r+s$ denotes the set $R\cup S$.
If $r$ is a regular expression denoting the set $R$, then $$r^*$$ is a shorthand for $$\epsilon + r + rr + rrr + \cdots .$$
Let $R$ be the set of words described by the regular expression $r$, and let $S$ be the set of words described by the regular expression $s$. Then the regular expression $(r+s)^*$ describes the words in the set $(R\cup S)^*$, and $r^*+s^*$ describes the words in the set $R^*\cup S^*$. Thus, the question boils down to asking whether it’s necessarily true that $(R\cup S)^*=R^*\cup S^*$. (Looking at some very simple regular expressions should give you the answer pretty easily.)