How to use the intersection construction to form a DFA?

jfisk picture jfisk · Oct 15, 2011 · Viewed 38.8k times · Source

I'm doing a homework assignment for my theory of computation class and am a bit confused how to combine 2 DFAs. The book says it uses the "intersection construction" to do so, but I'm not sure what that is. Here are 2 examples:

enter image description here

enter image description here

Answer

Patrick87 picture Patrick87 · Oct 17, 2011

The idea is pretty straightforward, although I can see where the confusion comes in. I will give a text/symbolic description of the process for making the intersection (union, difference) machines via the Cartesian Product Machine construction (same thing as you are talking about).

A DFA is a 5-tuple (E, Q, q0, A, f) where

  1. E is the input alphabet, a non-empty finite set of symbols
  2. Q is the set of states, non-empty and finite
  3. q0 is the start state, an element of Q
  4. A is the set of accepting or final states, a subset of Q
  5. f is the transition function, taking pairs from Q x E to Q

Say we have two machines M' = (E', Q', q0', A', f') and M'' = (E'', Q'', q0'', A'', f''). To make the discussion easier, we assume E' = E''. We will now construct M''' so that L(M''') = L(M') intersect (or union or difference) L(M'').

  1. Take E''' = E'' = E'
  2. Take Q''' = Q' x Q''
  3. Take q0''' = (q0', q0'')
  4. Take A''' = (x, y) where x in A' and y in A'' (for union, x in A' or y in A''; for difference, x in A' but not y in A'').
  5. Take f'''((x, y), e) = (f'(x, e), f''(y, e)).

There you go! Let's now consider two machines: one which accepts a^2n, and one which accepts a^3n (the intersection should be a machine accepting a^6n... right?).

For M', we have...

  1. E' = {a}
  2. Q' = {s0, s1}
  3. q0' = s0
  4. A' = {s0}
  5. f'(s0, a) = s1, f'(s1, a) = s0

For M'', we have...

  1. E'' = {a}
  2. Q'' = {t0, t1, t2}
  3. q0'' = t0
  4. A'' = {t0}
  5. f''(t0, a) = t1, f''(t1, a) = t2, f''(t2, a) = t0

For M''', we get...

  1. E''' = {a}
  2. Q''' = {(s0, t0), (s0, t1), (s0, t2), (s1, t0), (s1, t1), (s1, t2)}
  3. q0''' = (s0, t0)
  4. A''' = {(s0, t0)} for intersection, {(s0, t0), (s0, t1), (s0, t2), (s1, t0)} for union, {(s0, t1), (s0, t2)} for difference.
  5. f'''((s0, t0), a) = (s1, t1), f'''((s1, t1), a) = (s0, t2), f'''((s0, t2), a) = (s1, t0), f'''((s1, t0), a) = (s0, t1), f'''((s0, t1), a) = (s1, t2), f'''((s1, t2), a) = (s0, t0).

And there you go! Please let me know if this needs clarification.