This preview shows pages 1–10. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Chapter 12: Regular Expressions and FiniteState Automata March 10, 2008 Outline 1 12.1 Formal Languages and Regular Expressions 2 12.2 FiniteState Automata 3 7.3 Pigeonhole Principle 4 5.4 Russells Paradox and the Halting Problem 5 7.5 Cardinality of Sets Formal Languages Definition An alphabet is a finite set of characters (symbols). Examples 1 E = { a , b , c , . . . , X , Y , Z } is the usual alphabet for English language. 2 Computer languages use a slightly richer alphabet, which is called ASCII, ASCII = E { ! , @ , $ , . . . , ? } 3 The real language of computers is based on the binary alphabet = { , 1 } Definition A string over an alphabet is either (a) the empty string ; or (b) any ordered ntuple of elements from , written without commas or parentheses. Examples 1 If = , then , 0, 1, 00, 01, 10, 11, 011000101, . . . are all strings over . 2 If = E , then in, fvedwyf, string are all strings over . Definition The length of a string is the number of characters that appear in the string. By default, we define the length of the empty string, , to be zero. Examples 1 Over the language = { , 1 } , the string 011000101 has the length 9. 2 Over E , the usual English alphabet, the string string has length 6. Definition Suppose is an alphabet and n a nonnegative integer. Then n = the set of all strings over that have length n + = the set of all strings over whose length is at least 1 * = the set of all strings over It is not difficult to see that * = 1 2 . . . n . . . Example Suppose the alphabet is = = { , 1 } . Then 1 = { } , 2 1 = { , 1 } , 3 2 = { 00 , 01 , 10 , 11 } , 4 3 = { 000 , 001 , 010 , 100 , 011 , 101 , 110 , 111 } , etc. Definition Given an alphabet , a formal language over is any fixed subset L of * . The members of L are called the words of the language. Examples (a) Given the usual English alphabet E , L = { English words } (b) Given = { , 1 } , L = { x *  x ends in 11 } = { 11 , 011 , 111 , 0011 , 1011 , . . . } (c) Given = { a , b } a palyndrome is a word which is equal to its reverse: L = { x *  x is a palyndrome } = { a , b , aa , bb , aaa , aba , bab , bbb , abba , . . . } Operations on Formal Languages Definition If is an alphabet, and x and y are two strings over , then the concatenation of x and y is the string obtained by juxtaposing the characters of both words. Example For = { , 1 } , consider x = 010 , y = 11011 Their concatenation is xy = 01011011 Notice that, in general, the concatenation of strings is not commutative; i.e....
View Full
Document
 Spring '08
 forgot

Click to edit the document details