Thursday, December 4, 2008

FSA, regex, regular language and pumping lemma

Every regex has an equivalent NFSA, and every NFSA has an equivalent DFSA.

Cartesian Product:
A direct approach of union,
Qu = Q1 * Q2 (Cartesian product: all possible combo of states)
\sigmau: all same.
\deltau((q1, q2), a) = (\delta1(q1,a), \delta(q2,a))
su = (s1,s2)
Fu = (F1, F2).
I ound Cartesian Product is actually very straightforward, since it is combining two seperated DFSAs. The only problem is that we have to carry off some tedious writing when clean out the solution...

Since regex, NFSA and DFSA are in the same level of expressive power, it should be named a class. Actually, there is. A language is called Regular iff it is denoted by some regex, or is accepted by a FSA.

How to prove if the language is regular or not? This question naturally introduces another idea of "pumping lemma". That says that if L is a regular language, then every x \in L that has length greater than some n can be splited into uvw, |uv| <= n, uv^kw \in L forall k \in N.

To show this, we have an example, consider language L that accepts binary strings with equal number of 0s and 1s. Try to use pumping lemma and find contradiction.

obviously, assume x starts with a series of 0s. then by pumping lemma, x = uvw, so uv = 0^k. Then uvw, w being 1, either more 1 than 0 if k = 0, or more 0 than 1 if k >0. Therefore contradict.

No comments: