0

I'm wondering how I union two DFA's, when one has an error state. Specifically, the first DFA is this:

enter image description here

The second one doesn't really matter, but it doesn't need an error state in that at every state it takes either an 'a' or a 'b'. So I can use product construction just fine up to when I get to state q3. Let's say the machine is at (q3,z) (where z is a random state from the second DFA) and then reads an a. The second can go on happily, but the first DFA should go to an error state and not accept any more input. Because this is union and not intersection of course, I need to keep simulating the second to see if it reaches an error state.

How can I show this when constructing a union-ed DFA?

Squimmy
  • 445
  • 1
  • 3
  • 11

1 Answers1

0

An error state is a non-accepting state for which all symbols loop back to the same state. (A "sink"). It's not clear to me whether you meant q3 to be a accepting state with no outgoing transitions, or whether you meant q3 to be an error state with {q0, q1, and q2} all being accepting states. But the solution is not that different; if you don't already have a sink, create one; all illegal transitions from any other state go to the error state.

Now, you can use the product construction without problem; DFA1 reaches the error state and stays there, and DFA2 continues to do transitions. When both DFAs reach a sink, then no more transitions are possible.

rici
  • 234,347
  • 28
  • 237
  • 341