12

So given two DFAs, is the problem of finding if they generate the same language a Decidable problem?

I already know that Equality of two CFL is not Decidable

but what about Equality of two DFAs? considering most of the problems with DFAs are decidable, is this decidable as well ?

Raphael
  • 73,212
  • 30
  • 182
  • 400
Richard Jones
  • 307
  • 3
  • 11

2 Answers2

23

In order to decide whether the languages generated by two DFAs $A_1,A_2$ by the same, construct a DFA $A_\Delta$ for the symmetric difference $L(A_1) \Delta L(A_2) := (L(A_1) \setminus L(A_2)) \cup (L(A_2) \setminus L(A_1))$, and check whether $L(A_\Delta) = \emptyset$.

Here are some more details. You can construct $A_\Delta$ using the product construction: construct a product automaton, and use $(F_1 \times \overline{F_2}) \cup (\overline{F_1} \times F_2)$ as the set of accepting states.

In order to check whether $L(A_\Delta)$ is empty or not, it suffices to check whether some accepting state is reachable from the initial state, and this can be done using BFS/DFS.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
4

Given two DFA $D_1$ and $D_2$, equality of of $D_1$ and $D_2$ and checking if $D_1$ and $D_2$ generate the same language are same things.

Yes, this problem is decidable. You can minimize both $D_1$ and $D_2$ and compare their transition functions. Given a DFA, the minimization algorithm reduces the number of states to a minimum number and this DFA is unique. Here is alternative approach.

fade2black
  • 9,905
  • 2
  • 26
  • 36