3

Will the expression "0*1*1+11*0*1" be accepted by the following automaton?

enter image description here

As the expression generates strings ending with '1', I believe the automaton will accept it.

However, I found the answer to be otherwise in one of the references. Can someone please clarify it with explanation?

NOTE: + means OR operation.

neotricks
  • 49
  • 8
  • It can be simplified to [`0*1{2,}0*1`](https://www.debuggex.com/r/LI2uS4eqQ3G7iBJT). – sp00m Oct 06 '15 at 07:42
  • Your DFA accepts `0101`, not described by the regular expression. – Mariano Oct 06 '15 at 07:49
  • http://hackingoff.com/images/re2nfa/2015-10-06_00-49-31_-0700-dfa.svg – hjpotter92 Oct 06 '15 at 07:51
  • What exactly are you asking? Do you want to know whether the regex and the automaton are equivalent (generate the same language), or whether the automaton accepts all strings matched by the regex (the language generated by the regex is a subset of the language accepted by the automaton)? – melpomene Oct 06 '15 at 08:12
  • Please clarify if you're using the notation where the `+` represents an `OR`, since the answers here are assuming it's for repetition. – Mariano Oct 06 '15 at 09:05
  • @mariano yes, it means OR, updated the question. – neotricks Oct 06 '15 at 17:23
  • Yeah, I knew that... it was a heads-up for everyone ;) You know you should always do the regex -> NFA -> DFA, right? – Mariano Oct 06 '15 at 17:28

1 Answers1

2

No. Your DFA is equivalent to the expression (0*1+)+

The expression that you've specified requires at least three 1 to be accepted. Breaking it down into parts

0*
1*
1+ <-- Required at least once
1  <-- Required
1*
0*
1 <-- Required

A DFA that is equivalent to your expression needs to represent this looks like this:

enter image description here

Image created with the Regex visualizer, which allows you to generate these graphs from regular expressions.

Update: If + means or, this changes things. Your original DFA is still not equivalent. You're missing that if the accepted string starts with a 1 it will need to be followed by at least one more 1 to be accepted. The DFA for the expression looks like this:

enter image description here

As generated by inputting 0*1*1|11*0*1 into the visualizer.

Dervall
  • 5,736
  • 3
  • 25
  • 48