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 Russell’s 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
 Natural number, Countable set, Georg Cantor, Cardinal number

Click to edit the document details