0

I need to find a DFA for this language: L = { $ \omega = xy \in (a,b)^*\mid |x|_a = |y|_b $ }

lluc22
  • 17
  • 1

1 Answers1

4

Let $w=w_1\dots w_n$ be any word in $\{a,b\}^*$. For $i=0,\dots,n$ consider the values $d_i(w):=|w_1\dots w_i|_a - |w_{i+1}\dots w_n|_b$. We can prove

  • $d_0(w) = - |w|_b \le 0$,
  • $d_n(w) = |w|_a \ge 0$,
  • $d_{i+1}(w) = d_i(w) + 1$ for $i=0,\dots,n-1$.

This implies that there must be some $i$ with $d_i(w) = 0$, and therefore $w\in L$. So $L=\{a,b\}^*$.

Klaus Draeger
  • 2,176
  • 12
  • 17