CS5236 Advanced Automata Theory

Transcription

1 CS5236 Advanced Automata Theory Frank Stephan Semester I, Academic Year Advanced Automata Theory is a lecture which will first review the basics of formal languages and automata theory and then give insight into specific topics from the theory of automata theory. In computer science, automata are an important tool for many theoretical results and various types of automata have been used to characterise complexity classes. The lecture will give a deeper understanding of automata theory, describe the Chomsky hierarchy and introduce to various advanced topics like automatic structures, automata on infinite words, automata on trees and the learnability of classes of regular languages from queries and from positive data. Frank Stephan: Rooms S17#07-04 and COM2#03-11 Departments of Mathematics and Computer Science National University of Singapore 3 Science Drive 2, Singapore Republic of Singapore Telephone and Homepage fstephan/index.html These lecture notes contain all material relevant for the examinations and the course. For further reading, the author refers to the course text book Automata Theory and its Applications by Bakhadyr Khoussainov and Anil Nerode [19] as well as to other textbooks on automata theory [9, 13]. 1

3 1 Chomsky Hierarchy and Grammars In theoretical computer science, one considers several main ways to describe a language L; here a language is usually a set of strings w over an alphabet Σ. The alphabet Σ is usually finite. For example, {ε, 01, 10, 0011, 0101, 0110, 1001, 1010, 1100, ,...} is the language of all strings over {0, 1} which contain as many 0 as 1. Furthermore, let vw or v w denote the concatenation of the strings v and w by putting the symbols of the second string behind those of the first string: = Sets of strings are quite important, here some ways to define sets. Definition 1.1. (a) A finite list in set brackets denotes the set of the corresponding elements, for example {001, 0011, 00111} is the set of all strings which have two 0s followed by one to three 1s. (b) For any set L, let L be the set of all strings obtained by concatenating finitely many strings from L: L = {u 1 u 2... u n : n N u 1, u 2,..., u n L}. (c) For any two sets L and H, let L H denote the union of L and H, that is, the set of all strings which are in L or in H. (d) For any two sets L and H, let L H denote the intersection of L and H, that is, the set of all strings which are in L and in H. (e) For any two sets L and H, let L H denote the set {v w : v L w H}, that is, the set of concatenations of members of L and H. (f) For any two sets L and H, let L H denote the set difference of L and H, That is, L H = {u : u L u / H}. Remarks 1.2. For finite sets, the following additional conventions are important: The symbol is a special symbol which denotes the empty set it could also be written as { }. The symbol ε denotes the empty string and {ε} is the set containing the empty string. In general, sets of strings considered in this lecture are usually sets of strings over a fixed alphabet Σ. Σ is then the set of all strings over the alphabet Σ. Besides this, one can also consider L for sets L which are not an alphabet but already a set of strings themselves: For example, {0, 01, 011, 0111} is the set of all strings which are either empty or start with 0 and have never more than three consecutive 1s. The empty set and the set {ε} are the only sets where the corresponding starred set is finite: = {ε} = {ε}. The operation L L is called the Kleene star operation named after Kleene who introduced this notion. An example for a union is {0, 11} {01, 11} = {0, 01, 11} and for an intersection is {0, 11} {01, 11} = {11}. Note that L H = L (L H) for all sets L and H. Formal languages There are several ways to describe a language L, where in this chapter the emphasis is given to the first type of mechanisms. 3

4 By a mechanism which checks whether a given word w belongs to L. Such a mechanism is called an automaton or a machine. By a mechansim which generates all the words w belonging to L. This mechanism is step-wise and consists of rules which can be applied to derive the word in question. Such a mechanism is called a grammar. By a function which translates words to words such that L is the image of another (simpler) language H under this function. There are various types of functions f to be considered and some of the mechanisms to compute f are called transducers. An expression which describes in a short-hand the language considered like, for example, {01, 10, 11}. Important are here in particular the regular expressions. Regular languages are those languages which can be defined using regular expressions. Later, various characterisations will be given for these languages. Regular expressions are a quite convenient method to describe sets. Definition 1.3. A regular expression denotes either a finite sets (by listing their elements), the empty set by using the symbol or is formed from other regular expressions by the operations given in Definition 1.1 (which are Kleene star, concatenation, union, intersection and set difference). Convention. For regular expressions, one usually fixes a finite alphabet Σ first. Then all the finite sets listed are sets of finite strings over Σ. Furthermore, one does not use complement or intersection, as these operations can be defined using the other operations. Furthermore, for a single word w, one writes w in place of {w}. L + denotes the set of all non-empty concatenations over members of L; so L + contains ε iff L contains ε and L + contains a nonempty string w iff w L. Note that L + = L L. Sometimes, in regular expressions, L+H is written in place of L H. This stems from the time where typesetting was mainly done only using the symbols on the keyboard and then the addition-symbol was a convenient replacement for the union. Example 1.4. The regular language {00, 11} consists of all strings of even length where each symbol in an even position (position 0, 2,...) is repeated in the next odd position. So the language contains 0011 and but not The regular language {0, 1} 001 {0, 1, 2} is the set of all strings where after some 0s and 1s the substring 001 occurs, followed by an arbitrary number of 0s and 1s and 2s. The regular set {00, 01, 10, 11} {000, 001, 010, 010, 100, 101, 110, 111} consists 4

5 of all strings whose length is a multiple of 6. The regular set {0} {1, 2, 3, 4, 5, 6, 7, 8, 9} {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} consists of all decimal representations of natural numbers without leading 0s. Grammars have been formalised by linguists as well as by mathematicians. They trace in mathematics back to Thue [30] and in linguistics, Chomsky [7] was one of the founders. Thue mainly considered a set of strings over a finite alphabet Σ with rules of the form l r such that every string of the form xly can be transformed into xry by applying that rule. A Thue-system is given by a finite alphabet Σ and a finite set of rules where for each rule l r also the rule r l exists; a semi-thue-system does not need to permit for each rule also the inverted rule. Grammars are in principle semi-thue-systems, but they have made the process of generating the words more formal. The main idea is that one has additional symbols, so called non-terminal symbols, which might occur in the process of generating a word but which are not permitted to be in the final word. The formal definition is the following. Definition 1.5. A grammar (N, Σ, P, S) consists of two disjoint finite sets of symbols N and Σ, a set of rules P and a starting symbol S N. Each rule is of the form l r where l is a string containing at least one symbol from N. v can be derived from w in one step iff there are x, y and a rule l r such that v = xly and w = xrw. v can be derived from w in arbitrary steps iff there are n 0 and u 0, u 1,..., u n (N Σ) such that u 0 = v, u n = w and u m+1 can be derived from u m in one step for each m < n. Now (N, Σ, P, S) generates the set L = {w Σ : w can be derived from S}. Convention. One writes v w for saying that w can be derived from v in one step and v w for saying that w can be derived from v (in an arbitrary number of steps). Example 1.6. Let N = {S, T }, Σ = {0, 1}, P contain the rules S 0T 1, T 0T, T T 1, T 0, T 1 and S be the start symbol. Then S 001 and S 011: S 0T and S 0T by applying the rule S 0T 1 first and then either T 0 or T 1. Furthermore, S 0011 by S 0T 1 0T , that is, by applyging the rules S 0T 1, T T 1 and T 0. S 000 and S 111 as the first rule must be S 0T 1 and any word generated will preserve the 0 at the beginning and the 1 at the end. This grammar generates the language of all strings which have at least 3 symbols and which consist of 0s followed by 1s where there must be at least one 0 and one 1. Example 1.7. Let ({S}, {0, 1}, P, S) be a grammar where P consists of the four rules S SS 0S1 1S0 ε. Then S 0011 by applying the rule S 0S1 twice and then applying S ε. 5

6 Furthermore, S which can be seen as follows: S SS 0S1S 01S 010S1 0100S This grammar generates the language of all strings in {0, 1} which contain as many 0s as 1s. Example 1.8. Let ({S, T }, {0, 1, 2}, P, S) be a grammar where P consists of the rules S 0T 1T 2T and T 0S 1S 2S. Then S w iff w {0, 1, 2} and the length of w is odd; T w iff w {0, 1, 2} and the length of w is even but not 0. This grammar generates the language of all strings over {0, 1, 2} which have an odd length. Exercise 1.9. Make a grammar which generates all strings with four 1s followed by one 2 and arbitrary many 0s in between. That is, the grammar should correspond to the regular expression The Chomsky Hierarchy. Noam Chomsky [7] studied the various types of grammars and introduced the hierarchy named after him; other pioneers of the theory of formal languages include Marcel-Paul Schützenberger. The Chomsky hierarchy has four main levels; these levels were later refined by introducing and investigating other classes of grammars and formal languages defined by them. Definition Let (N, Σ, P, S) be a grammar. (CH3) The grammar is called left-linear (or regular) if every rule (member of P ) is of the form A wb or A w where A, B are non-terminals and w Σ. A language is regular iff it is generated by a regular grammar. (CH2) The grammar is called context-free iff every rule is of the form A w with A N and w (N Σ). A language is context-free iff it is generated by a context-free grammar. (CH1) The grammar is called context-sensitive iff every rule is of the form uaw uvw with A N and u, v, w (N Σ). A language is called context-sensitive iff it is generated by a context-sensitive grammar. (CH0) There is the most general case where the grammar does not satisfy any of the three restrictions above. A language is called recursively enumerable iff it is generated by some grammar. The next theorem permits easier methods to prove that a language is context-sensitive by constructing the corresponding grammars. Theorem A language L not containing ε is context-senstive iff it can be generated by a grammar (N, Σ, P, S) satisfying that every rule l r satisfies l r. A language L containing ε is context-sensitive iff it can be generated by a grammar 6

7 (N, Σ, P, S) satisfying that S ε is a rule and that any further rule l r satisfies l r r (N Σ {S}). Example The grammar ({S, T, U}, {0, 1, 2}, P, S) with P consisting of the rules S 0T ε, T 0T 1U 01U, U1 1U, U2 22 generates the language of all strings 0 n 1 n 2 n where n is a natural number (including 0). For example, S 0T 12 00T 1U12 00T 11U2 00T U U U One can also see that the numbers of the 0s, 1s and 2s generated are always the same: the rules S 0T 12 and S 012 and S ε produce the same quantity of these symbols; the rules T 0T 1U and T 01U produce one 0, one 1 and one U which can only be converted into a 2 using the rule U2 22 but cannot be converted into anything else; it must first move over all 1s using the rule U1 1U in order to meet a 2 which permits to apply U2 22. Furthermore, one can see that the resulting string has always the 0s first, followed by 1s and the 2s last. Hence every string generated is of the form 0 n 1 n 2 n. Note that the notion of regular language is the same whether it is defined by a regular grammar or by a regular expression. Theorem A language L is generated by a regular expression iff it is generated by a left-linear grammar. As this is basic material, the proof is omitted here. conversion in both directions. But an example is given for Example Let ({S, T }, {0, 1, 2, 3}, P, S) be a given regular grammar. For A, B {S, T }, let L A,B be the finite set of all words w {0, 1, 2, 3} such that the rule A wb exists in P and let L A be the finite set of all words w {0, 1, 2, 3} such that the rule A w exists in P. Now the grammar generates the language (L S,S ) (L S,T (L T,T ) L T,S (L S,S ) ) (L S L S,T (L T,T ) L T ). For example, if P contains the rules S 0S 1T 2 and T 0T 1S 3 then the language generated is 0 (10 10 ) (2 10 3) which consists of all words from {0, 1} {2, 3} such that either the number of 1s is even and the word ends with 2 or the number of 1s is odd and the word ends with 3. Exercise Let ({S, T, U}, {0, 1, 2, 3, 4}, P, S) be a grammar where the set P contains the rules S 0S 1T 2, T 0T 1U 3 and U 0U 1S 4. Make a regular expression describing this language. 7

8 Example Let L be the language ({0, 1} 2 {0, 1} 2) {0, 2} {1, 2}. A regular grammar generating this language is ({S, T, U, V, W }, {0, 1, 2}, P, S) with the rules S T V W, T 0T 1T 2U, U 0U 1U 2, V 0V 2V ε and W 1W 2W ε. Using the terminology of Example 1.14, L U = {0, 1} 2, L T = {0, 1} 2 L U = {0, 1} 2 {0, 1} 2, L V = {0, 2}, L W = {1, 2} and L = L S = L T L V L W. Exercise Let L be the language ({00, 11, 22} {33} ). Make a regular grammar generating the language. The Pumping Lemmas are methods to show that certain languages are not regular or not context-free. These criteria are only sufficient to show that a language is more complicated than assumed, they are not necessary. The following version is the weakest form of the pumping lemma for regular languages. Theorem Assume that L is an infinite regular language. Then there is a constant c such that for each word w L with w > c, one can represent w as xyz = w with y ε and xy z L. Proof. This can be shown by induction over all regular expressions; note that every regular expression (set) L is either finite or of the form L = H for some set H represented by a shorter regular expression or of the form L = (H 1 H 2 ) for some sets H 1 and H 2 represented by shorted regular expressions or of the form L = H 1 H 2 for some sets H 1 and H 2 represented by some shorter regular expressions. One shows now the following: Assuming that all regular sets represented by expressions shorter than n satisfy the theorem, then also all regular sets represented by expressions of length n satisfy the theorem. For this, the length of a regular expression is just the number of symbols to write it down where one uses the characters from Σ to denote strings, the symbol, the symbol, the symbol (for concatenation), the symbol (for the Kleene star) and brackets (so that the order of the operations is clear and each puts together two expressions). For the ease of notation, one writes (((00 01) 10) 11) for {00, 01, 10, 11} so that there is less notation in the proofs as one has not to deal with finite sets. So let L now be an infinite set given by a regular expression of length n. There are several cases. L = H. Then let c = 1. If w L and w > 0 then w = u 1 u 2... u m for some m and u 1, u 2,..., u m H. It follows that also w 0 = ε, w 2 = u 1 u 2... u m u 1 u 2... u m and any other power of w is in L, so w L. Taking x = ε, y = w and z = ε, one gets that xy z L. 8

9 L = H 1 H 2 where c 1, c 2 are the corresponding constants; here let c k be longer than the longest word in H k in the case that H k is finite and let c = c 1 + c 2. If now w L and w > c then w H k for an infinite set H k and w > c k. It follows that w = xyz with y ε and xy z H k L. L = H 1 H 2 where c 1, c 2 are the corresponding constants; here let c k be longer than the longest word in H k in the case that H k is finite and let c = c 1 + c 2. If now w L and w > c then w = v 1 v 2 where v 1 H 1, v 2 H 2 and one v k is longer than c k, say this is v 1 (the case of k = 2 is symmetric). Now v k = xyz with y ε and xy z H 1. It follows that x y (z v 2 ) L and w = x y (z v 2 ). In all three cases, the set L satisfies the theorem; hence the theorem is also true for all infinite regular languages represented by expressions of length n. In Section 2 below a more powerful version of the pumping lemma will be shown, which implies Theorem 1.19 (a). The next statement is the full version of the pumping lemma. Theorem 1.19: Pumping Lemma. (a) Let L Σ be an infinite regular language. Then there is a constant k such that for every u L of length at least k there is a representation x y z = u such that xy k, y ε and xy z L. (b) Let L Σ be an infinite context-free language. Then there is a constant k such that for every u L of length at least k there is a representation vwxyz = u such that wxy k, w ε y ε and vw l xy l z L for all l N. Example The set L = {0 p : p is a prime number} of all 0-string of prime length is not context-free. To see this, assume the contrary and assume that k is the constant from the pumping condition in Theorem 1.19 (b). Let p be a prime number larger than k. Then 0 p can be written in the form vwxyz with q = wy > 0. Then every string of the form vw l xy l z is in L; these strings are of the form 0 p+q (l 1). Now choose l = p + 1 and consider 0 p+q p. The number p + q p = p (q + 1) is not a prime number; however 0 p+q p is in L by the pumping condition in Theorem 1.19 (b). This contradiction proves that L cannot be context-free. Example The language L of all words which have as many 0 as 1 satisfies the pumping condition in Theorem 1.18 but not the pumping condition in Theorem 1.19 (a). For seeing the first, note that whenever w has as many 0 as 1 then every element of w has the same property. Indeed, L = L and Theorem 1.18 is satisfied by every 9

10 language which is of the form H for some H. For seeing the second, assume the contrary and assume that n is the constant used in Theorem 1.19 (a). Now consider the word 0 n 1 n. By assumption there is a representation xyz = 0 n 1 n with xy n and y ε. As a consequence, xyyz = 0 n+m 1 n for some m > 0 and xyyz / L. Hence the statement in Theorem 1.19 (a) is not satisfied. Exercise Show that the language {0 n 1 n 2 n : n N} is not context-free using Theorem 1.19 (b). Exercise Let L {0}. Show that the following conditions are equivalent for L: 1. L is regular; 2. L is context-free; 3. L satisfies the Theorem 1.19 (a) for regular languages; 4. L satsifies the Theorem 1.19 (b) for context-free languages. Show that, however, the bound on the length of the pumped word is necessary. Show that L = {0 p : p is not a power of two} does only satisfy Theorem 1.18 without that bound. Here ε L, that is, 0 is not a power of two. Exercise Let f(n) = a n n + b n + c with a, b, c N and consider L = {0 n 1 f(n) : n N}. 1. Case a = 0 b = 0: Show that L is regular in this case. 2. Case a = 0 b > 0: Show that L is context-free by giving the corresponding grammar; show that L is not regular using the Pumping Lemma (Theorem 1.19 (a)). 3. Case a > 0 Consider the specific case a = 1, b = 2, c = 4 (the others would be similar): Show that L is context-sensitive but not context-free; for contextsensitivity, it is sufficient if the rules l r just satisfy l r ; for not being context-free, use the context-free Pumping-Lemma (Theorem 1.19 (b)). This gives a clear dependence how the level of the Chomsky hierarchy of L depends on f. 10

11 2 Finite Automata An automaton is in general a mechanism which checks whether a word is in a given language. An automaton has a number of states which memorise some information. Here an example. Example 2.1: Divisibility by 3. Let a 0 a 1... a n be a decimal number. One can check whether a 0 a 1... a n is a multiple of 3 by the following algorithm using a memory s {0, 1, 2} and processing in step m the digit a m. The memory s is updated accordingly. Case s=0 : If a m {0, 3, 6, 9} then update s = 0; if a m {1, 4, 7} then update s = 1; if a m {2, 5, 8} then update s = 2. Case s=1 : If a m {0, 3, 6, 9} then update s = 1; if a m {1, 4, 7} then update s = 2; if a m {2, 5, 8} then update s = 0. Case s=2 : If a m {0, 3, 6, 9} then update s = 2; if a m {1, 4, 7} then update s = 0; if a m {2, 5, 8} then update s = 1. The number a 0 a 1... a n is divisible by 3 iff s = 0 after processing a n. For example, is divisable by 3 as the value of s from the start up to processing the corresponding digits is 0, 1, 0, 0, 1, 0, 0, respectively. The number 256 is not divisable by 3 and the value of s is 0, 2, 1, 1 after processing the corresponding digits. Exercise 2.2. Which of the following numbers are divisible by 3: 1, 20, 304, 2913, 49121, , , ? Description 2.3: Deterministic Finite Automaton. The idea of this algorithm is to update a memory which takes only finitely many values in each step according to the digit read. At the end, it only depends on the memory whether the number which has been processed is a multiple of 3 or not. This is a quite general algorithmic method and it has been formalised in the notion of a finite automaton; for this, the possible values of the memory are called states. The starting state is the initial value of the memory. Furthermore, after processing the word it depends on the memory whether the word is in L or not; those values of the memory which say a 0 a 1... a n L are called accepting states and the others are called rejecting states. One can display the automata as a graph. The nodes of the graph are the states 11

12 (possible values of the memory). The accepting states are marked with a double border, the rejecting states with a normal border. The indicator start or an incoming arrow mark the initial state. Arrows are labelled with those symbols on which a transition from one state to anothers takes place. Here the graphical representation of the automaton checking whether a number is divisable by 3. 0,3,6,9 1,4,7 0,3,6,9 start 0 1 2,5,8 1,4,7 2,5,8 2,5,8 1,4,7 0,3,6,9 2 Mathematically, one can also describe a finite automaton (Q, Σ, δ, s, F ) as follows: Q is the set of states, Σ is the alphabet used, δ is the transition function mapping pairs from Q Σ to Σ, s is the starting state and F is the set of accepting states. The transition-function δ : Q Σ Q defines a unique extension with domain Q Σ as follows: δ(q, ε) = q for all q Q and, inductively, δ(q, wa) = δ(δ(q, w), a) for all q Q, w Σ and a Σ. For any string w Σ, if δ(s, w) F then the automaton accepts w else the automaton rejects w. Example 2.4. One can also describe an automaton by a table mainly maps down δ and furthermore says which states are accepting or rejecting. The first state listed is usually the starting state. Here a table for an automaton which checks whether a number is a multiple of 7: 12

13 q type δ(q, a) for a = acc rej rej rej rej rej rej This automaton checks whether a number is a multiple of 7. On input 343 the automaton goes on symbol 3 from state 0 to state 3, then on symbol 4 from state 3 to state 2 and then on symbol 3 from state 6 to state 0. The state 0 is accepting and hence 343 is a multiple of 7 (in fact 343 = 7 7 7). On input 999 the state goes first from state 0 to state 2, then from state 2 to state 1, then from state 1 to state 5. The state 5 is rejecting and therefore 999 is not a multiple of 7 (in fact 999 = ). Example 2.5. One can also describe a finite automaton as an update function which maps finite states plus symbols to finite states by some algorithm written in a more compact form. In general the algorithm has variables taking its values from finitely many possibilities and it can read symbols until the input is exhausted. It does not have arrays or variables which go beyond its finite range. It has explicit commands to accept or reject the input. When it does accept or reject the program terminates. function div257 begin var a in {0,1,2,...,256}; var b in {0,1,2,3,4,5,6,7,8,9}; if exhausted(input) then reject; read(b,input); a = b; if b == 0 then begin if exhausted(input) then accept else reject end; while not exhausted(input) do begin read(b,input); a = (a*10+b) mod 257 end; if a == 0 then accept else reject end. This automaton checks whether a number on the input is a multiple of 257; furthermore, it does not accept any input having leading 0s. Here some sample runs of the algorithm. On input ε the algorithm rejects after the first test whether the input is exhausted. On input 00 the algorithm would read b one time and then do the line after the test whether b is 0; as the input is not yet exhausted, the algorithm rejects. On input 0 13

14 the algorithm goes the same way until but finally accepts the input as the input is exhausted after the symbol b has been read for the first time. On input 51657, the algorithm initialises a as 5 after having read b for the first time. Then it reaches the while-loop and, while reading b = 1, b = 6, b = 5, b = 7 it updates a to 51, 2, 25, 0, respectively. It accepts as the final value of a is 0. Note that the input is and therefore the algorithm is correct in this case. Such algorithms permit to write automata with a large number of states in a more compact way then making a state diagram or a state table with hundreds of states. Note that the number of states of the program is actually larger than 257, as not only the value of a but also the position in the program contributes to the state of the automaton represented by the program. The check exhausted(input) is there to check whether there are more symbols on the input to be processed or not; so the first check whether the input is exhausted is there to rejct in the case that the input is the empty string. It is assumed that the input is always a string from {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}. Exercise 2.6. Such an algorithm might be written in a form nearer to a finite automaton if one gives the set of states explicitly, names the starting state and the accepting states and then only places an algorithm or mathematical description in order to describe δ (in place of a table). Implement the above function div257 using the state space Q = {s, z, r, q 0, q 1,..., q 256 } where s is the starting state and z, q 0 are the accepting states; all other states are rejecting. Write down how the transition-function δ is defined as a function from Q {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Q. Give a compact definition and not a graph or table. Exercise 2.7. Let ({s, t}, {0, 1, 2}, δ, s, {t}) be a finite automaton with δ(s, a) = t and δ(t, a) = s for all a {0, 1, 2}. Determine the language of strings recognised by this automaton. 0,1,2 start s t 0,1,2 Theorem 2.8: Characterising Regular Sets. The following statements are equivalent for any language L: (a) L is recognised by a deterministic finite automaton; 14

15 (b) L is generated by a regular expression; (c) L is generated by a regular grammar. Proof of (a) (c). Let an automaton (Q, Σ, δ, s, F ) be given. Now one builds the left-linear grammar (Q, Σ, P, s) with the following rules: the rule q ar is in P iff δ(q, a) = r; the rule q ε is in P iff q F. So the non-terminals of the grammar are the states of the automaton and also the roles of every q Q is in both constructs similar: For all q, r Q, it holds that q wr iff δ(q, w) = r. To see this, one proves it by induction. First consisder w = ε. Now q wr iff q = r iff δ(q, w) = r. Then consider w = va for some symbol a and assume that the statement is already proven for the shorter word v. Now q wr iff there is a non-terminal t with q vt var iff there is a non-terminal t with δ(q, v) = t and t ar iff there is a non-terminal t with δ(q, v) = t and δ(t, a) = r iff δ(q, w) = r. The only way to produce a word w in the new grammar is to generate the word wq for some q F and then to apply the rule q ε. Thus, the automaton accepts w iff δ(s, w) F iff there is a q F with s q q ε iff s w. Hence w is accepted by the automaton iff w is generated by the corresponding grammar. The equivalence of (b) and (c) is Theorem 1.13 and the proof that (b) implies (a) will follow later. There is a stronger version of the pumping lemma which directly comes out of the characterisation of regular languages by automata. Theorem 2.9: Strong Pumping Lemma. If L is a regular set then there is a constant k such that for all strings u 0, u 1,..., u k with u 0 u 1... u k L there are i, j with 0 < i < j k and (u 0 u 1... u i 1 ) (u i u i+1... u j 1 ) (u j u j+1... u k ) L. So if one splits a word in L into k + 1 parts then one can select some parts in the middle of the word which can be pumped. Proof. Given a regular set L, let (Q, Σ, δ, s, F ) be the finite automaton recognising this language. Let k = Q + 3 and consider any strings u 0, u 1,..., u k with u 0 u 1... u k L. There are i and j with 0 < i < j k such that δ(s, u 0 u 1... u i 1 ) = δ(s, u 0 u 1... u j 1 ); this is due to the fact that there are Q + 1 many values for i, j 15

16 and so two of the states have to be equal. Let q = δ(s, u 0 u 1... u i 1 ). By assumption, q = δ(u i u i+1... u j 1 ) and so it follows that q = δ(s, u 0 u 1... u i 1 (u i u i+1... u j 1 ) h ) for every h. Furthermore, δ(q, u j u j+1... u k ) F and hence u 0 u 1... u i 1 (u i u i+1... u j 1 ) h u j u j+1... u k L for all h. Example Let L be the language of all strings over {0, 1, 2} which contains an even number of 0s. Then the pumping-condition of Theorem 2.9 is satisfied with parameter n = 3: Given u 0 u 1 u 2 u 3 L, there are three cases: u 1 contains an even number of 0s. Then removing u 1 from the word or inserting it arbitrarily often does not make the number of 0s in the word odd; hence u 0 (u 1 ) u 2 u 3 L. u 2 contains an even number of 0s. Then u 0 u 1 (u 2 ) u 3 L. u 1 and u 2 contain both an odd number of 0s. Then u 1 u 2 contains an even number of 0s and u 0 (u 1 u 2 ) u 3 L. Hence the pumping condition is satisfied for L. Let H be the language of all words which contain a different number of 0s and 1s. Let k be any constant. Now let u 0 = 0, u 1 = 0,..., u k 1 = 0, u k = 1 k+k!. If the pumping condition would be satisfied for H then there are i, j with 0 < i < j k and 0 i (0 j i ) 0 k j 1 k+k! H. So fix this i, j and take h = k! + 1 (which is a natural number). Now one sees that j i 0 i 0 (j i)h 0 k j 1 k+k! = 0 k+k! 1 k+k! / H, hence the pumping condition is not satisfied. Exercise Which of the following languages over Σ = {0, 1, 2, 3} satisfies the pumping-condition from Theorem 2.9: (a) {00, 111, 22222} {11, 222, 00000} {22, 000, 11111}, (b) {0 i 1 j 2 k : i + j + k = 5555}, (c) {0 i 1 j 2 k : i + j = k }, (d) {w : w contains more 1 than 0}? Theorem 2.12: Myhill and Nerode s Minimal DFA [23]. Given a language L, let L x = {y Σ : xy L}. The language L is regular iff the number of different derivations L x is finite; furthermore, one can construct a dfa having as many states as there are different derivations and this is the minimal complete dfa which recognises L. Proof. Let (Q, Σ, δ, s, F ) be a deterministic finite automaton recognising L. If δ(s, x) = δ(s, y) then for all z Σ it holds that z L x iff δ(δ(s, x), z) F iff 16

17 δ(δ(s, y), z) F iff z L y. Hence the number of different sets of the form L x is a lower bound for the size of the states of the dfa. Furthermore, one can directly build the dfa by letting Q = {L x : x Σ } and define δ(l x, y) = L xy this definition is indeed representation-independent. The starting-state is the set L ε and F = {L x : x Σ ε L x }. One can get an automaton which has one less state if one decides not to represent ; in the case that there is indeed an L x with L x = the resulting dfa would be incomplete, that is, there would be nodes q and symbols a with δ(q, a) being undefined; if the automaton ends up in this situation, it would just reject the input without further analysis. An incomplete dfa is a variant of a dfa which is still very near to a complete dfa but has already gone a tiny step in direction of an nfa. Remark Although the above theorem is published by Anil Nerode [23], it is general known as the Theorem of Myhill and Nerode and both scientists, John Myhill and Anil Nerode, are today acknowledged for this discovery. Example If L = then L 0 = 0 1 2, L 01 = 1 2, L 012 = 2 and L 0121 =. One can show that every further L x is equivalent to one of these four. The corresponding automaton is the following start L 0 L ,1 L 012 L ,1,2 As L 0121 =, one could also omit this node and would get an incomplete dfa with all states being accepting. Then a word is accepted as long as one can go on in the automaton on its symbols. Example Consider the language {0 n 1 n : n N}. Then L 0 n = {0 m 1 m+n : m N} is unique for each n N. Hence, if this language would be recognised by a dfa, then the dfa would need infinitely many states, what is impossible. 17

18 Example Assume that Σ has n elements. Consider the set L of all strings which contain at least one symbol at least twice. There are at least 2 n + 1 sets of the form L x : If x L then L x = Σ else ε / L x. Furthermore, for x / L, Σ L x = {a Σ : a occurs in x}. As there are 2 n subsets of Σ, one directly gets that there are 2 n sets of this type. On the other hand, one can also see that 2 n + 1 is an upper bound. If the dfa has not seen any symbol twice so far then it just has to remember which symbols it has seen else the automaton needs just one additional state to go when it has seen some symbol twice. Representing the first states by the corresponding subsets of Σ and the second state by the special symbol #, the dfa would has the following parameters: Q = P ow(σ) {#}, Σ is the alphabet, is the starting state and # is the unique final state. Furthermore, δ is is given by three cases: if A Σ and a Σ A then δ(a, a) = A {a}, if A Σ and a A then δ(a, a) = #, δ(#, a) = #. Description 2.17: Non-Deterministic Finite Automaton. One can generalise this concept to a non-deterministic finite automaton where δ is multi-valued, that is, for each q Q and a Σ the value δ(q, a) is a set of states. Then one can define for any Q Q that δ(q, a) = {δ(q, a) : q Q } is the union over all δ(q, a) with q Q. Furthermore, δ(q, ε) = Q and δ(q, wa) is the union of all δ(q, a) with q δ(q, w). Then the non-deterministic automaton accepts w iff there is an accepting state in δ({s}, w). Such an automaton is called a non-deterministic finite automaton. Alternatively, one can define the acceptance-condition using the notion of a run: One says a string q 0 q 1... q n Q n+1 is a run of the automaton on input a 1... a n iff q 0 = s and q m+1 δ(q m, a m+1 ) for all m {1,..., n}; note that the run has one symbol more than the string processed. The non-deterministic automaton accepts a word w iff there is a run on the input w whose last state is accepting. Büchi [4, 5] as well as Rabin and Scott [25] observed that such a non-deterministic automaton (Q, Σ, δ, s, F ) can also be viewed as a deterministic automaton working using as states the power-set {Q : Q Q} of Q and having the corresponding updatefunction. Furthermore, the accepting states of this new deterministic automaton are all Q Q which intersect F. This result is summarised in the following theorem. Theorem 2.18: Büchi s Power-Set Construction [4, 5, 25]. If L can be recognised by a non-deterministic finite automaton using n states then L can be recognised by a deterministic finite automaton using 2 n states. Example Consider the nfa ({s, q}, {0, 1}, δ, s, {q}) with δ(s, 0) = {s, q}, δ(s, 1) = {s} and δ(q, a) = for all a {0, 1}. Then the corresponding dfa has the four states, {s}, {q}, {s, q} where {q}, {s, q} 18

19 are the final states and {s} is the initial state. The transition function of the dfa is given as (, a) = for a {0, 1}, ({s}, 0) = {s, q}, ({s}, 1) = {s}, ({q}, a) = for a {0, 1}, ({s, q}, 0) = {s, q}, ({s, q}, 1) = {s}. This automaton can be further optimised: The states and {q} are never reached, hence they can be omitted from the dfa. Remark One might ask how near this upper bound 2 n is to the optimum. If one can take arbitrary large alphabets then it is quite near. For the dfa with 2 n + 1 states from Example 2.16, one can make an nfa with n + 2 states (here for n = 4 and Σ = {0, 1, 2, 3}). 0,1,2,3 0,1,2,3 start # {0} {1} {2} {3} 1,2,3 0,2,3 0,1,3 0,1,2 In general, Q contains and {a} for all a Σ and #; δ(, a) = {, {a}}; δ({a}, b) is {a} in the case a b and is # in the case a = b; δ(#, a) = #; is the starting state; # is the only accepting state. So the nfa has n + 2 and the dfa has 2 n + 1 states (which cannot be made better). So the actual size of the dfa is more than a quarter of the theoretical upper bound 2 n+2. The next exercise deals with the case where Σ = {0, 1} and therefore, for larger n, the above convenient method does not work. Exercise Consider the language {0, 1} (0 {0, 1} n 0 1 {0, 1} n 1): (a) Show that a dfa recognising it needs at least 2 n+2 states; (b) Make an nfa recognising it with at most 2 n + 4 states. 19

20 Exercise Find a characterisation when a regular language L is recognised by an nfa only having accepting states. Examples of such languages are {0, 1}, and {1, 01, 001} 0. The language {00, 11} is not a language of this type. Example One can generalise the nfa to a machine (Q, Σ, δ, I, F ) where a set I of starting states replaces the single starting state s. Now such a machine accepts a string w = a 1 a 2... a i Σ i iff there is a sequence q 0 q 1... q i of states such that q 0 I q i F j < i [q i+1 δ(q i, a i )]; if such a sequence does not exist then the machine rejects the input w. The following machine with three states recognises the set , the nodes are labelled with the regular expressions denoting the language of the words through which one can reach the corresponding node. 1 start start The corresponding nfa would need 5 states, as one needs a common start state which the nfa leaves as soon as it reads a symbol. 2 1 start ε Exercise Let Σ = {0, 1,..., n 1} and L = {w Σ : some a Σ does not occur in w}. Show that there is a machine like in Example 2.23 with Q = n which recognises L and that every complete dfa recognising L needs 2 n states. 20

21 3 Combining Languages One can form new languages from old ones by combining them with basic set-theoretical operations. In most cases, the complexity in terms of the level of the Chomsky hierarchy does not change. Theorem 3.1: Basic Closure Properties. Assume that L, H are languages which are on the level CHk of the Chomsky hierarchy. Then the following languages are also on the level CHk: L H, L H and L. Description 3.2: Transforming Regular Expressions into Automata. First it is shown how to form dfas which recognise the intersection, union or difference of given sets. So let (Q 1, Σ, δ 1, s 1, F 1 ) and (Q 2, Σ, δ 2, s 2, F 2 ) be dfas which recognise L 1 and L 2, respectively. Let (Q 1 Q 2, Σ, δ 1 δ 2, (s 1, s 2 ), F ) with (δ 1 δ 2 )((q 1, q 2 ), a) = (δ 1 (q 1, a), δ 2 (q 2, a)) be a product automaton of the two given automata; here one can choose F such that it recognises the union or intersection or difference of the respective languages: Union: F = F 1 Q 2 Q 1 F 2 ; Intersection: F = F 1 F 2 = F 1 Q 2 Q 1 F 2 ; Difference: F = F 1 (Q 2 F 2 ); Symmetric Difference: F = F 1 (Q 2 F 2 ) (Q 1 F 1 ) F 2. For example, let the first automaton recognise the language of words in {0, 1, 2} with an even number of 1s and the second automaton with an even number of 2s. Both automata have the accepting and starting state s and a rejection state t; they change between s and t whenever they see 1 or 2, respectively. The product automaton is now given as follows: 0 0 start (s, s) (s, t) (t, s) (t, t)

22 The automaton given here recognises the union. For the other operations like Kleene star and concatenation, one needs to form an nfa recognising the corresponding language first and can then use Büchi s construction to transform the nfa into a dfa. So assume (Q, Σ, δ, s, F ) is an nfa recognising L. Now L is recognised by (Q {s }, Σ,, s, {s }) where = δ {(s, a, p) : (s, a, p) δ} {(p, a, s) : (p, a, q) δ for some q F } {(s, a, s ) : a L}. The last part of the union is to add all one-symbol words from L. This automaton has a new starting state s which is accepting, as ε L. The other states in Q are kept so that the automaton can go through the states in Q in order to simulate the original automaton on some word w until it is going to process the last symbol when it then resurns to s ; so it can process sequences of words in Q each time going through s. After the last word w n of w 1 w 2... w n L, the automaton can either return to s in order to accept the word. Here an example start s start s 1 1 s t 1 t 1 The next operation with nfas is the Concatenation. Here assume that (Q 1, Σ, δ 1, s 1, F 1 ) and (Q 2, Σ, δ 2, s 2, F 2 ) are nfas recognising L 1 and L 2 with Q 1 Q 2 = and assume ε / L 2. Now (Q 1 Q 2, Σ, δ, s 1, F 2 ) recognises L 1 L 2 where (p, a, q) δ whenever (p, a, q) δ 1 δ 2 or p F 1 (s 2, a, q) δ 2. Note that if L 2 contains ε then one can consider the union of L 1 and L 1 (L 2 {ε}). An example is the following: L 1 L 2 with L 1 = {00, 11} and L 2 =

23 q 1 s start s 1 1 q r 1 r 2 0 Last but not least, one has to see how to build an automaton recognising a finite set, as the above only deal with the question how to get a new automaton recognising unions, differences, intersections, concatenations and Kleene star of given regular languages represented by their automata. For finite sets, one can simply consider all possible derivations (which are easy to compute from a list of strings in the language) and then connect the corresponding states accordingly. This would indeed give the smallest dfa recognising the corresponding set. Alternatively, one can make an automaton recognising the set {w} and then form product automata for the unions in order to recognise sets of several strings. Here a dfa recognising {a 1 a 2... a n } for such a string of n symbols would have the states q 0, q 1,..., q n plus r and go from q m to q m+1 on input a m+1 and in all other cases would go to state r. Only the state q n is accepting. Exercise 3.3. The above gives upper bounds on the size of the dfa for a union, intersection, difference and symmetric difference as n 2 states, provided that the original two dfas have at most n states. Give the corresponding bounds for nfas: If L and H are recognised by nfas having at most n states each, how many states does one need at most for an nfa recognising (a) the union L H, (b) the intersection L H, (c) the difference L H and (d) the symmetric difference (L H) (H L)? Give the bounds in terms of linear, quadratic and exponential. Explain your bounds. Exercise 3.4. Consider two context-free grammars with terminals Σ, disjoint nonterminals N 1 and N 2, start symbols S 1 N 1 and S 2 N 2 and rule sets P 1 and P 2 which generate L and H, respectively. Explain how to form from these a new contextfree grammar for (a) L H, (b) L H and (c) L. Write down the context-free grammars for {0 n 1 2n : n N} and {0 n 1 3n : n N} 23

24 and form the grammars for the the union, concatenation and star explicitly. Example 3.5. The language L = {0 n 1 n 2 n : n N} is the intersection of the contextfree languages {0} {1 n 2 n : n N} and {0 n 1 n : n N} {2}. One can see from the Pumping Lemma for context-free languages that L is not context-free: By Theorem 1.19 (b) there would be a length n such that every word u of length at least n in the language is represented of the form vwxyz with vw m xy m z L for all m, where wy ε and wxy n. Now taking u = 0 n 1 n 2 n, every splitting into vwxyz of this form satisfies that either 0 or 2 does not occur in wy, hence vwwxyyz has more than n symbols for some but not all of the digits 0, 1, 2. Thus L is not context-free by Theorem 1.19 (b). Hence L is the intersection of two context-free languages which is not contextfree. However, the complement of L is context-free. The following grammar generates {0 k 1 m 2 n : k < n}: the non-terminals are S, T with S being the start symbol, the terminals are 0, 1, 2 and the rules are S 0S2 S2 T 2, T 1T ε. Now the complement of L is the union of eight context-free languages. Six languages of this type: {0 k 1 m 2 n : k < m}, {0 k 1 m 2 n : k > m}, {0 k 1 m 2 n : k < n}, {0 k 1 m 2 n : k > n}, {0 k 1 m 2 n : m < n} and {0 k 1 m 2 n : m > n}; furthermore, the two regular languages {0, 1, 2} {10, 20, 21} {0, 1, 2} and {ε}. Hence the complement of L is context-free. Although the intersection of two context-free languages might not be context-free, one can still show a weaker version of this result. This weaker version can be useful for various proofs. Theorem 3.6. Assume that L is a context-free language and H is a regular language. Then the intersection L H is also a context-free language. Proof. Assume that (N, Σ, P, S) is the context-free grammar generating L and (Q, Σ, δ, s, F ) is the finite automaton accepting H. Furthermore, assume that every production in P is either of the form A BC or of the form A w for A, B, C N and w Σ. Now make a new grammar (Q N Q {S}, Σ, R, S) generating L H with the following rules: S (s, S, q) for all q F ; (p, A, q) (p, B, r)(r, C, q) for all p, q, r Q and all rules of the form A BC in P ; (p, A, q) w for all p, q Q and all rules A w in P with δ(p, w) = q. 24

25 For each A N, let L A = {w Σ : S w}. For each p, q Q, let H p,q = {w Σ : δ(p, w) = q}. Now one shows that (p, A, q) generates w in the new grammar iff w L A H p,q. First one shows by induction over every derivation-length that a symbol (p, A, q) can only generate a word w iff δ(p, w) = q and w L A. If the derivation-length is 1 then there is a production (p, A, q) w in the grammar. It follows from the definition that δ(p, w) = q and A w is a rule in P, thus w L A. If the derivationlength is larger than 1, then one uses the induction hypothesis that the statement is already shown for all shorter derivations and now looks at the first rule applied in the derivation. It is of the form (p, A, q) (q, B, r)(r, C, q) for some B, C N and r Q. Furthermore, there is a splitting of w into uv such that (q, B, r) generates u and (r, C, q) generates v. By induction hypothesis and the construction of the grammar, u L B, v L C, δ(p, u) = r, δ(r, v) = q and A BC is a rule in P. It follows that A BC uv in the grammar for L and w L A. Furthermore, δ(p, uv) = δ(r, v) = q, hence w H p,q. This completes the proof of this part. Second one shows that the converse holds, now by induction over the length of derivations in the grammar for L. Assume that w L A and w H p,q. If the derivation has length 1 then A w is a rule the grammar for L. As δ(p, w) = q, it follows that (p, A, q) w is a rule in the new grammar. If the derivation has length n > 1 and the proof has already been done for all derivations shorter than n, then the first rule applied to show that w L A must be a rule of the form A BC. There are u L B and v L C with w = uv. Let r = δ(p, u). It follows from the definition of δ that q = δ(r, v). Hence, by induction hypothesis, (p, B, r) generates u and (r, C, q) generates v. Furthermore, the rule (p, A, q) (p, B, r)(r, C, q) is in the new grammar, hence (p, A, q) generates w = uv. Now one has for each p, q Q, A N and w Σ that (p, A, q) generates w iff w L A H p,q. Furthermore, in the new grammar, S generates a string w iff there is a q F with (s, S, q) generating w iff w L S and δ(s, w) F iff w L S and there is a q F with w H s,q iff w L H. This completes the proof. The concatenation of two context-sensitive languages is context- Theorem 3.7. sensitive. Proof. Let L 1 and L 2 be context-sensitive languages not containing ε and consider context-sensitive grammars (N 1, Σ, P 1, S 1 ) and (N 2, Σ, P 2, S 2 ) generating L 1 and L 2, respectively, where where N 1 N 2 = and where each rule l r satisfies l r and l N e + for the respective e {1, 2}. Let S / N 1 N 2 Σ. Now the automaton (N 1 N 2 {S}, Σ, P 1 P 2 {S S 1 S 2 }, S) generates L 1 L 2 : If v L 1 and w L 2 then S S 1 S 2 vs 2 vw. Furthermore, the first rule has to be S S 1 S 2 and from then onwards, each rule has on the left 25

Automata and Languages Computational Models: An idealized mathematical model of a computer. A computational model may be accurate in some ways but not in others. We shall be defining increasingly powerful

Introduction to Automata Theory Reading: Chapter 1 1 What is Automata Theory? Study of abstract computing devices, or machines Automaton = an abstract computing device Note: A device need not even be a

Finite Automata Reading: Chapter 2 1 Finite Automaton (FA) Informally, a state diagram that comprehensively captures all possible states and transitions that a machine can take while responding to a stream

Chapter 2 Finite Automata 2.1 The Basic Model Finite automata model very simple computational devices or processes. These devices have a constant amount of memory and process their input in an online manner.

Automata and Formal Languages Winter 2009-2010 Yacov Hel-Or 1 What this course is all about This course is about mathematical models of computation We ll study different machine models (finite automata,

Regular Languages and Finite Automata 1 Introduction Hing Leung Department of Computer Science New Mexico State University Sep 16, 2010 In 1943, McCulloch and Pitts [4] published a pioneering work on a

Regular Languages and Finite State Machines Plan for the Day: Mathematical preliminaries - some review One application formal definition of finite automata Examples 1 Sets A set is an unordered collection

Griffith University 3515ICT Theory of Computation Turing Machines (Based loosely on slides by Harald Søndergaard of The University of Melbourne) 9-0 Overview Turing machines: a general model of computation

CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,

CMSC 330: Organization of Programming Languages Regular Expressions and Finite Automata Introduction That s it for the basics of Ruby If you need other material for your project, come to office hours or

Finite Automata Reading: Chapter 2 1 Finite Automata Informally, a state machine that comprehensively captures all possible states and transitions that a machine can take while responding to a stream (or

Homework Three Solution CSE 355 Due: 06 March 2012 Please note that there is more than one way to answer most of these questions. The following only represents a sample solution. Problem 1: Linz 4.1.13

MAT2400 Analysis I A brief introduction to proofs, sets, and functions In Analysis I there is a lot of manipulations with sets and functions. It is probably also the first course where you have to take

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy Kim S. Larsen Odense University Abstract For many years, regular expressions with back referencing have been used in a variety

CHAPTER 3 Finite Automata and Regular Languages 3. Introduction 3.. States and Automata A finite-state machine or finite automaton (the noun comes from the Greek; the singular is automaton, the Greek-derived

Sets and Cardinality Notes for 620-111 C. F. Miller Semester 1, 2000 Abstract These lecture notes were compiled in the Department of Mathematics and Statistics in the University of Melbourne for the use

7 CHAPTER Regular Expressions Most programmers and other power-users of computer systems have used tools that match text patterns. You may have used a Web search engine with a pattern like travel cancun

Chapter, Part 2 Nondeterministic Finite Automata CSC527, Chapter, Part 2 c 202 Mitsunori Ogihara Fundamental set operations Let A and B be two languages. In addition to union and intersection, we consider

Mathematics for Computer Science/Software Engineering Notes for the course MSM1F3 Dr. R. A. Wilson October 1996 Chapter 1 Logic Lecture no. 1. We introduce the concept of a proposition, which is a statement

Chapter 9 Finite and Infinite Sets 9. Finite Sets Preview Activity (Equivalent Sets, Part ). Let A and B be sets and let f be a function from A to B..f W A! B/. Carefully complete each of the following

arxiv:1205.5492v1 [math.co] 24 May 2012 Partitioning edge-coloured complete graphs into monochromatic cycles and paths Alexey Pokrovskiy Departement of Mathematics, London School of Economics and Political

Chapter 4 Set Theory A set is a Many that allows itself to be thought of as a One. (Georg Cantor) In the previous chapters, we have often encountered sets, for example, prime numbers form a set, domains

3. EQUIVALENCE RELATIONS 33 3. Equivalence Relations 3.1. Definition of an Equivalence Relations. Definition 3.1.1. A relation R on a set A is an equivalence relation if and only if R is reflexive, symmetric,

CHAPTER 4 Applications of Methods of Proof 1. Set Operations 1.1. Set Operations. The set-theoretic operations, intersection, union, and complementation, defined in Chapter 1.1 Introduction to Sets are

ω-automata ω-automata Automata that accept (or reject) words of infinite length. Languages of infinite words appear: in verification, as encodings of non-terminating executions of a program. in arithmetic,

HOMEWORK THREE SOLUTION CSE 355 DUE: 10 MARCH 2011 Please note that there is more than one way to answer most of these questions. The following only represents a sample solution. (1) 2.4 and 2.5 (b),(c),(e),(f):

Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

Caveat lector: This is the first edition of this lecture note. Please send bug reports and suggestions to jeffe@illinois.edu. But the Lord came down to see the city and the tower the people were building.

Lecture 2 InfA: Deterministic Finite State Machines 2. Introduction In this lecture we will focus a little more on deterministic Finite State Machines. Also, we will be mostly concerned with Finite State

Lecture 1 (Review of High School Math: Functions and Models) Introduction: Numbers and their properties Addition: (1) (Associative law) If a, b, and c are any numbers, then ( ) ( ) (2) (Existence of an

CARDINALITY, COUNTABLE AND UNCOUNTABLE SETS PART ONE With the notion of bijection at hand, it is easy to formalize the idea that two finite sets have the same number of elements: we just need to verify

POWER SETS AND RELATIONS L. MARIZZA A. BAILEY 1. The Power Set Now that we have defined sets as best we can, we can consider a sets of sets. If we were to assume nothing, except the existence of the empty

Automata Theory Automata theory is the study of abstract computing devices. A. M. Turing studied an abstract machine that had all the capabilities of today s computers. Turing s goal was to describe the

I GROUPS: BASIC DEFINITIONS AND EXAMPLES Definition 1: An operation on a set G is a function : G G G Definition 2: A group is a set G which is equipped with an operation and a special element e G, called

Notes on Complexity Theory Last updated: August, 2011 Jonathan Katz Lecture 1 1 Turing Machines I assume that most students have encountered Turing machines before. (Students who have not may want to look

MATH 337 Cardinality Dr. Neal, WKU We now shall prove that the rational numbers are a countable set while R is uncountable. This result shows that there are two different magnitudes of infinity. But we

Overview of E0222: Automata and Computability Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. August 3, 2011 What this course is about What we study

k-automatic SETS OF RATIONAL NUMBERS ERIC ROWLAND AND JEFFREY SHALLIT Abstract. The notion of a k-automatic set of integers is well-studied. We develop a new notion the k-automatic set of rational numbers

+a 1. R In this and the next section we are going to study the properties of sequences of real numbers. Definition 1.1. (Sequence) A sequence is a function with domain N. Example 1.2. A sequence of real

Chapter 3 Sequences In this chapter, we discuss sequences. We say what it means for a sequence to converge, and define the limit of a convergent sequence. We begin with some preliminary results about the

Chapter Three Functions 3.1 INTRODUCTION In this section, we study what is undoubtedly the most fundamental type of relation used in mathematics. Definition 3.1: Given sets X and Y, a function from X to

Mathematics Review for MS Finance Students Anthony M. Marino Department of Finance and Business Economics Marshall School of Business Lecture 1: Introductory Material Sets The Real Number System Functions,

Definition 1: GROUPS An operation on a set G is a function : G G G. Definition 2: A group is a set G which is equipped with an operation and a special element e G, called the identity, such that (i) the

4CHAPTER 1. INTRODUCTORY MATERIAL: SETS, FUNCTIONS AND MATHEMATICAL INDU 1.3 Induction and Other Proof Techniques The purpose of this section is to study the proof technique known as mathematical induction.