1

How can I construct a DFA of the language L = { L1 \ L2 }

The DFA's of L1 and L2 are given, but how can I "substract" one DFA from another? Is this somehow possible with the relative complement http://en.wikipedia.org/wiki/Complement_(set_theory) and DeMorgans Law?

enter image description here

My solution: enter image description here

jannnik
  • 102
  • 1
  • 13

1 Answers1

2

To my understanding, the desired DFA can be obtained by using a modified product automaton, as used for the intersection of L1 and L2, but the terminal states have to be defined differently. Instead of making a product state (q_1,q_2) a terminal state if and only if q_1 and q_2 are terminal states in A(L1) and A(L2) respectively, define it to be a terminal state if and only if q_1 is a terminal state and q_2 is not a terminal state.

I'm not quite sure if besides this elementary argument, the result can be applied by the set formulation of De Morgan's law.

Codor
  • 17,447
  • 9
  • 29
  • 56
  • Thanks for your answer, but I think I didn't get it. I added the specific exercise with my previous edit, could you try to provide a more detailed answer to solve this? – jannnik Mar 05 '15 at 13:41
  • Are you familiar with the concept of the product automaton to recognize the intersection of two regular languages? – Codor Mar 05 '15 at 14:29
  • I know how to intersect two automatons with the cartesian product (is this the same as "product automaton"?). – jannnik Mar 05 '15 at 14:39
  • 1
    @jannnik To my understanding, it is. Use the same construction, but define the terminal states of the construction differently, as sketched in the answer. Consequently, the resulting automaton will be in a terminal state if and only if `A(L1)` would have reached a terminal state but `A(L2)` would *not* have reached a terminal state. This is opposed to the construction for intersection, where the resulting automaton will reach terminal state if and only if `A(L1)` *and* `A(L2)` would have reached terminal state. Does this help? – Codor Mar 05 '15 at 14:51
  • Ok I think I understand it. Is is right that the only terminal state in my example is (4i)? – jannnik Mar 05 '15 at 15:11
  • Yeah, thank you very much! I added my solution. Can you please have a look at it and check if it's correct? – jannnik Mar 05 '15 at 15:20
  • There seems to be a mistake, as reading `b` from `2ii` should lead to `3i`. – Codor Mar 05 '15 at 15:25
  • I corrected my solution because I missed more than the b from 2ii. Could you check it again, please? – jannnik Mar 05 '15 at 16:10