Languages, regular languages, finite automata

Size: px
Start display at page:

Download "Languages, regular languages, finite automata"

Transcription

1 Notes on Computer Theory Last updated: January, 2018 Languages, regular languages, finite automata Content largely taken from Richards [1] and Sipser [2] 1 Languages An alphabet is a finite set of characters, which we will often denote by Σ. For example, Σ = {0, 1} is an alphabet that we will frequently use. A language over some alphabet Σ is a set of strings made up of characters from Σ. For example, L 1 = {0, 1, 00, 11} is a language over the alphabet Σ = {0, 1}. An English dictionary is also a language, over the alphabet {a,..., z, A,..., Z}. However, languages need not be finite size: the set of all binary strings ending in 0 is a language over Σ = {0, 1}. Clearly such a language is not as easy to formally describe, but we will address that issue later on. It is useful to define a few set operators for languages. The union operator,, is defined as with any other collection of sets. The concatenation operator,, is so natural, we will often omit the operator all together: L 1 L 2 = L 1 L 2 = {xy x L 1 y L 2 }. For any language L, we define L 0 = {Λ}, where Λ is a special string, called the empty string. For k > 0, we recursively define L k = LL k 1. That is, we concatenate L with itself k times (and also include the empty string). Finally, we define the closure operator: L = i=0 Li. At a high level, the fundamental question of computer theory is the following. Given a language L and some string x, how hard is it to determine whether x L? (Or, as we will often phrase this question, how hard it is to decide the language L?) We all have some intuition of what this means. For example, given a string of english characters, one can determine whether it is a valid English word by scanning through the English dictionary, one word at a time. But anyone that still uses a paper dictionary knows that they can do better using binary search, and we may even have seen a proof that you require O(log n) comparison for a dictionary of size n. Such algorithmic questions aren t really our focus in this class, though. Rather, we are interested in characterizing whole classes of languages. A language that can be decided in polynomial time on a Turing machine is said to be in a class of languages that we call P. But are there languages that are fundamentally easier to decide than these? Are there languages that can be proven to be strictly harder than those in P? And, furthermore, why is the Turing machine the right model for computation? What if we consider other models? And why is time the right metric: how do memory and communication constraints impact what we can compute? Does access to good random sources help us to decide more languages? Moreover, why is deciding whether some string x L the right place to focus our attention? We will look at almost all of these questions, and more, with the aim of gaining a deeper fundamental understanding of what is possible in our field and what is not. 1

2 2 Finite Automata 2.1 Regular Languages To begin, we start with a very simple model of computation, and a simple class of languages, which are called the regular languages. The regular languages correspond to those generated by regular expressions. We formalize this class of languages recursively, as follows. R will denote the set of all regular languages over some alphabet, Σ. 1. R and {Λ} R. 2. σ Σ : {σ} R. 3. If L R then L R. 4. If L 1 R and L 2 R then L 1 L 2 R. 5. If L 1 R and L 2 R then L 1 L 2 R. These languages are so common and useful, that we frequently use a special notation, called regular expressions in order to specify languages in this class. In this notation, the { and } are dropped, and union is denoted by +. For example, (ab + c) = {Λ, ab, c, abc, cc, cab, abab,...} 2.2 Deterministic Finite Automata A deterministic finite automata is a state machine that takes an input string and either accepts or rejects that string. It makes this decision by transitioning through a sequence of states, making exactly one transition for each character of the input string in a deterministic way. After the transitions are complete, it accepts if it has terminated in a state marked accept, and it rejects if it has stopped in a state marked reject. We will formalize this model of computing in a moment, but it is helpful to first demonstrate it by example. In the first example in Figure 1, there is a special start state, labeled A, and the state labeled C has a circle around it, denoting that it is an accept state. We note that there can be multiple accept states, though that isn t the case in these two examples. Consider input string bc : the DFA reads the first character, and transitions from state A to state B. It then reads the second character and transitions into the accept state, C. Because this is the last character of input, the machine terminates in the accept state, and we say that the machine accepts input bc. Equivalently, we say that bc is in the language of this DFA. Consider now input bcc : the last character causes a transition out of the accept state and into state D, where the machine now terminates. Because D is not marked as an accept state, we say that the DFA rejects this input, or that the input is not in the language of this DFA. Looking more closely at state D, you can see that it is a sink: there are no transitions out of D, so no input that leads to state D will ever be accepted. This is sometimes called a trap state, and usually we will leave such states out of our diagrams in order to simplify them. Removing D and all of its edges, we will sometimes find that while processing an input string, there is no transition that can be made. In this case, we interpret this though we had transitioned to a trap state, and say that the machine rejects the input. The language of the second DFA in Figure 1 is the language of the regular expression (a + bb). (Written as a regular language, this would be L, where L = {a} {bb}.) Note that Λ is in this language, by the definition of the closure operator; to see why Λ is accepted by the DFA, note 2

3 Figure 1: Two examples of DFAs (taken from Richards [1]) that the start state is also an accept state. We will shortly show that all regular languages can be decided by DFAs. Actually, we will show more: that the class of regular languages is equivalent to the class of languages decided by DFAs. 2.3 Formally Defining DFAs Formally, a DFA is defined by an alphabet Σ, a finite set of states, Q, a start state, S Q, a set of accept states, A Q, and a transition function δ : Q Σ Q. Putting this together, M = (Σ, Q, S, A, δ). Returning to the first example in Figure 1 (and ignoring the trap state), this DFA can be formally described by (Σ = {a, b, c}, Q = {A, B, C}, A, A = {C}, δ), where δ is defined as: δ = a b c A C B B C C The formalism will help us to prove things about DFAs and the languages that they decide. Formally, for any alphabet Σ, and any x Σ, we can see that there exists a DFA deciding the language {x}: (Σ, Q = {A, B}, A, B, δ), where δ(a, x) = B, and δ otherwise has output. Informally, the DFA has a start state that is non-accepting, and a single accept state. The only transition allowed goes from the start to the accept state on input x. We can also define a DFA for {Λ}: it has a single state that is both the start state and an accept state, and it does not allow any transitions. So we can see that the languages defining the base-cases of the regular languages are all decidable by DFAs. We now show that if a language L 1 is decided by DFA M 1, and a language L 2 is decided by DFA M 2, then there exists a DFA M that decides L 1 L 2. Intuitively, we construct M so that it tracks the movement of the input through both M 1 and M 2, simultaneously. To do that, we create Q 1 Q 2 states, and label each with a pair of names, one from Q 1 and one from Q 2. If M is in state (A, B), we can think of this as indicating that M 1 would currently, on this input, be in state A, while M 2 would currently be in state B. If M halts in state (A, B), we want to accept if either A is an accept state for M 1, or if B is an accept state for M 2. To simplify the formal exposition, we ll assume M 1 and M 2 share the same alphabet; it is easy to see that this isn t necessary. Let M 1 = (Σ, Q 1, S 1, A 1, δ 1 ) and let M 2 = (Σ, Q 2, S 2, A 2, δ 2 ). 3

4 Figure 2: An example of an NFA (taken from Richards [1]) Then M = (Σ, Q, S, A, δ) is defined as follows. Q = {(A, B) A Q 1 B Q 2 }. S = (S 1, S 2 ), A = {(A, B) A A 1 B A 2 }, and δ((a, B), x) = (δ 1 (A, x), δ 2 (B, x)). To prove that L(M) = L 1 L 2, we must show two things. First, we prove that if w L(M), then w L 1 L 2. We will write w = w 1 w k, letting w i denote the ith character of w. Note that w L(M) implies that there is a sequence of states in M, (S 1, S 2 ), (A 1, B 1 ), (A 2, B 2 ),..., (A k, B k ) such that δ((s 1, S 2 ), w 1 ) = (A 1, B 1 ), δ((a i, B i ), w i+1 ) = (A i+1, B i+1 ), and either A k A 1, or B k A 2. Without loss of generality, let s assume that A k A 1. It follows by the way M was constructed that δ 1 (S 1, w 1 ) = A 1, and, for i {1,..., k 1}, δ 1 (A i, w i+1 ) = A i+1. Since A k A 1, it follows that M 1 accepts w, and that w L 1 L 2. Secondly, we must show that if w L 1 L 2, then M accepts w. We leave this direction as an exercise. We will later come back to the other regular operators, closure and concatenation. 2.4 Non-deterministic Finite Automata (NFAs) We consider a very useful relaxation in how we model finite automata. Although it was not made explicit, we previously did not allow any ambiguity in how our transitions were to be made: for any state A and any input character x, we have, so far, allowed only a single transition from A to be labeled with x. Relaxing that gives us a lot more flexibility in our design. Consider the two examples in Figure 2, again taken from Richards [1]. Both machines decide the same language: {w {a, b} w ends in ab}. The second example, which is non-deterministic, has an ambiguous transition out of the start state: on input a, the machine has a choice to make. It could either transition to state q 1, or it could stay in the start state. We say that this machine accepts an input if there exists some sequence of allowable transitions that ends in an accept state. Importantly, we only require the existence of some such sequence of transitions: we do not require that all allowable transitions result in acceptance, and we do not care how one might find such a sequence. An even better example of where non-determinism helps ease the design of a finite automata is the following language. L = {x {a, b} the kth symbol from the last is a }, where k is some fixed integer. We described an NFA for this language in class, and we will design a DFA for this language in the homework. To formally define NFAs, we have to change the definition of our transition function. Whereas in DFAs, we have δ : Q Σ Q, we now have to allow δ to map the same domain to a set of states, rather than to a single state. Formally, δ : Q Σ 2 Q, where 2 Q denotes the power-set. Looking again at example 2 in Figure 2, we have 4

5 a b q δ = 0 {q 0, q 1 } {q 0 } q 1 {q 2 } q 2 Additionally, it is helpful to allow Λ transitions. These transitions allow the machine to move from one state to another without using up any of the input string. We don t bother to formalize this. 2.5 Equivalence of DFAs and NFAs How much additional power does this non-determinism give us? It seems to make machine design a lot simpler, but does it allow us to decide a larger class of languages? It turns out that it does not: the set of languages decidable by NFAs is exactly the regular languages, just as for DFAs. We prove now that the two models are equivalent in this sense. It is clear from the definitions that every DFA is also an NFA, so we only need to show that for every NFA, M = (Σ, Q, q 0, A, δ), there exists a DFA, M = (Σ, Q, S, A, δ ), such that L(M ) = L(M). The intuition is similar to the one above for showing a DFA that decides the union of two languages. We will create a new state for every possible subset of Q. We can think of a state (q 1, q 5, q 7 ) as capturing the fact that M could have followed paths leading to state q 1, q 5, or q 7. In this way, our DFA will keep track of all the possible places we could currently be in the NFA, given the input string seen so far. With that intuition, the state (q 1, q 5, q 7 ) is an accept state if any of q 1, q 5, or q 7 are accept states for M. Formally, Q = 2 Q, S = {q 0 }, A = {T Q t T s.t. t A}, and δ (T, x) = q T δ(q, x). We need to prove two things. For w = w 0 w k 1, if w L(M), then w L(M ), and if w L(M ), then w L(M). We start with the first statement, letting w L(M). Because M is an NFA, we know that there exists some sequence of states, q 0, q 1,..., q k, such that, q i+1 δ(q i, w i ), and q k A. Let T 0, T 1,..., T k, be the states in M such that for each i {0..., k}, T i+1 = δ (T i, w i ). We claim that T k A. To show this, we first argue that q i T i. This clearly holds for q 0, since T 0 = S = {q 0 }. Assume it holds for q i, and recall that by the definition of δ, T i+1 = q T i δ(q, w i ). Since q i+1 δ(q i, w i ), and q i T i, it follows that q i+1 T i+1. Finally, since q k T k, and q k A, it follows that T k A. We now need to prove that if w L(M ), then w L(M). Using the same notation, let T 0,..., T k be the sequence of states such that T i+1 = δ (T i, w i ). We have to show that there exists some sequence of states in Q, q 0,..., q k, such that q i+1 δ(q i, w i ), and q k A. We start by choosing q k and work backwards. To choose q k, we note that because T k A, then by definition of A, there is some q k T k such that q k A. Choose any such q k. For i < k, assume q i+1 has already be chosen. Since T i+1 = q T i δ(q, w i ), there exists some q i T i such that q i+1 δ(q i, w i ). Choose any such q i, and repeat. Since T 0 = {q 0 }, we can (and must) choose q 0 as our start state. This concludes the proof. Actually, technically, we also have to show how to handle Λ-transitions when constructing M. This is easily done. For each q Q, let E(q) be the set of states that is reachable using only Λ-transitions. Then, instead of defining δ (T, x) = q T δ(q, x), we define it as δ (T, x) = q T (δ(q, x) E(q)). The rest of the proof would proceed as before. 5

6 2.6 Equivalence of Regular Languages and DFAs Using NFAs, it becomes much easier to show that all regular languages can be decided by a DFA. We leave it as a homework problem to show that 1. if a language L is decidable by a DFA, then L is decidable by some NFA, M. 2. if L 1 and L 2 are decided by DFAs M 1 and M 2, then L = L 1 L 2 is decidable by some NFA, M. To complete the proof that the class of regular languages and the class of languages decidable by DFAs are the same, we must also show that every language that is decidable by a DFA is regular. This is not a difficult proof, but we omit it in this class so that we can move on to other interesting things. 2.7 Some languages are not regular There are some languages that cannot be decided by any finite automata. To demonstrate this, we first prove a useful lemma that is famously known as the pumping lemma. Lemma 1 If L is a regular language, then there exists a number p such that for any w L with w > p, w can be divided into 3 strings, w = xyz such that: 1. i 0, xy i z L 2. y > 0 3. xy p Proof Since L is regular, we know that there exists some finite automata M that decides L. We define p to be the number of states in M. For w = w 1,..., w n, let q 0,..., q n be the sequence of states that lead from start to accept on string w. Because n > p (by assumption in the lemma statement), there must be some state in this sequence that is repeated (by the pigeonhole principal). Let q s be the first state on the list that appears more than once, and let t be the index of the first repetition of q s. (That is, q s = q t : they represent the same states, but appear in different places on this list.) Then we define x = w 1 w s, y = w s+1 w t, and z = w t+1 w n. We now show that the three properties of the lemma are satisfied. For the first property, let s consider i = 0, so that we have input string xz = w 1,..., w s, w t+1,..., w n. We know that the first s characters will leave us in state q s, since these are the same characters in the original input, w. Furthermore, since q s = q t, we know that w t+1,..., w n will transition us through q t+1,..., q n, landing us is in the same accept state that results from processing the original w. For i = 1, it is true by assumption that xyz L. For i > 1, we claim that at the end of each repetition of y, we end in state q t. This is certainly true at the end of the first repetition of y, by the way we defined q t. Since q t = q s, the next repetition of y transitions through q s+1,..., q t, just as the first occurrence of y did. Since the last repetition of y leaves us in q t, it follows that z transitions us to accept state q n. The fact that y > 0 follows immediately from the definition of y. To see that xy p, recall that q t is the first state to be repeated in the transition sequence. If t > p, it follows that there must be more than p states in M, which violates our definition of p. We now use the pumping lemma to show that L = {a n b n n 0} is not regular. Suppose that L is regular, and let M be the DFA decides it. Let p be the number of states in M. By the 6

7 pumping lemma, we know that any string w L with w > p can be written as xyz such that y can be pumped. Consider taking j = p/2. We claim that a j b j cannot be pumped. Specifically, regardless of how y is chosen for this string, xy 2 z / L. There are 3 cases to consider: 1) y contains only a values. In this case, xy 2 z has more as than bs. 2) y contains only b values. In this case, xy 2 z has more b values than as. Finally, 3) if y has both as and bs, then note that xy 2 z has a substring in which some as come after some bs. We note that we could have also considered j = p, and the argument would have been simpler. But this argument is more interesting, and demonstrates an important proof technique, called case analysis. An important thing to pay attention to in the proof above is the ordering of quantifiers. The pumping lemma says that if L is regular, then p such that w, w > p, xyz = w where x, y,and z satisfy the conditions of the lemma. To show that a language is NOT regular, we have to show that this statement is NOT true. That is, we have to show that p, w, w > p such that xyz = w, x, y, and z fail to satisfy the criteria of the lemma. In particular, then, note that we don t know the value of p we should use in the proof. Instead, for every possible value of p, we shown that there is some w such that for each and every possible way of splitting up w, one of the criteria are not met. 3 Pushdown Automata Push down automata are very similar to finite automata, but we equip the state machine with a stack for reading and writing data. The automata still operates by scanning the input, left to right, one character at a time. The automata terminates when it has read the last character of the input. An example can be seen below: transitions are labeled by a, b/c, where a Σ is a value of the input, and b, c Γ, where Γ, called the tape alphabet, is the set of characters that can pushed and popped from the stack. It is reasonable to assume that Σ Γ. The notation b/c means that you can take this transition if the character at the top of the stack is b, and, in doing so, you replace the b with a c. Note that you can only take a transition a, b/c if the next character of the input is a AND the character at the top of the stack is a b. If we don t wish to put anything new onto the stack, we can use a transition of the form a, b/λ. In this case, we would pop a b, and the number of elements on the stack would be reduced by one. Similarly, we also allow the machine to ignore the input or the stack. The former is denoted by Λ, a/b, and the latter is denoted by a, Λ/c. We can ignore both by Λ, Λ/c. Such transitions can be taken regardless of the values of the next input character and the character at the top of the stack. We also allow to push multiple characters onto the stack at once (though we do not allow multiple pops at once). For example, a, b/bc would pop 1 b, push 1 b, and then push 1 c. If the stack initially only had content b, then, after this transition, it would contain bc; we will always write (left to right) the content of the stack from bottom to top. Empty stack: We don t have any explicit mechanism for testing the stack to see if it is empty. Instead, if that is something we care to do, we can create a transition at the start that pushes a special symbol onto the stack, and we can later interpret as an indicator that the stack is empty. This can be seen in Figure 3 below, where $ plays that role. Note that we do not read an input character in that transition; we only start processing input after we ve initialized our stack. Termination: The automata terminates when the last character of the input is read. It accepts if and only if it terminates in an accept state. Just as with finite state automata, we assume there 7

8 is a trap state for rejecting that is not made explicit: if it is ever impossible to make a transition, and there is still input that hasn t been processed, then the machine is assumed to transition into a reject state and to stay there. Note that in the case where we ignore the input tape, we also delay termination by one transition. So, we can take many transitions of the form Λ, a/b, and these transitions do not use up any of the input. We will next walk through the example in Figure 3 below, which will demonstrate this point. Example: We walk through the NPDA in Figure 3, using input abba. There is only one transition we can take from the start state. We transition to even, the input tape still holds abba, and the stack holds $. Since the first input character is a, the only legal transition is to > a. The input tape holds bba and the stack holds $a. Since the top of the stack is now a, the only legal transition is b, a/λ, which leaves us in the same state. (Note we cannot take the transition labeled Λ, $/$, because the top of the stack was a.) This transition removes the a at the top of the stack. The input tape now holds ba, and the stack now holds $. The only legal transition is the one labeled Λ, $/$, to state even. The remaining input is still ba, since the Λ in that transition does not use up an input character. This transition pops and pushes $, so the stack still holds $. We transition to state > b, the input tape holds a and the stack holds $b. We transition using a, b/λ, remaining in the same state. The input tape is now empty, and the stack now holds $. We now have a choice to make. We can terminate and reject, or we can transition one more time using Λ, $/$ and then accept. Recall that the definition of non-determinism says that a string is in the language as long as there exists some sequence of choices that leads to accept. So, in this case, the string is in the language. 3.1 Formal notation for NPDAs A NPDA can be denoted by (Q, Σ, Γ, δ, q 0, Q A ), where Q is the set of states, Σ is the input alphabet, Γ is the tape alphabet (which might contain Σ), δ is a transition function, detailed below, q 0 is a special start state, and Q A Q is a set of accept states. The function δ maps a state, an input character, and a character read from the stack, to a state and a sequence of characters to be written to the stack. However, in the non-deterministic case, note that it might map the same input onto multiple outputs. We therefore let the co-domain be the power set of Q Γ. Formally, then, δ is a function δ : Q Σ Γ 2 Q Γ. A machine accepts string w if and only if w can be written as w 1 w 2 w n, where each w i Σ {Λ}, and there exists a sequence of states r 0, r 1,..., r n, r i Q, and a sequence of strings s 0,..., s n, s i Γ, such that 1. r 0 = q 0, s 0 = Λ, and r m Q A. 8

9 Figure 3: M L accepting language L = {(a + b) there are an equal number of as and bs} 2. i {1,..., n}, α Γ {Λ}, β, γ, Γ, such that s i 1 = αγ, s i = βγ, and (r i, β) δ(r i 1, w i 1, α) Intuitively, w 1 w n denote the input string, but possibly padded with internal Λ values to account for places that we might take a transition that doesn t read any input. The first condition states that we start in the start state with an empty stack, and we terminate in an accept state. The second condition says that we transition through some valid sequence of states, maintaining valid stack content. 3.2 NPDAs and DPDAs are not equivalent Unlike in the case of DFAs and NFAs, non-determinism in the case of push-down automata does in fact increase the expressiveness of the model. That is, there are language that can be decided by a NPDA that cannot be decided by a DPDA. An example of such a language is L = {a n b n n 0} {a n b 2n n 0}. We leave it as an exercise to show that L can be decided by an NPDA. Also, we do not prove in this class that there is a pumping lemma, similar to the one for regular languages, which shows that certain languages cannot be decided by NPDAs. One such language is L = {a n b n c n n 0}. To prove that L cannot be decided by any DPDA, we show that, if it were, then we can construct a PDA for L, violating the pumping lemma. Let M 1 = ({a, b}, Q 1, q 0, A 1, δ 1 ) and M 2 = ({a, b}, Q 2, S 2, A 2, δ 2 ) be identical copies of the machine that decides L, but with different state names. To construct M deciding L, we start with M = ({a, b, c}, Q 1 Q 2, q 0, A 2, δ ), where, for x {a, b}, q Q 1, δ (q, x) = δ 1 (q, x), and q Q 2, δ (q, x) = δ 2 (q, x). We then make the following modifications to δ in order to define its behavior on inputs of type c. 1. For each q A 1, let p 1 = δ(q, b), and let p 2 be the equivalent state in M 2. Define δ (q, c) = p For every q Q 2, let p 2 = δ(q, b). Define δ (q, c) = p 2, and set δ (q, b) = reject. Intuitively, the modifications specified above are as follows. For each state that was an accepting state in M 1, if there was a transition out of that state labeled with character b, then we add a 9

10 Figure 4: Machine M, deciding language L = {a n b n c n n 0}, which we know to be impossible. Figure is taken from Richards [1]. transition labeled c to the equivalent state in M 2. Then, for every b transition in M 2, we replace it with a c transition. To prove that this decides L, we start by arguing that if w L, M ends in an accept state. To see this, consider what happens after a i b i are processed. Since a i b i L, we know that at this point in the computation, M is in an accept state. Since w L, the next i characters are c, and because we re in an accept state, the first of these characters causes a transition to a state in M 2. From there, the transitions follow the last i transitions of δ 2, on input a i b 2i. On the other hand, if M accepts on some string w, we must argue that w L. We first note that if w does not begin either with a i b i c, or with a i b 2i c, then M must reject. This is because all accept states are in M 2, so w has to touch some state in A 1, and then transition with a c to M 2. Furthermore, if there are any characters other than c after the transition to M 2 is made, then it is easy to see that M will reject: a b will cause a reject explicitly, and an a will cause a reject because M 2 does not allow an a after the first appearance of a b. Suppose w is of the form a i b 2i c j. If M accepts, it follows that M 1 would accept a i b 2i+j, violating our assumption that M 1 decides L. So we have that w is of the form a i b i c j. Finally, if j i, by the same previous argument, M must reject, or else M 1 would accept a string a i b i+j, where 0 j i, violating our assumption about M 1. We conclude that w is of the form a i b i c i, as claimed. References [1] D. Richards Logic and Language Models for Computer Science, third edition. World Scientific Publishing Co., [2] M. Sipser. Introduction to the Theory of Computation (2nd edition). Course Technology,

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata CISC 4090: Theory of Computation Chapter Regular Languages Xiaolan Zhang, adapted from slides by Prof. Werschulz Section.: Finite Automata Fordham University Department of Computer and Information Sciences

More information

Introduction to Turing Machines. Reading: Chapters 8 & 9

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

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

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 3.3, 4.1 State and use the Church-Turing thesis. Give examples of decidable problems.

More information

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages

More information

Finite Automata and Regular languages

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

CISC4090: Theory of Computation

CISC4090: Theory of Computation CISC4090: Theory of Computation Chapter 2 Context-Free Languages Courtesy of Prof. Arthur G. Werschulz Fordham University Department of Computer and Information Sciences Spring, 2014 Overview In Chapter

More information

Computer Sciences Department

Computer Sciences Department 1 Reference Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER 3 objectives Finite automaton Infinite automaton Formal definition State diagram Regular and Non-regular

More information

CSCE 551 Final Exam, Spring 2004 Answer Key

CSCE 551 Final Exam, Spring 2004 Answer Key CSCE 551 Final Exam, Spring 2004 Answer Key 1. (10 points) Using any method you like (including intuition), give the unique minimal DFA equivalent to the following NFA: 0 1 2 0 5 1 3 4 If your answer is

More information

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM) Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM) 1 Deterministic Turing Machine (DTM).. B B 0 1 1 0 0 B B.. Finite Control Two-way, infinite tape, broken into

More information

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS Automata Theory Lecture on Discussion Course of CS2 This Lecture is about Mathematical Models of Computation. Why Should I Care? - Ways of thinking. - Theory can drive practice. - Don t be an Instrumentalist.

More information

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018 CS 301 Lecture 18 Decidable languages Stephen Checkoway April 2, 2018 1 / 26 Decidable language Recall, a language A is decidable if there is some TM M that 1 recognizes A (i.e., L(M) = A), and 2 halts

More information

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu Part 4 out of 5 ETH Zürich (D-ITET) October, 12 2017 Last week, we showed the equivalence of DFA, NFA and REX

More information

Computational Models - Lecture 4

Computational Models - Lecture 4 Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push

More information

CpSc 421 Final Exam December 15, 2006

CpSc 421 Final Exam December 15, 2006 CpSc 421 Final Exam December 15, 2006 Do problem zero and six of problems 1 through 9. If you write down solutions for more that six problems, clearly indicate those that you want graded. Note that problems

More information

1 More finite deterministic automata

1 More finite deterministic automata CS 125 Section #6 Finite automata October 18, 2016 1 More finite deterministic automata Exercise. Consider the following game with two players: Repeatedly flip a coin. On heads, player 1 gets a point.

More information

What we have done so far

What we have done so far What we have done so far DFAs and regular languages NFAs and their equivalence to DFAs Regular expressions. Regular expressions capture exactly regular languages: Construct a NFA from a regular expression.

More information

Theory Bridge Exam Example Questions

Theory Bridge Exam Example Questions Theory Bridge Exam Example Questions Annotated version with some (sometimes rather sketchy) answers and notes. This is a collection of sample theory bridge exam questions. This is just to get some idea

More information

Automata and Computability. Solutions to Exercises

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

(Refer Slide Time: 0:21)

(Refer Slide Time: 0:21) Theory of Computation Prof. Somenath Biswas Department of Computer Science and Engineering Indian Institute of Technology Kanpur Lecture 7 A generalisation of pumping lemma, Non-deterministic finite automata

More information

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012 Decision Problems with TM s Look at following sets: Lecture 31: Halting Problem CSCI 81 Spring, 2012 Kim Bruce A TM = { M,w M is a TM and w L(M)} H TM = { M,w M is a TM which halts on input w} TOTAL TM

More information

Please give details of your answer. A direct answer without explanation is not counted.

Please give details of your answer. A direct answer without explanation is not counted. Please give details of your answer. A direct answer without explanation is not counted. Your answers must be in English. Please carefully read problem statements. During the exam you are not allowed to

More information

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK COMS11700 Undecidability Department of Computer Science, University of Bristol Bristol, UK 4 April 2014 COMS11700: Undecidability Slide 1/29 Decidability We are particularly interested in Turing machines

More information

Automata: a short introduction

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

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Not A DFA Does not have exactly one transition from every state on every symbol: Two transitions from q 0 on a No transition from q 1 (on either a or b) Though not a DFA,

More information

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

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

Final exam study sheet for CS3719 Turing machines and decidability.

Final exam study sheet for CS3719 Turing machines and decidability. Final exam study sheet for CS3719 Turing machines and decidability. A Turing machine is a finite automaton with an infinite memory (tape). Formally, a Turing machine is a 6-tuple M = (Q, Σ, Γ, δ, q 0,

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Review of CFG, CFL, ambiguity What is the language generated by the CFG below: G 1 = ({S,T 1,T 2 }, {0,1,2}, { S

More information

CPSC 421: Tutorial #1

CPSC 421: Tutorial #1 CPSC 421: Tutorial #1 October 14, 2016 Set Theory. 1. Let A be an arbitrary set, and let B = {x A : x / x}. That is, B contains all sets in A that do not contain themselves: For all y, ( ) y B if and only

More information

Theory of Computation (IV) Yijia Chen Fudan University

Theory of Computation (IV) Yijia Chen Fudan University Theory of Computation (IV) Yijia Chen Fudan University Review language regular context-free machine DFA/ NFA PDA syntax regular expression context-free grammar Pushdown automata Definition A pushdown automaton

More information

Turing machines and linear bounded automata

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

CS 154, Lecture 3: DFA NFA, Regular Expressions

CS 154, Lecture 3: DFA NFA, Regular Expressions CS 154, Lecture 3: DFA NFA, Regular Expressions Homework 1 is coming out Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and

More information

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT. Recap DFA,NFA, DTM Slides by Prof. Debasis Mitra, FIT. 1 Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { {, } } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite

More information

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen Pushdown automata Twan van Laarhoven Institute for Computing and Information Sciences Intelligent Systems Version: fall 2014 T. van Laarhoven Version: fall 2014 Formal Languages, Grammars and Automata

More information

Automata and Computability. Solutions to Exercises

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

More information

Nondeterministic finite automata

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

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

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

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

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

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc. The Pumping Lemma For every regular language L, there is a number l 1 satisfying the pumping lemma property: All w L with w l can be expressed as a concatenation of three strings, w = u 1 vu 2, where u

More information

Turing Machines Part III

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

UNIT-VI PUSHDOWN AUTOMATA

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

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

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

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

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

Turing machines and linear bounded automata

Turing machines and linear bounded automata and linear bounded automata Informatics 2A: Lecture 30 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 25 November 2016 1 / 17 The Chomsky hierarchy: summary Level Language

More information

Part I: Definitions and Properties

Part I: Definitions and Properties Turing Machines Part I: Definitions and Properties Finite State Automata Deterministic Automata (DFSA) M = {Q, Σ, δ, q 0, F} -- Σ = Symbols -- Q = States -- q 0 = Initial State -- F = Accepting States

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 2 Design a PDA and a CFG for a given language Give informal description for a PDA,

More information

Decision, Computation and Language

Decision, Computation and Language Decision, Computation and Language Non-Deterministic Finite Automata (NFA) Dr. Muhammad S Khan (mskhan@liv.ac.uk) Ashton Building, Room G22 http://www.csc.liv.ac.uk/~khan/comp218 Finite State Automata

More information

DM17. Beregnelighed. Jacob Aae Mikkelsen

DM17. Beregnelighed. Jacob Aae Mikkelsen DM17 Beregnelighed Jacob Aae Mikkelsen January 12, 2007 CONTENTS Contents 1 Introduction 2 1.1 Operations with languages...................... 2 2 Finite Automata 3 2.1 Regular expressions/languages....................

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 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

Introduction to the Theory of Computing

Introduction to the Theory of Computing Introduction to the Theory of Computing Lecture notes for CS 360 John Watrous School of Computer Science and Institute for Quantum Computing University of Waterloo June 27, 2017 This work is licensed under

More information

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen Pushdown Automata Notes on Automata and Theory of Computation Chia-Ping Chen Department of Computer Science and Engineering National Sun Yat-Sen University Kaohsiung, Taiwan ROC Pushdown Automata p. 1

More information

Undecidable Problems and Reducibility

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

Computational Theory

Computational Theory Computational Theory Finite Automata and Regular Languages Curtis Larsen Dixie State University Computing and Design Fall 2018 Adapted from notes by Russ Ross Adapted from notes by Harry Lewis Curtis Larsen

More information

Further discussion of Turing machines

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

Formal Languages, Automata and Models of Computation

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

Uses of finite automata

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

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is, Recall A deterministic finite automaton is a five-tuple where S is a finite set of states, M = (S, Σ, T, s 0, F ) Σ is an alphabet the input alphabet, T : S Σ S is the transition function, s 0 S is the

More information

Turing Machines, diagonalization, the halting problem, reducibility

Turing Machines, diagonalization, the halting problem, reducibility Notes on Computer Theory Last updated: September, 015 Turing Machines, diagonalization, the halting problem, reducibility 1 Turing Machines A Turing machine is a state machine, similar to the ones we have

More information

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 10/22, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

UNIT-III REGULAR LANGUAGES

UNIT-III REGULAR LANGUAGES Syllabus R9 Regulation REGULAR EXPRESSIONS UNIT-III REGULAR LANGUAGES Regular expressions are useful for representing certain sets of strings in an algebraic fashion. In arithmetic we can use the operations

More information

Introduction to Languages and Computation

Introduction to Languages and Computation Introduction to Languages and Computation George Voutsadakis 1 1 Mathematics and Computer Science Lake Superior State University LSSU Math 400 George Voutsadakis (LSSU) Languages and Computation July 2014

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA.

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA. Outline CS21 Decidability and Tractability Lecture 5 January 16, 219 and Languages equivalence of NPDAs and CFGs non context-free languages January 16, 219 CS21 Lecture 5 1 January 16, 219 CS21 Lecture

More information

Decidability (What, stuff is unsolvable?)

Decidability (What, stuff is unsolvable?) University of Georgia Fall 2014 Outline Decidability Decidable Problems for Regular Languages Decidable Problems for Context Free Languages The Halting Problem Countable and Uncountable Sets Diagonalization

More information

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages CSci 311, Models of Computation Chapter 4 Properties of Regular Languages H. Conrad Cunningham 29 December 2015 Contents Introduction................................. 1 4.1 Closure Properties of Regular

More information

Nondeterministic Finite Automata

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 2 Define push down automata Trace the computation of a push down automaton Design

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 5 CHAPTER 2 FINITE AUTOMATA 1. Deterministic Finite Automata DFA 2. Nondeterministic Finite Automata NDFA 3. Finite Automata

More information

Theory of computation: initial remarks (Chapter 11)

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

CS 154. Finite Automata, Nondeterminism, Regular Expressions

CS 154. Finite Automata, Nondeterminism, Regular Expressions CS 54 Finite Automata, Nondeterminism, Regular Expressions Read string left to right The DFA accepts a string if the process ends in a double circle A DFA is a 5-tuple M = (Q, Σ, δ, q, F) Q is the set

More information

Automata Theory - Quiz II (Solutions)

Automata Theory - Quiz II (Solutions) Automata Theory - Quiz II (Solutions) K. Subramani LCSEE, West Virginia University, Morgantown, WV {ksmani@csee.wvu.edu} 1 Problems 1. Induction: Let L denote the language of balanced strings over Σ =

More information

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 BIJU PATNAIK UNIVERSITY OF TECHNOLOGY, ODISHA Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 Prepared by, Dr. Subhendu Kumar Rath, BPUT, Odisha. UNIT 2 Structure NON-DETERMINISTIC FINITE AUTOMATA

More information

Lecture 17: Language Recognition

Lecture 17: Language Recognition Lecture 17: Language Recognition Finite State Automata Deterministic and Non-Deterministic Finite Automata Regular Expressions Push-Down Automata Turing Machines Modeling Computation When attempting to

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 8 January 24, 2018 Outline Turing Machines and variants multitape TMs nondeterministic TMs Church-Turing Thesis So far several models of computation finite automata

More information

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018 CS 301 Lecture 17 Church Turing thesis Stephen Checkoway March 19, 2018 1 / 17 An abridged modern history of formalizing algorithms An algorithm is a finite, unambiguous sequence of steps for solving a

More information

CSC173 Workshop: 13 Sept. Notes

CSC173 Workshop: 13 Sept. Notes CSC173 Workshop: 13 Sept. Notes Frank Ferraro Department of Computer Science University of Rochester September 14, 2010 1 Regular Languages and Equivalent Forms A language can be thought of a set L of

More information

Reducability. Sipser, pages

Reducability. Sipser, pages Reducability Sipser, pages 187-214 Reduction Reduction encodes (transforms) one problem as a second problem. A solution to the second, can be transformed into a solution to the first. We expect both transformations

More information

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties Recall a closure property is a statement

More information

CS500 Homework #2 Solutions

CS500 Homework #2 Solutions CS500 Homework #2 Solutions 1. Consider the two languages Show that L 1 is context-free but L 2 is not. L 1 = {a i b j c k d l i = j k = l} L 2 = {a i b j c k d l i = k j = l} Answer. L 1 is the concatenation

More information

Turing machines and linear bounded automata

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 27 November 2015 1 / 15 The Chomsky hierarchy: summary Level Language

More information

Chapter Five: Nondeterministic Finite Automata

Chapter Five: Nondeterministic Finite Automata Chapter Five: Nondeterministic Finite Automata From DFA to NFA A DFA has exactly one transition from every state on every symbol in the alphabet. By relaxing this requirement we get a related but more

More information

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam ECS 120: Theory of Computation Handout MT UC Davis Phillip Rogaway February 16, 2012 Midterm Exam Instructions: The exam has six pages, including this cover page, printed out two-sided (no more wasted

More information

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata : Organization of Programming Languages Theory of Regular Expressions Finite Automata Previous Course Review {s s defined} means the set of string s such that s is chosen or defined as given s A means

More information

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) Definition 1 (Alphabet) A alphabet is a finite set of objects called symbols. Definition 2 (String)

More information

NPDA, CFG equivalence

NPDA, CFG equivalence NPDA, CFG equivalence Theorem A language L is recognized by a NPDA iff L is described by a CFG. Must prove two directions: ( ) L is recognized by a NPDA implies L is described by a CFG. ( ) L is described

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 6 CHAPTER 2 FINITE AUTOMATA 2. Nondeterministic Finite Automata NFA 3. Finite Automata and Regular Expressions 4. Languages

More information

Theory of Computation

Theory of Computation Theory of Computation Dr. Sarmad Abbasi Dr. Sarmad Abbasi () Theory of Computation 1 / 38 Lecture 21: Overview Big-Oh notation. Little-o notation. Time Complexity Classes Non-deterministic TMs The Class

More information

Notes for Comp 497 (Comp 454) Week 12 4/19/05. Today we look at some variations on machines we have already seen. Chapter 21

Notes for Comp 497 (Comp 454) Week 12 4/19/05. Today we look at some variations on machines we have already seen. Chapter 21 Notes for Comp 497 (Comp 454) Week 12 4/19/05 Today we look at some variations on machines we have already seen. Errata (Chapter 21): None known Chapter 21 So far we have seen the equivalence of Post Machines

More information

Automata Theory (2A) Young Won Lim 5/31/18

Automata Theory (2A) Young Won Lim 5/31/18 Automata Theory (2A) Copyright (c) 2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Theory of Computation

Theory of Computation Fall 2002 (YEN) Theory of Computation Midterm Exam. Name:... I.D.#:... 1. (30 pts) True or false (mark O for true ; X for false ). (Score=Max{0, Right- 1 2 Wrong}.) (1) X... If L 1 is regular and L 2 L

More information

Theory of Computation (II) Yijia Chen Fudan University

Theory of Computation (II) Yijia Chen Fudan University Theory of Computation (II) Yijia Chen Fudan University Review A language L is a subset of strings over an alphabet Σ. Our goal is to identify those languages that can be recognized by one of the simplest

More information

CS243, Logic and Computation Nondeterministic finite automata

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

Lecture 4: More on Regexps, Non-Regular Languages

Lecture 4: More on Regexps, Non-Regular Languages 6.045 Lecture 4: More on Regexps, Non-Regular Languages 6.045 Announcements: - Pset 1 is on piazza (as of last night) - If you don t have piazza access but are registered for 6.045, send email to TAs with

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. 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

CS 154 Introduction to Automata and Complexity Theory

CS 154 Introduction to Automata and Complexity Theory CS 154 Introduction to Automata and Complexity Theory cs154.stanford.edu 1 INSTRUCTORS & TAs Ryan Williams Cody Murray Lera Nikolaenko Sunny Rajan 2 Textbook 3 Homework / Problem Sets Homework will be

More information

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class CSE 105 THEORY OF COMPUTATION Spring 2018 review class Today's learning goals Summarize key concepts, ideas, themes from CSE 105. Approach your final exam studying with confidence. Identify areas to focus

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. 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

Theory of Computation

Theory of Computation Theory of Computation Lecture #2 Sarmad Abbasi Virtual University Sarmad Abbasi (Virtual University) Theory of Computation 1 / 1 Lecture 2: Overview Recall some basic definitions from Automata Theory.

More information

SE 3310b Theoretical Foundations of Software Engineering. Turing Machines. Aleksander Essex

SE 3310b Theoretical Foundations of Software Engineering. Turing Machines. Aleksander Essex SE 3310b Theoretical Foundations of Software Engineering Turing Machines Aleksander Essex 1 / 1 Turing Machines 2 / 1 Introduction We ve finally arrived at a complete model of computation: Turing machines.

More information