# Proving a regular expression is correct [duplicate]

I'm working on homework for my formal languages and automata course. The text we are using is the first edition of Hopcroft and Ullman (1979).

Specifically, I'm unsure how to justify that my regular expression for exercise 2.10 (c) is correct. The question asks for a regular expression for the set of all strings not containing the substring 101 (over the alphabet $\{0, 1\}$). Additionally, it asks for justification that the regular expression you write is correct.

I came up with the regular expression $$0^*1^*0^* + (1 + 00 + 000)^* + 0^+1^+0^+.$$

As for the justification, what exactly are they looking for?

• "justifying" is not necessarily "proving". What they are looking for depends on the standards of your school/class/staff. It can range from a hand-wavy explanation of why your regexp indeed generate exactly the claimed language, to a details formal proof that this is indeed the case. What answer do you expect? – Ran G. Feb 8 '14 at 23:49
• Another tip: can your regexp generate $010010$? And also note that your 3rd term is included in the first term. – Ran G. Feb 9 '14 at 2:08
• The answer to this question is covered by cs.stackexchange.com/q/1331/755 and cs.stackexchange.com/q/2016/755. – D.W. Feb 10 '14 at 3:27