# Lecture 17: Language Recognition

Save this PDF as:

Size: px
Start display at page:

Download "Lecture 17: Language Recognition"

## Transcription

1 Lecture 17: Language Recognition Finite State Automata Deterministic and Non-Deterministic Finite Automata Regular Expressions Push-Down Automata Turing Machines

2 Modeling Computation When attempting to deal with theoretical issues concerning digital computers, we need a simplified definition of what a computer does. Such a description is called a computational model. The first computational model we will consider is called a finite automaton or finite state machine. A finite automaton is depicted below as a state control with a read head that scans an input string. At the end of the string the state control will indicate whether or not the scanned string is accepted or rejected as a member of the set of strings recognized by the finite automaton.

3 Formal Definition of Computation The sequence of state transitions shown above is formally defined as computation in the following manner: Let M = (Q,Σ,δ,q 0,F) be a finite automaton and w = w 1 w 2...w n be a string over the alphabet Σ. Then M accepts the string w if a sequence of states r 0,r 1,...,r n exists in Q with the following three conditions: 1. r 0 =q 0, 2. δ(r,w i+1 ) = r i+1 for i = 0,..., n-1, and 3. r n is an element F. These three conditions state that (1) the inital state must be the start state, (2) the sequence of state transitions must be valid transitions for the finite state machine M and (3) the final state of M after processing w must be an accept state.

4 Finite Automaton Formally, a finite Automaton (FA) is defined as a 5-tuple (Q,S, d, q0, F) where, (1) Q is a finite set called the states. (2) S is a finite set called the alphabet. (3) d:q x S -> Q is the transition function (4) q0 is an element of Q called the start state, and (5) F is a subset of Q called the set of accept states. The set of states Q is just a set of labels, q0..q3. The alphabet S is the set of symbols that can be understood by the FA. In this case the alphabet consists of the two symbols 0 and 1. This means that the FA will be able to read (scan the symbols in) strings comprised only of 0's and 1's.

5 State Transition Function The transition function is represented by the arrows in the state transition diagram. This is a discrete function that maps every possible combination of a state with a symbol from the alphabet to another state, as shown in the table below: Note that there is a transition out of each state for each symbol, so we have 4x2=8 transitions. The start state, q0 is the initial state of the FA. The set F is the set of accept states. In our example F = {q1, q3}. This means that the binary string being scanned is recognized or accepted by the FA if the final state (after scanning the binary string) is one of the accept states.

6 Let's try a few example strings. (Scan from left to right)

7 Regular Language The set of all strings A accepted by a finite state machine M is called the language of M. We say that M accepts or recognizes A. Sybollically we write, A={ω M accepts ω} We say that A is a regular language if it is recognized by a finite automaton.

8 Regular Operations The operations of union, concatenation and Kleene-closure (also called star) are called regular operations on regular languages. Union: A U B = {x x is an element of A or x is an element of B} Concatenation: AoB = {xy x is an element of A and y is an element of B} Kleene-closure: A* = {x 1 x 2...x k k>= 0 and each x i is an element of A}

9 Nondeterminism When there is exactly one transition from each state for each alphabet symbol a finite automaton is said to be deterministic. When there can be zero transitions or more than one transition from some states for certain alphabet symbols, then the finite automaton is said to be nondeterministic. Nondeterministic Finite Automata (NFA) are essential to the development of theoretical computer science because they greatly simplify several important proofs. Every deterministic finite automata (DFA) is automatically an NFA since NFAs are a more general form of DFAs. A nondeterministic finite automation is a 5-tuple (Q,Σ,δ,q 0,F), where, (1) Q is a finite set of states (2) Σ is a finite alphabet (3) δ: QxΣε -> P(Q) is the transition function (4) q 0 is an element of Q (the start state) (5) F is a subset of Q (the set of accept states).

10 An Example This definition is similar to the DFA except that the nondeterminism permits the transition from a state to more than one state for the same symbol in the alphabet. In general a nondeterministic transition can be from a state to any subset of the states in Q. This is why QxΣε maps to the power set of Q P(Q) rather than to just Q as for the DFA. Σε refers to the alphabet (set of symbols) with epsilon ε. An epsilon move is a transition from one state to another without reading a symbol from the candidate string. a b b a

11 An Example This definition is similar to the DFA except that the nondeterminism permits the transition from a state to more than one state for the same symbol in the alphabet. In general a nondeterministic transition can be from a state to any subset of the states in Q. This is why QxΣε maps to the power set of Q P(Q) rather than to just Q as for the DFA. Σε refers to the alphabet (set of symbols) with epsilon ε. An epsilon move is a transition from one state to another without reading a symbol from the candidate string. a b b a

12 An Example This definition is similar to the DFA except that the nondeterminism permits the transition from a state to more than one state for the same symbol in the alphabet. In general a nondeterministic transition can be from a state to any subset of the states in Q. This is why QxΣε maps to the power set of Q P(Q) rather than to just Q as for the DFA. Σε refers to the alphabet (set of symbols) with epsilon ε. An epsilon move is a transition from one state to another without reading a symbol from the candidate string. a b b a

13 An Example This definition is similar to the DFA except that the nondeterminism permits the transition from a state to more than one state for the same symbol in the alphabet. In general a nondeterministic transition can be from a state to any subset of the states in Q. This is why QxΣε maps to the power set of Q P(Q) rather than to just Q as for the DFA. Σε refers to the alphabet (set of symbols) with epsilon ε. An epsilon move is a transition from one state to another without reading a symbol from the candidate string. a b b a

14 An Example This definition is similar to the DFA except that the nondeterminism permits the transition from a state to more than one state for the same symbol in the alphabet. In general a nondeterministic transition can be from a state to any subset of the states in Q. This is why QxΣε maps to the power set of Q P(Q) rather than to just Q as for the DFA. Σε refers to the alphabet (set of symbols) with epsilon ε. An epsilon move is a transition from one state to another without reading a symbol from the candidate string. a b b a

15 An Example This definition is similar to the DFA except that the nondeterminism permits the transition from a state to more than one state for the same symbol in the alphabet. In general a nondeterministic transition can be from a state to any subset of the states in Q. This is why QxΣε maps to the power set of Q P(Q) rather than to just Q as for the DFA. Σε refers to the alphabet (set of symbols) with epsilon ε. An epsilon move is a transition from one state to another without reading a symbol from the candidate string. a b b a

16 An Example This definition is similar to the DFA except that the nondeterminism permits the transition from a state to more than one state for the same symbol in the alphabet. In general a nondeterministic transition can be from a state to any subset of the states in Q. This is why QxΣε maps to the power set of Q P(Q) rather than to just Q as for the DFA. Σε refers to the alphabet (set of symbols) with epsilon ε. An epsilon move is a transition from one state to another without reading a symbol from the candidate string. a b b a

17 Equivalence of NFA's and DFA's In terms of computational power, the DFA and the NFA are equivalent. This means that for every NFA there is a DFA that recognizes the same language. Since every DFA is an NFA the reverse is trivially true. Rather than reviewing the proof we will use the proof idea The methods in this to generate an equivalent DFA for an NFA as shown in the following example: Given the NFA of the previous examle, we will construct a DFA that recognizes the same language. 1. We will build a DFA with a set of states Q D whose members correspond to the members of P(Q). Since the NFA has states Q={q 0,q 1,q 2 } the DFA will have states corresponding to { φ, {q 0 }, {q 1 }, {q 2 }, {q 0,q 1 }, {q 0,q 2 }, {q 1,q 2 }, {q 0,q 1,q 2 }} and represented by Q D ={q φ, q 0, q 1, q 2, q 01,q 02, q 12, q 012 }.

18 2. The start state for the DFA is the state representing the subset of states in the NFA that includes the start state and all the states reachable from the start state on an epsilon move. In this case the start state is q 01. The accept states in the DFA are all the states derived from one or more of the accept states of the NFA. Recall that, in a DFA there is a transition from each state for each symbol in the alphabet Σ. Since states in an NFA may have no transitions for some symbols, we need a trap state in our DFA to dump the deadend transitions (i.e. those that do not exist in the NFA). This trap state is not an accept state and it has a transition to itself on every symbol.

19 3. Now we will define the DFA transitions for each of the NFA transitions. Transitions from q 0 - Starting with state q 0 we observe that there is no transistion in the NFA from q 0 reading the symbol a, therefore we will include a transition from state q 0 in the DFA to state q φ. There is a transistion from q 0 to q 2 in the NFA so we simply replicate this transition for the DFA. For convenience we show the NFA on the right below.

20 Transitions from q 1 - The NFA transitions from q 1 reading a and b are transferred to the DFA. Since there is no transition from q0 since

21 Transitions from q 0 and q 1 - The state q 01 in the DFA corresponds to the pair of states q 0 and q 1 in the NFA. Look at the NFA and determine all the states that can be reached from both of these states when reading the symbol a. In this case we note that the transtion from q1 to q0 for the symbol a also leads back to q1 on an epsilon move. Since states q 0 and q 1 can both be reached upon reading the symbol a, we note that this corresponds to the single state q 01 in the DFA.

22 Transitions from q 2 - State q 2 in the NFA has two transitions for the symbol a, one to state q 1 and one back to state q 2, so we generate a transition from state q 2 to state q 12 in the DFA. Threre is a single transition from q 2 to q 1 in the NFA so it is copied to the DFA.

23 Transitions from q 1 and q 2 - We observe that from states q 1 and q 2 every state in the NFA can be reached on transitions for the symbol a. We represent this set of transitions in the DFA with an a-transition from q 12 to q 012. There is only one transition for the symbol b from states q 1 and q 2 in the NFA, which we copy to the DFA.

24 Transitions from q 0 and q 2 - Transitions from q 0 and q 2 for both a and b go to states q 1 and q 2 in the NFA, therefore we generate transitions from state q 02 to state q 12 in the DFA for symbols a and b.

25 Transitions from states q 0, q 1 and q 2 - Generating the DFA transitions for state q 012 requires that we determine all the states that can be reached from any state in the NFA for each of the symbols a and b. Every state in the NFA is can be reached on an a-transition from some state, therefore we generate a transition from q012 to itself for the symbol a. There is a transition from some state to every state but q 0 for the symbol b, so we generate a b- transition from state q 012 to state q 12 in the DFA.

26 4. Next we remove any unreachable states. In this example, state q 0 and q 02 have no transitions into them, therefore they are unrechable and can be removed without affecting the language being recognized by this DFA.

27 Finally we can rearrange the positions of the nodes to simplify the graphical representation. NFA DFA

28 Regular Expressions Up to now we have defined regular languages using finite automata and we have shown that DFAs and NFAs are equivalent. Sometimes using a state transition diagram to describe a regular language is inconvenient. Regular expressions are algebraic forms for defining regular languages, that use regular operations on the symbols of the regular language to indicate the member strings of the lanugage. For example, the regular expression, (0+1)0* describes the regular language over the alphabet {0,1} consisting of all binay strings starting with a 0 or a 1 and followed by zero or more 0's. The regular operations include a choice or union operator (+ or ), concatenation (implied by sequence of symbols or shown as a fixed number of repetitions n e.g. xy n z), and star or Kleene closure (*) which means zero or more repetitions of a substring..

29 Regular Expressions are Equivalent to NFA's We wish to show that the regular expressions are equivalent to NFAs and DFAs in the ability to describe regular languages (i.e. they all have the same computational power to describe the class of languages called regular). The first step in this goal is to show that the class of regular languages are closed under the regular operations of union, concatenation and star. The formal proofs are covered in the textbook. Here will look at graphical representations of the proof ideas. We represent generic NFAs as collections of three types of states,. and we will use epsion moves to combine generic NFAs to construct new NFAs demonstrating closure for each of the regular operations.

30 Regular Languages Closed under Union Theorem: The class of regular languages is closed under the union operation. In the diagram above we see that the two NFAs, N1 and N2 can be combined into a new NFA, N that recognizes the union of the languages on N1 and N2. N is constructed by adding a new start state and connecting it to the start states of N1 and N2 with epsilon moves. The remaining structures of N1 and N2 are left unchanged. It should be clear that any string that is accepted by N1 or N2 will be accepted by N and that any string that is accepted by N would be accepted by N1 or N2 or both.

31 Regular Languages Closed under Concatenation Theorem: The class of regular languages is closed under the concatenation operation. In this construction we wish to show that N accepts any string that is the contatenation of a member string from N2 to the end of a member string from N1. N is created by connecting all the accept states in N1 to the start state of N2 with epsilon moves. We then convert all the accept states of N1 to non-accept states (there will be no accept states in the portion of N that was N1.) Note that this works whether or not the start states of N1 and N2 are accept states. For example, if N1 accepts the empty string but N2 does not, then N should not accept the empty string. On the other hand if both N1 and N2 accept the empty string then there will be an epsion move from the start state of N1 to the start state of N2 (which will still be an accept state).

32 Regular Languages Closed under Star Operation Kleene Closure Theorem: The class of regular languages is closed under the star operation. Converting an NFA, N1 into N1* can be accomplished by connecting all the accept states to the original start state through epsilon moves. Since N1* must accept the empty string we will add a new start state which is also an accept state and connect it to the original start state of N1 through an epsion move. You may wonder why we don't just make the original start state into an accept state. The reason this does not work is that the NFA, N1 could have a path of transitions back to the start state for some string of symbols that is not a member string. Converting the start state of N1 into an accept state would result in these strings being accepted.

33 Generating Regular Expressions Create a regular expression for the set of binary strings that contain at least two consecutive 0's. any sequence of 0's and 1's including nothing followed by two consecutive 0's followed by any sequence of 0's and 1's including nothing (0 + 1)* 00 (0 + 1)*

34 another Example Create a regular expression to generation all binary strings that do not contain two consecutive 0's (1 + 01)* (0 + λ)

35 Regular Expressions are not Unique L = { all strings with at least two consecutive 0 } r1 = (1 + 01)*(0 + λ) r = (1*011*)*(0 + λ ) + 1*(0 + 2 λ ) L r ) = L( r ) = ( 1 2 L r and 1 r 2 are equivalent regular expr.

36 Converting a Regular Expression to an NFA 0 ( )* 0 start 0 ε 0 ε ε 0 0 ε ε 1 1 ε

37 Pushdown Automata We will learn that some context-free grammars are not regular. The reason for this is that context-free grammars can be recursive. We can modify finite automata to be able to account for this recursive structure and to recognize context-free languages. The missing feature in finite automata is an accessible and arbitrarily large memory capacity. We include a stack memory component to an NFA to obtain the pushdown automata.

38 Formal Definition of Pushdown Automata A pushdown automata (PDA) reads symbols from the input string and pushes symbols to, and pops symbols from, a stack memory. The symbol set for the input string is not necessarily the same as the symbol set for the stack memory. Formally we define a pushdown automata as a 6-tuple (Q,Σ,Γ,δ,q 0,F) where 1. Q is the set of states, 2. Σ is the input symbol set, 3. Γ is the stack symbol set, 4. δ:q x Σε x Γε-> P(Q x Γε) is the transition function, 5. q 0 is an element of Q (the start state), 6. F is a subset of Q (the set of accept states). The symbol ε as a subscript on the input symbol set and the stack symbol set in the definition of the transition function means that the PDA can move (transition) without reading an input symbol or a stack symbol.

39 Pushdown Automata is more Computationally Powerful than Regular Expressions Example: Recall that the language {0 n 1 n n>= 0 } is not regular so there is no NFA that can recognize it. As an example of the increased computational power of pushdown automata we will describe a PDA that recognizes this non-regular language. Q = { q1, q2, q3, q4}, Σ = { 0,1} Γ = {0,\$}, q start = q1, F = {q1,q4}, δ is defined in the table below:

40 Graphical Representation of the PDA Also, we can display the PDA graphically as, The left side of each transition label represents the current input symbol, the right side shows the stack symbol being popped off the top off the stack followed by the stack symbol to be pushed onto the stack. Input symbols are read in a left-to-right direction. The ε symbol indicates either an epsilon move (i.e. transition without reading input symbol or a stack symbol) or that the PDA should not write to the stack for the current transition.

41 Operation of the PDA Let's examine the operation of this PDA a little more closely. First of all, since the start state is an accept state, an empty input string is accepted. Since there is an epsilon move out of state q1, we also transition to state q2. On this transition a \$ symbol is pushed onto the stack when the PDA transitions to state q2. Each 0 symbol read from the input string when the PDA is in state q2 causes a 0 to be pushed onto the stack. When a 1 is read from the input string in state q2 one of the zero's (if stack not empty) is popped off the stack and the PDA transitions to state q3 without pushing anything back onto the stack. For each 1 read from the input while in state q3, a 0 is popped off the stack. As soon as the special symbol \$ reaches the top of the stack the PDA executes an epsilon move to state q4. If the end of the string has been reached at this time it will be accepted (PDA in an accept state). If another input symbol is read when the PDA is in states q3 and q4 there is no valid transition and all control paths are terminated.

42 An Example For example, consider the operation of this PDA while scanning the string At the begining the non-deterministic nature of the PDA is realized as we transition from q1 to q2 on an epsilon move. Before we read the first symbol of the input string we have pushed a '\$' onto the stack.

43 The first symbol in the input string is a '0' so the only valid transition is from q2 to q2. For this transition we do not pop a value from the stack but we push a '0' symbol onto the stack. This transition is repeated for the next two '0' symbols in the input string as shown below:

44 The next input symbol being read is a '1'. For this symbol the only valid transition is from q2 to q3. For this transition we pop a symbol '0' off the stack but we do not push a symbol onto the stack. Note that there is no epsilon move from q3 to q4 at this point since we are not seeing a '\$' symbol at the top of the stack. For the next two input symbols (both of them '1's) we stay in state q3 and pop a '0' off the stack.

45 Since the '\$' symbol is now at the top of the stack, there is a valid epsilon move from q3 to q4. This transition pops the '\$' off the stack leaving it empty and placing the PDA in both states q3 and q4. If this were the end of the string we would accept it as a member of the language {0 n 1 n n>= 0 }, however there is another '1' symbol in the input string. Reading the final '1' symbol in the input string we find that there is no valid transition from either q3 or q4 on a '1' input symbol AND an empty stack. In this case we are left in no state, so we do not accept.

46 Theorem: Context-Free <=> Pushdown Automaton Theorem: A language is context free if and only if some pushdown automaton recognizes it. This theorem is typical of the if and only if theorems in that it requires a proof in two directions. Lemma: If a language is context free, then some pushdown automaton recognizes it. We will assume that A is a CFL. By definition A must have a corresponding CFG, G, that generates it. We need a procedure (an algorithm) for converting any CFG, G into an equivalent PDA, P. We can define such an algorithm: 1. Place the marker symbol \$ and the start variable on the stack of the PDA P. 2. Repeat the following steps forever: a. If the top of stack is a variable symbol A, nondeterministically select one of the rules for A and substitute A by the string on the right-hand side of the rule. b. If the top of stack is a terminal symbol a, read the next symbol from the input and compare it to a. If they match then repeat. If they do not match, reject on this branch of the nondeterminism. c. If the top of stack is the symbol \$, enter the accept state. Doing so accepts the input if it has all been read.

47 Lemma: If a pushdown automaton recognizes some language, then it is context free. Given a PDA, P we need to design a CFG, G that will generate all the strings accepted by P where P=(Q,Σ,Γ,δ,q0,{q accept }). The variables of G are {A pq p,q are in Q}. the start variable is Aqo,q accept. The rules of Γ are: 1. For each p,q,r,s in Q, t in Γ, and a,b in Σε, if δ(p,a,ε) contains (r,t) and δ(s,b,t) contains (q,ε) put the rule A pq -> aa rs b in G. 2. For each p,q,r in Q put the rule A pq -> A pr A rq in G. 3. Finally, for each p in Q put the rule A pp ->ε in G. We can prove that this construction works by demonstratring that A pq generates x if and only if (iff) x can bring P from p with empty stack to q with empty stack. Once again this proof is broken down into two separate cases corresponding to the two if..then conditions implied by the iff. Both of these proofs are by induction and can be found in a number of textbooks. We will assume that the proof is valid and, instead, spend our time using it to generate CFG's from PDA's and vice versa.

48 Designing Context-Free Grammars The design and construction of CFG's is a bit more involved than the creation of finite automata. We can use the following techniques to make this process simpler. Technique 1: Many CFG's can be constructed through the union of simpler CFG's. If your goal CFG can be broken down into a number of simpler CFG's you can combine them by creating a new rule S -> S1 S2... Sk, where the Si are the start variables for each of the simpler CFG's and S is the start variable for the goal CFG. Example: Create the grammar for the language L= { 0 n 1 n or 1 n 0 n n>=0}. S 1 -> 0S 1 1 ε is the grammar for { 0 n 1 n n>=0}. S 2 -> 1S 2 0 ε is the grammar for { 1 n 0 n n>=0}. so S -> S 1 S 2 S1 -> 0S 1 1 ε S 2 -> 1S 2 0 ε is the grammar for L.

49 Technique 2: When constructing a CFG for a language that is regular, you can first create a DFA for the language. You can convert any DFA into an equivalent CFG in the following way: 1. Make a variable R i for each state qi of the DFA. 2. Add the rule R i -> ar j to the CFG for each transition δ(q i,a) = q j in the DFA. 3. Add the rule R i -> ε if qi is an accept state of the DFA. 4. Make R 0 the start variable of the grammar, where q 0 is the start state of the DFA. Example: Create a grammar to recognize the language over {0,1} of all strings containing the substring First we create the DFA as shown below: Now, using these rules, we build the CFG: R 0 -> 0R 0 1R 1 R 1 -> 0R 0 1R 2 R 2 -> 0R 3 1R 2 R 3 -> 0R 0 1R 4 R 4 -> 0R 4 1R 4 ε

50 Technique 3: Some context-free languages are defined by the matching or comparing arbitrarily long substrings. In such cases the substrings are said to be linked. Consider the example of palindromes, P={ w w R aw is in P and a is in Σε), where w R is the reverse substring of w. The substrings w and w R are linked. In such situations we can construct a CFG using a rule of the form R -> urv, which simultaneously generates the linked substrings on either side of the variable R. Example: Create a CFG over {0,1} for the language {0 n 1 n n>=0} R 0 -> 0R1 ε.

51 Technique 4: In more practical CFG's such as grammars for computer languages or arithmetic expressions, the stirngs can contain recursively occurring structures. When generating such grammars you may place symbols that resolve to these recursive structures into the rules at the locations at which the recursive structures can appear. Example: Create a CFG that generates arithmetic expressions with the terminals a,b and c and the operations of addition (+) and multiplication (x). <EXPR> -> <EXPR> + <TERM> <TERM> <TERM> -> <TERM> x <FACTOR> <FACTOR> <FACTOR> -> ( <EXPR> ) a b c The parse trees above show how the grammar generates valid arithmetic expressions. The tree on the right includes a recursive component in which a <FACTOR> can generate another expression inside parentheses.

52 Theorem: The Pumping Lemma for Context-Free Languages. If A is a context-free language, then there is a number p (the pumping length) where, if s is any string in A of length at least p, then s may be divided into five pieces s = uvxyz satisfying the conditions: 1. For each i >= 0, uv i xy i z is an element of A, 2. vy > 0, and 3. vxy <= p.

53 Example: Use the pumping lemma for context-free languages to show that the language B={a n b n c n n >= 0} is not context free. Just as with the pumping lemma for regular expressions we will use proof by contradiction to show that our example language is not context-free. First assume that B is a context-free language, then let p be the pumping length for B. This p must exist by the pumping lemma. Now we select a string s = a p b p c p. Possible examples of s include abc aabbcc aaabbbccc aaaabbbbcccc We note that s is a member of B and that s >=p, as required by the pumping lemma. Now if we assume that s is context-free then we will be able to divide it into five sections s = uvxyz where either v or y is nonempty (condition 2). We can now consider one of two possibilities for the substrings v and y. Case 1: The substrings v and y each contain all of the same symbols. Whether v and y both contain the same symbols or different symbols at most there will be two of the three symbols in v and y. Therefore, pumping v and y will result in an unequal number of the symbols a, b and/or c. Case 2: One of the two substrings v and y (or both) contain more than one type of symbol. In this case pumping v and/or y creates symbols in the wrong order. One of these two cases must occur and since each results in a contradiction, so B is not context free.

54 Some Philosophical Questions Are natural languages context-free? Are context-free grammars useful for describing/understanding the grammar of a natural language? Not too long ago, the answer to the first question was clearly no, however, more recent studies have brought these earlier conclusions into question. In 1957, Noam Chomsky demonstrated that context-free grammars were inadequate to represent the grammar of natural languages (called transformational grammars). He showed that a context free grammar could represent only the 'base component' of natural language and that any natural language would need the addition of transformations. However, in 1982, Gazdar showed that a context free grammar could, in fact, encompass all the transformations suggested by Chomsky. Since that time it remains an open question if all natural languages can be represented by context free grammars or if CFG's are the best way to represent them even if it is possible. Pullum provides a good overview of the history of this development in formal linguistics.

55 References 1. Lecture 28. Push-Down Storage Automata and Context-Free Grammars - Ling 409 Lecture Notes, Partee, Lecture 28, Dec 8, Pullum, Geoffrey K The Great Eskimo Snow Vocabulary Hoax and Other Irreverent Essays on the Study of Language. Chicago: The University of Chicago Press. book review.

### FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

### PUSHDOWN AUTOMATA (PDA)

PUSHDOWN AUTOMATA (PDA) FINITE STATE CONTROL INPUT STACK (Last in, first out) input pop push ε,ε \$ 0,ε 0 1,0 ε ε,\$ ε 1,0 ε PDA that recognizes L = { 0 n 1 n n 0 } Definition: A (non-deterministic) PDA

More information

### Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harry Lewis October 8, 2013 Reading: Sipser, pp. 119-128. Pushdown Automata (review) Pushdown Automata = Finite automaton

More information

### Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.

Pushdown Automata We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata. Next we consider a more powerful computation model, called a

More information

### CPS 220 Theory of Computation

CPS 22 Theory of Computation Review - Regular Languages RL - a simple class of languages that can be represented in two ways: 1 Machine description: Finite Automata are machines with a finite number of

More information

### 2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a

. Solution E T F a E E + T T + T F + T a + T a + F a + a E E + T E + T + T T + T + T F + T + T a + T + T a + F + T a + a + T a + a + F a + a + a E T F ( E) ( T ) ( F) (( E)) (( T )) (( F)) (( a)) . Solution

More information

### Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

Before We Start The Pumping Lemma Any questions? The Lemma & Decision/ Languages Future Exam Question What is a language? What is a class of languages? Context Free Languages Context Free Languages(CFL)

More information

### FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY NON-DETERMINISM and REGULAR OPERATIONS THURSDAY JAN 6 UNION THEOREM The union of two regular languages is also a regular language Regular Languages Are

More information

### Finite Automata and Regular languages

Finite Automata and Regular languages Huan Long Shanghai Jiao Tong University Acknowledgements Part of the slides comes from a similar course in Fudan University given by Prof. Yijia Chen. http://basics.sjtu.edu.cn/

More information

### Automata and Computability. Solutions to Exercises

Automata and Computability Solutions to Exercises Spring 27 Alexis Maciel Department of Computer Science Clarkson University Copyright c 27 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

More information

### UNIT-VI PUSHDOWN AUTOMATA

Syllabus R09 Regulation UNIT-VI PUSHDOWN AUTOMATA The context free languages have a type of automaton that defined them. This automaton, called a pushdown automaton, is an extension of the nondeterministic

More information

### Lecture 3: Nondeterministic Finite Automata

Lecture 3: Nondeterministic Finite Automata September 5, 206 CS 00 Theory of Computation As a recap of last lecture, recall that a deterministic finite automaton (DFA) consists of (Q, Σ, δ, q 0, F ) where

More information

### Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.

CMSC 330: Organization of Programming Languages Last Lecture Languages Sets of strings Operations on languages Finite Automata Regular expressions Constants Operators Precedence CMSC 330 2 Clarifications

More information

### (pp ) PDAs and CFGs (Sec. 2.2)

(pp. 117-124) PDAs and CFGs (Sec. 2.2) A language is context free iff all strings in L can be generated by some context free grammar Theorem 2.20: L is Context Free iff a PDA accepts it I.e. if L is context

More information

### Context-Free and Noncontext-Free Languages

Examples: Context-Free and Noncontext-Free Languages a*b* is regular. A n B n = {a n b n : n 0} is context-free but not regular. A n B n C n = {a n b n c n : n 0} is not context-free The Regular and the

More information

### Uses of finite automata

Chapter 2 :Finite Automata 2.1 Finite Automata Automata are computational devices to solve language recognition problems. Language recognition problem is to determine whether a word belongs to a language.

More information

### Theory of Languages and Automata

Theory of Languages and Automata Chapter 1- Regular Languages & Finite State Automaton Sharif University of Technology Finite State Automaton We begin with the simplest model of Computation, called finite

More information

### Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is

Abstraction of Problems Data: abstracted as a word in a given alphabet. Σ: alphabet, a finite, non-empty set of symbols. Σ : all the words of finite length built up using Σ: Conditions: abstracted as a

More information

### Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12.

More information

### Accept or reject. Stack

Pushdown Automata CS351 Just as a DFA was equivalent to a regular expression, we have a similar analogy for the context-free grammar. A pushdown automata (PDA) is equivalent in power to contextfree grammars.

More information

### Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures Tuesday 10:45 pm - 12:15 pm Instructions Tuesday 12:30

More information

### PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

University of Virginia - cs3102: Theory of Computation Spring 2010 PS2 - Comments Average: 77.4 (full credit for each question is 100 points) Distribution (of 54 submissions): 90, 12; 80 89, 11; 70-79,

More information

### CS243, Logic and Computation Nondeterministic finite automata

CS243, Prof. Alvarez NONDETERMINISTIC FINITE AUTOMATA (NFA) Prof. Sergio A. Alvarez http://www.cs.bc.edu/ alvarez/ Maloney Hall, room 569 alvarez@cs.bc.edu Computer Science Department voice: (67) 552-4333

More information

### Nondeterministic Finite Automata

Nondeterministic Finite Automata Mahesh Viswanathan Introducing Nondeterminism Consider the machine shown in Figure. Like a DFA it has finitely many states and transitions labeled by symbols from an input

More information

### CPS 220 Theory of Computation REGULAR LANGUAGES

CPS 22 Theory of Computation REGULAR LANGUAGES Introduction Model (def) a miniature representation of a thing; sometimes a facsimile Iraq village mockup for the Marines Scientific modelling - the process

More information

### 5 Context-Free Languages

CA320: COMPUTABILITY AND COMPLEXITY 1 5 Context-Free Languages 5.1 Context-Free Grammars Context-Free Grammars Context-free languages are specified with a context-free grammar (CFG). Formally, a CFG G

More information

### Theory of computation: initial remarks (Chapter 11)

Theory of computation: initial remarks (Chapter 11) For many purposes, computation is elegantly modeled with simple mathematical objects: Turing machines, finite automata, pushdown automata, and such.

More information

### Undecidable Problems and Reducibility

University of Georgia Fall 2014 Reducibility We show a problem decidable/undecidable by reducing it to another problem. One type of reduction: mapping reduction. Definition Let A, B be languages over Σ.

More information

### CS 341 Homework 16 Languages that Are and Are Not Context-Free

CS 341 Homework 16 Languages that Are and Are Not Context-Free 1. Show that the following languages are context-free. You can do this by writing a context free grammar or a PDA, or you can use the closure

More information

### Notes for Comp 497 (Comp 454) Week 10 4/5/05

Notes for Comp 497 (Comp 454) Week 10 4/5/05 Today look at the last two chapters in Part II. Cohen presents some results concerning context-free languages (CFL) and regular languages (RL) also some decidability

More information

### Theory of Computation

Theory of Computation Lecture #10 Sarmad Abbasi Virtual University Sarmad Abbasi (Virtual University) Theory of Computation 1 / 43 Lecture 10: Overview Linear Bounded Automata Acceptance Problem for LBAs

More information

### Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA)

Languages Non deterministic finite automata with ε transitions Recall What is a language? What is a class of languages? Finite Automata Consists of A set of states (Q) A start state (q o ) A set of accepting

More information

### CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF)

CS5371 Theory of Computation Lecture 7: Automata Theory V (CFG, CFL, CNF) Announcement Homework 2 will be given soon (before Tue) Due date: Oct 31 (Tue), before class Midterm: Nov 3, (Fri), first hour

More information

### Deterministic (DFA) There is a fixed number of states and we can only be in one state at a time

CS35 - Finite utomata This handout will describe finite automata, a mechanism that can be used to construct regular languages. We ll describe regular languages in an upcoming set of lecture notes. We will

More information

### Further discussion of Turing machines

Further discussion of Turing machines In this lecture we will discuss various aspects of decidable and Turing-recognizable languages that were not mentioned in previous lectures. In particular, we will

More information

### Notes for Comp 497 (454) Week 10

Notes for Comp 497 (454) Week 10 Today we look at the last two chapters in Part II. Cohen presents some results concerning the two categories of language we have seen so far: Regular languages (RL). Context-free

More information

### cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 14 SMALL REVIEW FOR FINAL SOME Y/N QUESTIONS Q1 Given Σ =, there is L over Σ Yes: = {e} and L = {e} Σ Q2 There are uncountably

More information

### Theory of computation: initial remarks (Chapter 11)

Theory of computation: initial remarks (Chapter 11) For many purposes, computation is elegantly modeled with simple mathematical objects: Turing machines, finite automata, pushdown automata, and such.

More information

### ECS 120 Lesson 15 Turing Machines, Pt. 1

ECS 120 Lesson 15 Turing Machines, Pt. 1 Oliver Kreylos Wednesday, May 2nd, 2001 Before we can start investigating the really interesting problems in theoretical computer science, we have to introduce

More information

### Nondeterminism and Epsilon Transitions

Nondeterminism and Epsilon Transitions Mridul Aanjaneya Stanford University June 28, 22 Mridul Aanjaneya Automata Theory / 3 Challenge Problem Question Prove that any square with side length a power of

More information

### Equivalence of DFAs and NFAs

CS 172: Computability and Complexity Equivalence of DFAs and NFAs It s a tie! DFA NFA Sanjit A. Seshia EECS, UC Berkeley Acknowledgments: L.von Ahn, L. Blum, M. Blum What we ll do today Prove that DFAs

More information

### Before we show how languages can be proven not regular, first, how would we show a language is regular?

CS35 Proving Languages not to be Regular Before we show how languages can be proven not regular, first, how would we show a language is regular? Although regular languages and automata are quite powerful

More information

### Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. The stack

A pushdown automata (PDA) is essentially: An NFA with a stack A move of a PDA will depend upon Current state of the machine Current symbol being read in Current symbol popped off the top of the stack With

More information

### Automata: a short introduction

ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible

More information

### Turing Machines Part III

Turing Machines Part III Announcements Problem Set 6 due now. Problem Set 7 out, due Monday, March 4. Play around with Turing machines, their powers, and their limits. Some problems require Wednesday's

More information

### acs-07: Decidability Decidability Andreas Karwath und Malte Helmert Informatik Theorie II (A) WS2009/10

Decidability Andreas Karwath und Malte Helmert 1 Overview An investigation into the solvable/decidable Decidable languages The halting problem (undecidable) 2 Decidable problems? Acceptance problem : decide

More information

### Nondeterministic finite automata

Lecture 3 Nondeterministic finite automata This lecture is focused on the nondeterministic finite automata (NFA) model and its relationship to the DFA model. Nondeterminism is an important concept in the

More information

### Kleene Algebras and Algebraic Path Problems

Kleene Algebras and Algebraic Path Problems Davis Foote May 8, 015 1 Regular Languages 1.1 Deterministic Finite Automata A deterministic finite automaton (DFA) is a model of computation that can simulate

More information

### Incorrect reasoning about RL. Equivalence of NFA, DFA. Epsilon Closure. Proving equivalence. One direction is easy:

Incorrect reasoning about RL Since L 1 = {w w=a n, n N}, L 2 = {w w = b n, n N} are regular, therefore L 1 L 2 = {w w=a n b n, n N} is regular If L 1 is a regular language, then L 2 = {w R w L 1 } is regular,

More information

### FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY YOU NEED TO PICK UP THE SYLLABUS, THE COURSE SCHEDULE, THE PROJECT INFO SHEET, TODAY S CLASS NOTES

More information

### Homework 8. a b b a b a b. two-way, read/write

Homework 8 309 Homework 8 1. Describe a TM that accepts the set {a n n is a power of 2}. Your description should be at the level of the descriptions in Lecture 29 of the TM that accepts {ww w Σ } and the

More information

### Fooling Sets and. Lecture 5

Fooling Sets and Introduction to Nondeterministic Finite Automata Lecture 5 Proving that a language is not regular Given a language, we saw how to prove it is regular (union, intersection, concatenation,

More information

### CMSC 330: Organization of Programming Languages. Pushdown Automata Parsing

CMSC 330: Organization of Programming Languages Pushdown Automata Parsing Chomsky Hierarchy Categorization of various languages and grammars Each is strictly more restrictive than the previous First described

More information

### FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Chomsky Normal Form and TURING MACHINES TUESDAY Feb 4 CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form:

More information

### Context-Free Grammars and Languages. Reading: Chapter 5

Context-Free Grammars and Languages Reading: Chapter 5 1 Context-Free Languages The class of context-free languages generalizes the class of regular languages, i.e., every regular language is a context-free

More information

### CFGs and PDAs are Equivalent. We provide algorithms to convert a CFG to a PDA and vice versa.

CFGs and PDAs are Equivalent We provide algorithms to convert a CFG to a PDA and vice versa. CFGs and PDAs are Equivalent We now prove that a language is generated by some CFG if and only if it is accepted

More information

### Equivalence of CFG s and PDA s

Equivalence of CFG s and PDA s Mridul Aanjaneya Stanford University July 24, 2012 Mridul Aanjaneya Automata Theory 1/ 53 Recap: Pushdown Automata A PDA is an automaton equivalent to the CFG in language-defining

More information

### Computability Theory

CS:4330 Theory of Computation Spring 2018 Computability Theory Decidable Problems of CFLs and beyond Haniel Barbosa Readings for this lecture Chapter 4 of [Sipser 1996], 3rd edition. Section 4.1. Decidable

More information

### Automata-Theoretic LTL Model-Checking

Automata-Theoretic LTL Model-Checking Arie Gurfinkel arie@cmu.edu SEI/CMU Automata-Theoretic LTL Model-Checking p.1 LTL - Linear Time Logic (Pn 77) Determines Patterns on Infinite Traces Atomic Propositions

More information

### Finite Automata Part Two

Finite Automata Part Two DFAs A DFA is a Deterministic Finite Automaton A DFA is defined relative to some alphabet Σ. For each state in the DFA, there must be exactly one transition defined for each symbol

More information

### Finite State Automata

Trento 2005 p. 1/4 Finite State Automata Automata: Theory and Practice Paritosh K. Pandya (TIFR, Mumbai, India) Unversity of Trento 10-24 May 2005 Trento 2005 p. 2/4 Finite Word Langauges Alphabet Σ is

More information

### Introduction to Turing Machines. Reading: Chapters 8 & 9

Introduction to Turing Machines Reading: Chapters 8 & 9 1 Turing Machines (TM) Generalize the class of CFLs: Recursively Enumerable Languages Recursive Languages Context-Free Languages Regular Languages

More information

### How to Pop a Deep PDA Matters

How to Pop a Deep PDA Matters Peter Leupold Department of Mathematics, Faculty of Science Kyoto Sangyo University Kyoto 603-8555, Japan email:leupold@cc.kyoto-su.ac.jp Abstract Deep PDA are push-down automata

More information

### CS21 Decidability and Tractability

CS21 Decidability and Tractability Lecture 3 January 9, 2017 January 9, 2017 CS21 Lecture 3 1 Outline NFA, FA equivalence Regular Expressions FA and Regular Expressions January 9, 2017 CS21 Lecture 3 2

More information

### Properties of Context-free Languages. Reading: Chapter 7

Properties of Context-free Languages Reading: Chapter 7 1 Topics 1) Simplifying CFGs, Normal forms 2) Pumping lemma for CFLs 3) Closure and decision properties of CFLs 2 How to simplify CFGs? 3 Three ways

More information

### CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages

CS 154 Finite Automata vs Regular Expressions, Non-Regular Languages Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and guessing

More information

### Properties of Regular Languages. BBM Automata Theory and Formal Languages 1

Properties of Regular Languages BBM 401 - Automata Theory and Formal Languages 1 Properties of Regular Languages Pumping Lemma: Every regular language satisfies the pumping lemma. A non-regular language

More information

### ÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK. 17 april Classrum Edition

ÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK 7 april 23 Classrum Edition CONTEXT FREE LANGUAGES & PUSH-DOWN AUTOMATA CONTEXT-FREE GRAMMARS, CFG Problems Sudkamp Problem. (3.2.) Which language generates the

More information

### The Turing machine model of computation

The Turing machine model of computation For most of the remainder of the course we will study the Turing machine model of computation, named after Alan Turing (1912 1954) who proposed the model in 1936.

More information

### CSCE 551: Chin-Tser Huang. University of South Carolina

CSCE 551: Theory of Computation Chin-Tser Huang huangct@cse.sc.edu University of South Carolina Church-Turing Thesis The definition of the algorithm came in the 1936 papers of Alonzo Church h and Alan

More information

### Theory of Computation 8 Deterministic Membership Testing

Theory of Computation 8 Deterministic Membership Testing Frank Stephan Department of Computer Science Department of Mathematics National University of Singapore fstephan@comp.nus.edu.sg Theory of Computation

More information

### Finite Automata (contd)

Finite Automata (contd) CS 2800: Discrete Structures, Fall 2014 Sid Chaudhuri Recap: Deterministic Finite Automaton A DFA is a 5-tuple M = (Q, Σ, δ, q 0, F) Q is a fnite set of states Σ is a fnite input

More information

### Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Chomsky Normal Form and TURING MACHINES TUESDAY Feb 4 CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form: A BC A a S ε B and C aren t start variables a is

More information

### Regular Expression Unit 1 chapter 3. Unit 1: Chapter 3

Unit 1: Chapter 3 (Regular Expression (RE) and Language) In previous lectures, we have described the languages in terms of machine like description-finite automata (DFA or NFA). Now we switch our attention

More information

### Summary. Reg Dodds Department of Computer Science University of the Western Cape 2016 Reg Dodds

Theory of Computation Summary Reg Dodds Department of Computer Science University of the Western Cape 2016 Reg Dodds rdodds@uwc.ac.za CSC 311 Paper I: Theory of Computation CSC 311 Paper I: Theory of Computation

More information

### Applied Computer Science II Chapter 1 : Regular Languages

Applied Computer Science II Chapter 1 : Regular Languages Prof. Dr. Luc De Raedt Institut für Informatik Albert-Ludwigs Universität Freiburg Germany Overview Deterministic finite automata Regular languages

More information

### Chapter 3. Regular grammars

Chapter 3 Regular grammars 59 3.1 Introduction Other view of the concept of language: not the formalization of the notion of effective procedure, but set of words satisfying a given set of rules Origin

More information

### Automata and Computability

Automata and Computability Fall 207 Alexis Maciel Department of Computer Science Clarkson University Copyright c 207 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata 5 2. Turing Machines...............................

More information

### Formal Languages, Automata and Models of Computation

CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2011 1 Content - More Properties of Regular Languages (RL)

More information

### CONCATENATION AND KLEENE STAR ON DETERMINISTIC FINITE AUTOMATA

1 CONCATENATION AND KLEENE STAR ON DETERMINISTIC FINITE AUTOMATA GUO-QIANG ZHANG, XIANGNAN ZHOU, ROBERT FRASER, LICONG CUI Department of Electrical Engineering and Computer Science, Case Western Reserve

More information

### CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Today's learning goals Sipser Ch 1.4 Explain the limits of the class of regular languages Justify why the Pumping

More information

### Lecture 2: Regular Expression

Lecture 2: Regular Expression Instructor: Ketan Mulmuley Scriber: Yuan Li January 8, 2015 In the last lecture, we proved that DFA, NFA, and NFA with ϵ-moves are equivalent. Recall that a language L Σ is

More information

### Lecture 23 : Nondeterministic Finite Automata DRAFT Connection between Regular Expressions and Finite Automata

CS/Math 24: Introduction to Discrete Mathematics 4/2/2 Lecture 23 : Nondeterministic Finite Automata Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Last time we designed finite state automata

More information

### Finite Automata Part Two

Finite Automata Part Two Recap from Last Time Old MacDonald Had a Symbol, Σ-eye-ε-ey, Oh! You may have noticed that we have several letter- E-ish symbols in CS103, which can get confusing! Here s a quick

More information

### CS4232 Theory of Computation

CS4232 Theory of Computation Frank Stephan Semester I, Academic Year 2016-2017 Theory of Computing is a lecture which will introduce formal languages on all levels of the Chomsky hierarchy and besides

More information

### Variants of Turing Machine (intro)

CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples, Turing-recognizable and Turing-decidable languages Variants of Turing Machine Multi-tape Turing machines, non-deterministic

More information

### Turing machines and linear bounded automata

and linear bounded automata Informatics 2A: Lecture 29 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 25 November, 2011 1 / 13 1 The Chomsky hierarchy: summary 2 3 4 2 / 13

More information

### C2.1 Regular Grammars

Theory of Computer Science March 22, 27 C2. Regular Languages: Finite Automata Theory of Computer Science C2. Regular Languages: Finite Automata Malte Helmert University of Basel March 22, 27 C2. Regular

More information

### Compiler Design. Spring Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Compiler Design Spring 2011 Lexical Analysis Sample Exercises and Solutions Prof. Pedro C. Diniz USC / Information Sciences Institute 4676 Admiralty Way, Suite 1001 Marina del Rey, California 90292 pedro@isi.edu

More information

### Properties of Regular Languages (2015/10/15)

Chapter 4 Properties of Regular Languages (25//5) Pasbag, Turkey Outline 4. Proving Languages Not to e Regular 4.2 Closure Properties of Regular Languages 4.3 Decision Properties of Regular Languages 4.4

More information

### C2.1 Regular Grammars

Theory of Computer Science March 6, 26 C2. Regular Languages: Finite Automata Theory of Computer Science C2. Regular Languages: Finite Automata Malte Helmert University of Basel March 6, 26 C2. Regular

More information

### Turing machines Finite automaton no storage Pushdown automaton storage is a stack What if we give the automaton a more flexible storage?

Turing machines Finite automaton no storage Pushdown automaton storage is a stack What if we give the automaton a more flexible storage? What is the most powerful of automata? In this lecture we will introduce

More information

### Büchi Automata and their closure properties. - Ajith S and Ankit Kumar

Büchi Automata and their closure properties - Ajith S and Ankit Kumar Motivation Conventional programs accept input, compute, output result, then terminate Reactive program : not expected to terminate

More information

### More About Turing Machines. Programming Tricks Restrictions Extensions Closure Properties

More About Turing Machines Programming Tricks Restrictions Extensions Closure Properties 1 Overview At first, the TM doesn t look very powerful. Can it really do anything a computer can? We ll discuss

More information

### cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 13 CHAPTER 4 TURING MACHINES 1. The definition of Turing machine 2. Computing with Turing machines 3. Extensions of Turing

More information

### SFWR ENG 2FA3. Solution to the Assignment #4

SFWR ENG 2FA3. Solution to the Assignment #4 Total = 131, 100%= 115 The solutions below are often very detailed on purpose. Such level of details is not required from students solutions. Some questions

More information

### Introduction and Motivation. Introduction and Motivation. Introduction to Computability. Introduction and Motivation. Theory. Lecture5: Context Free

ntroduction to Computability Theory Lecture5: Context Free Languages Prof. Amos sraeli 1 ntroduction and Motivation n our study of RL-s we Covered: 1. Motivation and definition of regular languages. 2.

More information

### TAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar

TAFL 1 (ECS-403) Unit- III 3.1 Definition of CFG (Context Free Grammar) and problems 3.2 Derivation 3.3 Ambiguity in Grammar 3.3.1 Inherent Ambiguity 3.3.2 Ambiguous to Unambiguous CFG 3.4 Simplification

More information

### FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THE PUMPING LEMMA FOR REGULAR LANGUAGES and REGULAR EXPRESSIONS TUESDAY Jan 21 WHICH OF THESE ARE REGULAR? B = {0 n 1 n n 0} C = { w w has equal number

More information

### Extended transition function of a DFA

Extended transition function of a DFA The next two pages describe the extended transition function of a DFA in a more detailed way than Handout 3.. p./43 Formal approach to accepted strings We define the

More information