Sunday, 25 November 2012

DFSA? NFSA? Regular Expression!

I've found the question on DFSA and NFSA quite interesting. It seems straightforward to me yet when it comes doing the drawing it becomes a different story. I managed to find the question about DFSA and NFSA from the old 236 course so we'll go over them today.

I realized it'll be nice to have some basics explained here. First there's a more introductory question that I found in the past tutorial paper in the CSC236 course website.

 
List the elements of {a,ab}*.  Find a way to describe strings in this language, i.e., find a predicate P(s) such that P(s) is true iff s in {a,ab}*, for all strings s over alphabet {a,b,c}.

    Q:  What's {a,ab}*?
    A:  {a,ab}* = {e} U {a,ab} U {aa,aab,aba,abab} U {aaa,...} U ...
                = {e,a,ab,aa,aab,aba,abab,aaa,aaab,aaba,aabab,...}

    Q:  How can we describe strings in {a,ab}*?
    A:  This is almost like {a,b}* (all strings of a's and b's), except
        each 'b' comes with an 'a' in front, i.e., P(s) = s is a string
        of a's and b's where each b is immediately preceded by an a.

    Q:  We're done, right?
    A:  Almost: we should check that s (- {a,ab}* iff P(s), by arguing
        each direction:
        =>  It is obvious that each string in {a,ab}* has property P()
            (every b immediately preceded by an a).
        <=  Moreover, each string where each b is immediately preceded
            by an a belongs to {a,ab}*: the string can be broken up
            into pieces 'ab' (one for each b in the string) with every
            other symbol being 'a'.

No comments:

Post a Comment