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