This is an example ginen in my textbook "Introduction to theory of Computation
".
Given that the alphabet ∑ as{0,1}
,
{w|every 0 in w is followed by atleast one 1}}
a regular expression for it is shown as (01+)*. 1+
means only a single instance of 1. Now what I understand is that (01+)*
would mean string like 0101010101010101....
what if I have a string 11111101 or 011111111
or just 1
These string do fulfill the given criteria. But the regular expression (01+)*
will not generate them.
Secondly for `{w|w starts and ends with same symbol}` the expression is given as `0∑*0 U 1∑*1 U 0 U 1.`
As far as I have learnt the union of two things means either first one, or second one OR BOTH. If I take a string 01110 for 0∑*0
and another string for 10001 1∑*1
and then take union of these two 0111010001
the union string DOESNOT
start and end with same symbol. Does it mean that union cannot combine both or the expression is not correct?