CS243, Logic and Computation General models of computation. Limits of computation. 1 Limitations of pushdown automata (PDA)

Size: px
Start display at page:

Download "CS243, Logic and Computation General models of computation. Limits of computation. 1 Limitations of pushdown automata (PDA)"

Transcription

1 CS243, Prof. Alvarez 1 LIMITATIONS OF PUSHDOWN AUTOMATA (PDA) Prof. Sergio A. Alvarez alvarez/ Maloney Hall, room 569 alvarez@cs.bc.edu Computer Science Department voice: (617) Boston College fax: (617) Chestnut Hill, MA USA CS243, Logic and Computation General models of computation. Limits of computation. As we have seen, finite automata without external memory, and pushdown automata, both provide models of computation. However, these models turn out to be limited in their power. These notes discuss briefly describe general abstract models of computation, and go on to consider the limits of the computable. 1 Limitations of pushdown automata (PDA) 1.1 The context-free pumping lemma The Pumping Lemma establishes a property shared by all languages that are recognizable by FA without external memory. This pumping property can be traced back to the finiteness of the state space that must capture the state of any ongoing computation in a FA. The Pumping Lemma implies the non-recognizability by FA of certain languages, such as the set of palindromes over a given finite alphabet, the set of strings of the form 0 n 1 n (for, say, n 1), or the set of decimal integer encodings of the set of powers of 2. Motivated by the above limitation of FA, we considered pushdown automata (PDA), which possess a stack memory external to the state space. PDA succeed in recognizing certain non-regular languages, for example the palindromic languages. The languages that are recognizable by PDA are precisely the languages that can be generated by contextfree grammars (CFG). It turns out that derivations in a CFG, like computations in a FA, are bound by a finiteness constraint. In the case of CFG, it is the finiteness of the set of variables and transformation rules that imposes this constraint. Any derivation of a sufficiently long string in a CFG will necessarily repeat variables. This fact allows the derivation of pumped variants of the string, leading to the CFG version of the Pumping Lemma in Theorem 1.1. Theorem 1.1. If G = (V, Σ, R, S) is a CFG, then there is a positive integer p, known as a pumping length of G, such that every string w L(G) of length p or greater can be split as w = uvxyz in such a way that the following conditions are satisfied simultaneously: 1. vxy p 2. one or both of v and y are non-empty

2 CS243, Prof. Alvarez 1 LIMITATIONS OF PUSHDOWN AUTOMATA (PDA) 3. n 0, uv n xy n z L(G) Furthermore, p can be taken to be at most b V + 1, where b is the maximum length of the consequent of a transformation rule of G and V is the set of variables of G. Example 1.1. The number 2 is a pumping length of the set of palindromes over a given finite alphabet, Σ. To see this, we need to show that any palindromic string w of length 2 or greater can be split as described in Theorem 1.1. This is easy to do: given such a w, locate the middle of the string. If the length of w is odd, there is a symbol of the alphabet, call it a, at precisely the midpoint location. Choose u to consist of all symbols that precede that a in w, let v = a, let x and y be empty, and let z consist of the entire right half of the string, excluding the midpoint symbol. Then w = uvxyz, vxy = 1 2, vy is non-empty, and, since u and z are reverses of one another, uv n xy n z = ua n z is a palindrome for all non-negative integers, n. If the length of w is even, then the midpoint location falls between two consecutive symbols that must be precisely the same symbol of the alphabet, call it a, since w is a palindrome. In that case, let v and y be those two central occurrences of the symbol a, let x be empty, and let u and z, respectively, be the left and right halves of w, not including the two central as. Then w = uvxyz, vxy = 2, and, since u and z are reverses of one another, uv n xy n z = ua n a n z is a palindrome for all non-negative integers, n. This completes the proof that 2 is a pumping length of the set of palindromes over a given alphabet Σ. Example 1.2. The language of strings of the form 0 2n 1 n for n 1 has 3 as a pumping length. To see this, assume that w = 0 2n 1 n for some n 1 (this guarantees that the length of w is at least 3). We must show that w can be split as uvxyz with all of the properties stated in the CFG Pumping Lemma. This is easy to do, by focusing on the boundary between the 0s and 1s: let v denote the rightmost two 0s and y denote the leftmost 1 in w, let x be empty, and let u = 0 2(n 1) and z = 1 n 1. Then w = uvxyz, vxy = 3, and uv m xy m z = 0 2(n 1)+2m 1 m+n 1 = 0 2(n 1+m) 1 n 1+m is in the target language for all nonnegative integers, m. 1.2 Examples of languages that are not recognizable by PDA The context-free version of the Pumping Lemma in Theorem 1.1 provides a necessary condition for a language to be recognizable by a PDA. Therefore, any language that fails to have a finite pumping length as described in Theorem 1.1 is not context-free. Example 1.3. Let L denote the language of strings of the form 0 n 1 n 2 n, for any non-negative integer, n. We claim that L is not context-free, and hence that there is no PDA that recognizes L. We prove this by showing that L has no finite context-free pumping length. Let p be any positive integer. We will prove that p is not a context-free pumping length of L. We do this by designing a special string w L that has length p or greater but that cannot be split as w = uvxyz with the properties described in the context-free pumping lemma. We select the string w = 0 p 1 p 2 p. This string w clearly belongs to L and has length p

3 CS243, Prof. Alvarez 2 GENERAL MODELS OF COMPUTATION or greater. Suppose that w = uvxyz is any split of w such that vy is non-empty and vxy has length p or less. We will show that some pumped version uv m xy m z does not belong to L. This is easy, because the length restriction on vxy and the structure of w together imply that vxy can contain at most two different symbols among the alphabet symbols 0, 1, 2. Because vy is non-empty, pumping will alter the counts of the symbols present in vy but not the counts of the one or more alphabet symbols that are missed by vy. Therefore, pumping will produce strings that are not in L. This proves that p is not a context-free pumping length of L. Since p was only assumed to be a positive integer, we have proved that L has no finite pumping length and therefore, by the context-free Pumping Lemma, L is not context-free. Example 1.4. Let L denote the language over the alphabet {1} consisting of all strings that have prime length. We claim that no PDA can recognize this L. Let p be any positive integer. Since the set of prime integers is infinite, there is some prime number q p. Let w be the string 1 q, which belongs to L and has length at least p. Suppose that w = uvxyz is any split of w such that vy is non-empty and vxy has length p or less. We will show that some pumped version uv m xy m z does not belong to L. To do this, let k denote the length of vy. Then uv m xy m z has length q + (m 1)k. Now let m = 1 + q. Then uv m xy m z has length q(1 + k), which is clearly not prime. This shows that uv m xy m z is not in L, and therefore that no positive integer p is a context-free pumping length of L. By the context-free Pumping Lemma, L is not context-free, as claimed. 2 General models of computation Finite automata have limited computational power, even with the addition of an external data structure such as a stack. The limitations stem from the finiteness of the state space, as well as the requirement that computation be completed in a single pass over the input string. The stack is limiting because of its last-in first-out nature. Thus, it is natural that a more general model of computation would have the following features: Desirable features of a general model of computation. An unlimited state space An unlimited general purpose memory The capability of making multiple passes over the input string At the same time, we would like for the model to be implementable in finite form, as a program. The compromise that is usually made is for the state space, which is an embodiment of a program, to be finite, but to require that the amount of available memory be unlimited. This still allows for an unlimited amount of state information, because the state of a computation depends not only on the state in the FA sense, but also on the contents of memory. As long as there is no bound on the amount of available memory, a program will still be able to describe an infinity of possible situations. Likewise, if unlimited read-write

4 CS243, Prof. Alvarez 2 GENERAL MODELS OF COMPUTATION memory is available, no generality is lost by assuming a single pass over the input string, as one pass suffices to copy the string into memory, where it can be re-examined at will. 2.1 Turing machines Among several equivalent formal models of computation that were developed in the first half of the 20 th century, the finite-state model of Alan Turing is the one that best fits the description of a machine. A Turing machine is a FA that is equipped with the capability to move forward and backward along the input string, as well as the capability to write directly on the input device (possibly overwriting the input string). The input device is usually described as a tape, meaning a list that can be traversed in both directions, one position at a time. More formally, a Turing machine is a tuple M = (Q, Σ, Γ, δ, q 0, q f, q r ), where Q is a finite state space, Σ is a finite input alphabet, Γ Σ is a finite tape alphabet, δ : Q Γ Q Γ {L, R, S} is the transition function, q 0 Q is the start state, q f Q is the accepting state, and q r Q is the rejecting state. The tape alphabet is assumed to contain a blank symbol, while the input alphabet cannot contain this symbol. The value of the transition function δ(q, a) specifies the new state, the new input symbol that is written, and the tape motion that occur when the machine is in state q reading tape symbol a. The letters L, R, S represent the three possible motions: left, right, stationary. 2.2 Random-access machines Random-access machines (RAM) are a computation model patterned after the classical stored-program computer architecture. A RAM is equipped with one memory cell R i for each non-negative integer, i. Memory cells contain integer values. A separate area of memory is reserved for program instructions. A special memory cell, the program counter, points to the current instruction. RAM instruction sets vary among RAM flavors. However, they usually contain the following elements: INC(i) increments register R i by 1 DEC(i) decrements register R i by 1 JZ(i,j) changes the program counter to j if register R i contains 0 HALT stops the program indirect addressing: allows the use of R i instead of i in any of the above (e.g., INC-indirect(i) increments register R Ri by 1, for example register R 23 is incremented if R i = 23)

5 2.3 The Church-Turing thesis Turing machines and RAM are known to have equivalent computational power. That is, they recognize the same classes of languages. Each of the two types of machine can simulate the other. For example, a dedicated portion of a Turing machine s tape can be reserved for a given register; integers can be represented on the tape using a simple notation equivalent to tally marks (e.g., represents the value 5). Likewise, a RAM s registers can be used to represent the content of a Turing machine s tape during a given computation. Other general computational formalisms that have been proposed, including the general recursive functions of Gödel, the λ-calculus of Church, and all standard high-level programming languages that allow recursion (e.g., Python, Java, C) are also known to have the same computational power as Turing machines. The term Turing-complete is used to describe formalisms with the same computational power as Turing machines. The Church-Turing thesis states that any Turing-complete formalism, such as those above, completely captures the intuitive notion of algorithmic computation. In other words, if a computational problem can be solved mechanically, it can be solved by any given Turing-complete model. The Church-Turing thesis cannot be proved, as it refers to a notion that does not have an objective definition separate from the specific computational formalisms themselves. We will accept the Church-Turing thesis as an axiom that describes what it means for a computation to be possible. Note that computational efficiency is not being taken into account, only the possibility of carrying out the computation at all, given unlimited time and memory. 3 Computability We know that many computational problems can be solved algorithmically. For example, recognizing the set of prime numbers is beyond FA and PDA, but it is well within the capabilities of a Turing-complete formalism. Indeed, here is a Python program that solves this problem: >>> def isprime(n): if n < 2: return false for div in range(2,n): if n%div==0: return false return true We are assuming that memory is unlimited. Otherwise, very large values of the parameter, n, would not even be representable. For example, with a memory limit of say, 100 GB, numbers longer than about 100 billion digits are not representable. The above isprime function makes about n passes through the main loop in the worst case (when n is prime). If n is represented using standard positional notation, then the magnitude of n is exponential in its size as a string (e.g, the length 5 string 99,999 represents a quantity of magnitude roughly 10 5 ). The isprime function as shown provides very inefficient computation. We are assuming that the available time for computation is also unlimited.

6 We are interested in the following question: Are there any specific computational problems that can not be solved? There are, of course, many diferent Python programs, infinitely many, in fact. Therefore, there are, in principle, infinitely many computational problems that can be solved. Perhaps this leaves no room for unsolvable problems? We shall examine these questions more closely. 3.1 Infinite sets Recall that a bijection is a function f : A B that has the following two properties: f is one-to-one, that is, if x y are elements of A, then f(x) f(y) f is onto, that is, for every y B, there is some x A such that f(x) = y A basic fact about finite sets is the following: Two finite sets have the same size if and only if there is a bijection between them. This fact can be proved by induction in the number of elements of A (exercise) Definition of the size of an infinite set What about infinite sets? Well, there is no integer that can count the elements of an infinite set. A simple example shows that the notion of size has surprising properties for infinite sets. Example 3.1. The Hilbert Hotel has one room for each positive integer. The hotel is fully booked for the night. A new guest arrives. The front desk greets him and proceeds to give him a room. How? There is no sharing of rooms. However, guests are required to be willing to change rooms during the night. Here s how room opens up for the new guest: first, each guest moves to the next higher-numbered room: the guest in room n moves to room n + 1. Each current guest therefore receives a room, and room 1 becomes available for the new guest! We could just give up on understanding the notion of size for infinite sets with this sort of observation. Georg Cantor didn t. Instead, he used the above fact about bijections as a definition of size for all sets, finite or infinite. Definition 3.1. Two sets, A and B, have the same cardinality if, and only if, there is a bijection f : A B between them. At first sight, doing this may seem like a futile exercise. After all, there is a lot of room in an infinite set, possibly enough to precisely match that in any other infinite set. If that is the case, then why bother with definitions? A set that has the same cardinality as N is said to be enumerable. Below are some examples that suggest that all infinite sets are enumerable.

7 3.1.2 Examples of infinite enumerable sets Example 3.2. The set N of positive integers has the same cardinality as the set Z of all integers. To see this, we must exhibit a bijection f : N Z. Such a bijection is called an enumeration of the elements of Z. Informally, since N consists of the counting numbers 1, 2, 3,, we must show a specific order in which the elements of Z can be counted. Here s one: 0, 1, 1, 2, 2, 3, 3, n, n,. A closed-form expression for this enumeration is f(j) = ( 1) j 1 j/2 for all j N. Example 3.3. The set of prime numbers is enumerable. This is a consequence of the fact that there are infinitely many prime numbers, a classical argument for which is the following: given any prime numbers p 1, p 2,, p n, the number m obtained by adding 1 to the product of all of these primes p i is not divisible by any of the p i ; hence, m must either be prime itself, or there must be some prime other than all of the p i that divides m; in any case, no given finite set can contain all of the prime numbers that exist. An enumeration of the set of primes is defined by recursion as follows: f(1) = 2 f(n + 1) = min{p p is prime and p > f(n)} In other words, f(n) is the n-th smallest prime. Example 3.4. We aim to describe an enumeration of the set N N of all pairs of positive integers. Imagine the set N N as a regularly spaced two-dimensional grid of points (n, m), using the components of each pair as the corresponding point s rectangular coordinates. We need to describe a walk in this grid that visits each grid point precisely once. You can try fixing one of the two coordinates and proceeding in ascending order of the other, as in (1, 1), (1, 2), (1, 3),, (1, n), (1, n + 1), (the n-th point visited is therefore (1, n)). The problem with this approach is that, even with an unlimited number of steps, only points within the same row are ever visited. The corresponding function f : N N N such that f(n) = (1, n) is not onto. A successful enumeration must have the property that it exhausts the target set in the limit as the number of steps goes to infinity. An enumeration of N N does indeed exist. Can you describe one, first informally and then as a specific expression in terms of the step number, n? A useful fact for proving enumerability Theorem 3.1. If A is an infinite set such that there is some onto (surjective) function f : N A, then A is enumerable. Proof. Let A and f be as in the statement. We will construct a bijection g : N A. We let g(1) = f(1), and then, for each n > 1, we let g(n) = f(m), where m is the smallest positive integer such that f(m) g(k) for each k < n; the fact that this m exists follows from the assumed infinity of A. Notice that then g(n) g(k) for each k < n, and injectivity of g follows. The fact that g is surjective follows from Lemma 3.2 below.

8 Lemma 3.2. Let the functions f and g be as in the proof of Theorem 3.1. For every positive integer n, there is some p n such that g(p) = f(n). Proof. The claim in the statement is true for n = 1 (with p = 1) by the base case of the definition of g. Assume now that n > 1. There are two cases for f(n): either f(n) = g(k) for some k < n, or f(n) g(k) for all k < n. In the latter case, g(n) = f(n) by the definition of g. Hence, in both cases we have f(n) = g(p) for some p n. This completes the proof of Lemma 3.2 and therefore also of Theorem Diagonalization An important argument technique was introduced by Cantor in dealing with infinite sets Warm-up: 2 n is larger than n for every positive integer n There is more than one way to prove the statement 2 n > n for n 1. Here s a proof involving strings. First, you can see that 2 n is precisely the number of binary strings of length n. For example, there are 2 1 = 2 binary strings of length 1 (i.e., 0 and 1), 2 2 = 4 binary strings of length 2 (00, 01, 10, 11), and so on. In order to prove that 2 n is larger than n, we just have to show convincingly that there are more than n binary sequences of length n. This is actually quite obvious, because there are the n sequences with a single 1 each, plus other sequences. However, we ll give a different proof to prepare for the infinite case. We ll argue by contradiction: we ll tentatively assume that there are n or fewer binary strings of length n, and we ll show that this assumption alone leads to the conflicting inference that there are more than n such sequences. Since this contradiction becomes possible because of the assumption that there are n or fewer binary sequences of length n, we are forced to conclude that the assumption cannot possibly hold (contradictions do not exist). In other words, we will be forced to conclude that there are strictly more than n binary sequences of length n. Following the preceding sketch of the argument, begin by assuming that there are n or fewer binary strings of length n. If so, then we can list all of these strings as a rectangular array, with one string per row, and n or fewer rows altogether. Let s i be the i-th string; the j-th symbol of s i then appears in row i, column j of the rectangular array. For example, for some row count m n we could have: s 1 : s 2 : s 3 : s m : Notice that the particular strings of 0s and 1s shown above are solely for illustration purposes. The assumption is that all binary strings of length n will be included in the array, in some.

9 order, using n or fewer rows. Based on this assumption alone, we will construct an additional binary string s of length n, one that does not appear in the array at all! Before doing that, note that, regardless of the details of this construction, the very existence of a missing string would imply that the initial assumption can t be correct. To construct a string s that is not already in the array, proceed as follows: scan down the diagonal of the array, starting with row 1, column 1 (top left corner), then stepping down and over to row 2, column 2, then row 3, column 3, so that the i-th step visits row i, column i. As you do that, read off the bits of the new string s by changing the bit currently in that position of the array. That is, the i-th bit of s will be the opposite (complement) of the i-th bit of s i. In the sample array drawn above, the new string s would start with 110. If you run out of rows before constructing the n bits of s, just fill in the rest arbitrarily (all 0s, for example). Now we observe that s cannot already be one of the rows of the array, because its first bit differs from the first bit of s 1 (so s can t be s 1 ), its second bit differs from s 2 s second bit, and so on. Therefore, we see that the original array missed this particular s. The inescapable conclusion is that there are more than 2 n binary strings of length n An infinite set that is not enumerable We will now use the diagonalization (diagonal toggling) technique illustrated above to prove that the set of all functions s : N {0, 1} (sometimes denoted 2 N ) is not enumerable. Notice that each such function is just an enumerably infinite binary sequence. The set of all such sequences is obviously infinite. For example, for each index j, there is a sequence s (j) in 2 N = 1 only if i = j). The function j s (j) is one-to-one from N into 2 N, but it is not onto because there are many sequences in 2 N that have 1s in more than one position. Therefore, this particular function is not an enumeration of 2 N. We claim that no enumeration of 2 N exists. The non-enumerability argument is essentially the same as in the finite context discussed above. Given a proposed enumeration f : N 2 N, consider the sequence s obtained by toggling the diagonal entries in the table form of the enumeration. That is, let s i = f(i) i, where the bar denotes binary complement. Then s differs from the i th sequence f(i) in the i th position, and therefore is not any of the sequences listed by f. This shows that the proposed enumeration f is not onto 2 N, and therefore is not a valid enumeration at all. We conclude that no enumeration of 2 N exists. In other words, 2 N is not enumerable! that has 0s in all positions except the j th, where it has the value 1 (s (j) i Exercise. In Python, the bin function returns the binary positional representation of a given positive integer, with the added prefix 0b. Assume that a function named pad is available such that pad(s) pads a given binary string s with 0s at the right end in order to obtain a sequence of infinite length. Define a new function f:n 2 N by f(n) = pad(bin(n)[2:]). Is this function one-to-one? Does it map N onto 2 N? Discuss in detail.

10 3.3 The existence of unsolvable problems We accept the Church-Turing thesis: every solvable problem can be solved by a Turingcomplete computational formalism. In particular, we accept that every solvable problem can be solved by a Python program that has access to unlimited memory and computing time. This has the following consequence. Theorem 3.3. The set of solvable problems is enumerably infinite. Proof. Let S be the set of all solvable problems. For concreteness, we assume that each such problem has been encoded as a language recognition problem using some fixed finite alphabet, such as the 256 character ASCII alphabet. We claim that there is an onto function f : N S. The key insight is the following. By the Church-Turing thesis, every solvable problem is solvable by some Python program. Hence, it will be enough to show that the set P of all Python programs is enumerable: if g : N P is onto, then letting L : P S be the onto function that associates to each program p the language L(p) recognized by p, we see that the composition L g will also be onto S, and enumerability of S will follow by Theorem 3.1. We prove the enumerability of P below. Lemma 3.4. The set P of all Python programs is enumerable. Proof. Every program p P is a finite string over the ASCII alphabet A, that is, P A. Not every element of A is a program, of course, as there are syntactical requirements that every program must meet. So, it will suffice to show that A is enumerable. But we know that A = A n, n=0 where A n is the n-fold Cartesian product of A with itself (and A 0 = {ɛ}). Since A is finite, each term A n is finite. Hence, the union of all of these terms can be enumerated simply by listing the elements of each of them in ascending order of n: for n = 0, list ɛ; for n = 1, list all of the ASCII characters; for n = 2, list all of the ordered pairs of ASCII characters; and so on. This proves that A is enumerable, and completes the proof of Theorem 3.3. Theorem 3.5. The set of computationally unsolvable problems is non-enumerably infinite. In particular, there exist (many) unsolvable problems. Proof. Theorem 3.3 shows that the set of solvable problems is enumerable. However, a diagonalization argument shows that the set P(A ) of all languages over the ASCII alphabet is non-enumerably infinite (exercise). Since P(A ) = S U, where S denotes the set of solvable problems and U denotes the set of unsolvable problems, and since S is enumerable and the union of two enumerable sets is enumerable, it follows that U is not enumerable.

11 3.4 The acceptance and halting problems Show me the money! Rod Tidwell (Cuba Gooding, Jr.) in Jerry McGuire, TriStar Pictures / Gracie Films (1993). The preceding section provides ample food for thought. Lest we plunge into the depths a little too recklessly, let us demand some evidence. What are these unsolvable problems that are promised by Theorem 3.5? We will describe two specific ones. First, some terminology. Definition 3.2. A program p is a decider if p halts on all possible inputs after a finite number of steps, returning either True or False. The truth value returned by the call p(s) is p s decision about the membership status of the input value s in the language L(p) recognized by p. A language L is called decidable if there is some decider program p such that the language L(p) equals L. Decidable languages represent computational problems that can be solved in finite time The acceptance problem Let Acc be the language of all pairs (p, s) consisting of a Python program p and an input string s over the ASCII alphabet such that the computation p(s) halts in a finite number of steps and returns True. You can imagine that these pairs are encoded as strings str(p, s) according to some scheme. For example, the program p can appear at the left end of the string, then some special delimiter character or string can appear that signals the end of the program, and then the input string s can appear at the right end of str(s, p). With such an encoding scheme in place, Acc is just a language of strings. For example, consider the function findpythagoreantriple defined below. The nexttriple function called from findpythagoreantriple is assumed to return the next element in an enumeration of N N N. >>> def findpythagoreantriple(p):... (a,b,c) = (1,1,1)... while a**p + b**p!= c**p:... (a,b,c) = nexttriple(a,b,c)... return True The pair (findpythagoreantriple, 2) belongs to Acc, since = 5 2 and therefore findpythagoreantriple(2) returns True. It turns out that (findpythagoreantriple, 17) does not belong to Acc. However, the latter fact requires a delicate number theory argument. This shows that recognizing Acc is not an easy task. Unsolvability of the acceptance problem. We claim that Acc is not decidable (solvable). In other words, there is no program that can decide for all programs p and all inputs s is p accepts s. Suppose otherwise, for the sake of argument. Then there is some decider program p Acc that recognizes Acc. In other words, on input (p, s), where p is a program

12 and s is an input string of p, the decider p Acc can decide in a finite number of steps if the computation p(s) ends with p accepting s, and p Acc (p, s) then returns True if p accepts s, while p Acc (p, s) returns False if p does not accept s. Only self-haters welcome. Construct a specific program p SHP (SHP for Self-Hating Programs) that operates as follows on input p, where p is any program: 1. Run p Acc (p, p) to determine, in finite time, if p accepts itself. Feeding p to itself makes sense, becase programs are just strings and are assumed to operate on string inputs. 2. if p Acc (p, p) ends in acceptance, reject p, that is, return False; otherwise, return True. The question now is: will p SHP accept itself, or not? Well, suppose that p SHP accepts itself; then p SHP is not self-hating, so it doesn t accept itself (contradiction). Therefore, it must be the case that p SHP does not accept itself; but then pp SHP is self-hating and accepts itself. Neither of these is logically consistent. However, since p Acc is a decider, the construction of p SHP guarantees that p SHP is a decider as well, and the computation p SHP (p SHP ) must end in a clear decision. This contradiction results solely because of the assumption that the decider p Acc exists. It follows that no such decider exists, that is, Acc is not decidable The halting problem Let H be the language over the ASCII alphabet that contains all Python programs that halt after a finite number of steps for all possible values of any input parameters. For example, the function below belongs to H: >>> def computeandstop():... for n in range(100):... print yahoo! but the following function does not belong to H: >>> def computeandmore():... while True:... print your call is very important to us The findpythagoreantriple function described above is trickier to classify. We claim that there is no program that recognizes H. Suppose otherwise. Let p H be a program that takes a program (string) s as its input, such that p H (s) returns True if s H, but p H (s) returns False if s / H. We will show that the assumption of the existence of such a decider p H implies the existence of a decider for the acceptance language, Acc. Since Acc is not decidable, this will prove the undecidability of the halting language, H.

13 Constructing an acceptance decider from a halting decider. Construct a program p A as described below. On input (p, s), where p is a program and s is an input string to s, p A operates as follows: 1. Construct a program p s that halts automatically on all inputs except for s; on input s, p s simply feeds s to p and waits; if p(s) ever halts and returns False, then p s just enters an unending loop; if p(s) halts and returns True, so does p s. Notice that p s halts on all inputs if, and only if, p accepts input s. 2. Feed p s to p H and return whatever value is returned by p H (p s ). By construction, p A is a decider for the acceptance problem, assuming that p H is a decider for the halting problem. Since no decider for the acceptance problem exists, this proves that no decider exists for the halting problem, either.

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

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

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

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

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

ACS2: Decidability Decidability

ACS2: Decidability Decidability Decidability Bernhard Nebel and Christian Becker-Asano 1 Overview An investigation into the solvable/decidable Decidable languages The halting problem (undecidable) 2 Decidable problems? Acceptance problem

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

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

Most General computer?

Most General computer? Turing Machines Most General computer? DFAs are simple model of computation. Accept only the regular languages. Is there a kind of computer that can accept any language, or compute any function? Recall

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

CSCI3390-Lecture 6: An Undecidable Problem

CSCI3390-Lecture 6: An Undecidable Problem CSCI3390-Lecture 6: An Undecidable Problem September 21, 2018 1 Summary The language L T M recognized by the universal Turing machine is not decidable. Thus there is no algorithm that determines, yes or

More information

TURING MAHINES

TURING MAHINES 15-453 TURING MAHINES TURING MACHINE FINITE STATE q 10 CONTROL AI N P U T INFINITE TAPE read write move 0 0, R, R q accept, R q reject 0 0, R 0 0, R, L read write move 0 0, R, R q accept, R 0 0, R 0 0,

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

The Church-Turing Thesis

The Church-Turing Thesis The Church-Turing Thesis 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

4.2 The Halting Problem

4.2 The Halting Problem 172 4.2 The Halting Problem The technique of diagonalization was discovered in 1873 by Georg Cantor who was concerned with the problem of measuring the sizes of infinite sets For finite sets we can simply

More information

Decidable Languages - relationship with other classes.

Decidable Languages - relationship with other classes. CSE2001, Fall 2006 1 Last time we saw some examples of decidable languages (or, solvable problems). Today we will start by looking at the relationship between the decidable languages, and the regular and

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION FORMAL LANGUAGES, AUTOMATA AND COMPUTATION DECIDABILITY ( LECTURE 15) SLIDES FOR 15-453 SPRING 2011 1 / 34 TURING MACHINES-SYNOPSIS The most general model of computation Computations of a TM are described

More information

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

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 Lecture Notes. Problems and Algorithms. Class Information

Theory of Computation Lecture Notes. Problems and Algorithms. Class Information Theory of Computation Lecture Notes Prof. Yuh-Dauh Lyuu Dept. Computer Science & Information Engineering and Department of Finance National Taiwan University Problems and Algorithms c 2004 Prof. Yuh-Dauh

More information

Theory of Computation p.1/?? Theory of Computation p.2/?? We develop examples of languages that are decidable

Theory of Computation p.1/?? Theory of Computation p.2/?? We develop examples of languages that are decidable Decidable Languages We use languages to represent various computational problems because we have a terminology for dealing with languages Definition: A language is decidable if there is an algorithm (i.e.

More information

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

ECS 120 Lesson 18 Decidable Problems, the Halting Problem ECS 120 Lesson 18 Decidable Problems, the Halting Problem Oliver Kreylos Friday, May 11th, 2001 In the last lecture, we had a look at a problem that we claimed was not solvable by an algorithm the problem

More information

Large Numbers, Busy Beavers, Noncomputability and Incompleteness

Large Numbers, Busy Beavers, Noncomputability and Incompleteness Large Numbers, Busy Beavers, Noncomputability and Incompleteness Food For Thought November 1, 2007 Sam Buss Department of Mathematics U.C. San Diego PART I Large Numbers, Busy Beavers, and Undecidability

More information

1 Showing Recognizability

1 Showing Recognizability CSCC63 Worksheet Recognizability and Decidability 1 1 Showing Recognizability 1.1 An Example - take 1 Let Σ be an alphabet. L = { M M is a T M and L(M) }, i.e., that M accepts some string from Σ. Prove

More information

Languages, regular languages, finite automata

Languages, regular languages, finite automata 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,

More information

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch] Undecidability Andreas Klappenecker [based on slides by Prof. Welch] 1 Sources Theory of Computing, A Gentle Introduction, by E. Kinber and C. Smith, Prentice-Hall, 2001 Automata Theory, Languages and

More information

Computability Theory. CS215, Lecture 6,

Computability Theory. CS215, Lecture 6, Computability Theory CS215, Lecture 6, 2000 1 The Birth of Turing Machines At the end of the 19th century, Gottlob Frege conjectured that mathematics could be built from fundamental logic In 1900 David

More information

The Turing machine model of computation

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

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

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

The Power of One-State Turing Machines

The Power of One-State Turing Machines The Power of One-State Turing Machines Marzio De Biasi Jan 15, 2018 Abstract At first glance, one state Turing machines are very weak: the Halting problem for them is decidable, and, without memory, they

More information

Advanced Undecidability Proofs

Advanced Undecidability Proofs 17 Advanced Undecidability Proofs In this chapter, we will discuss Rice s Theorem in Section 17.1, and the computational history method in Section 17.3. As discussed in Chapter 16, these are two additional

More information

CS4026 Formal Models of Computation

CS4026 Formal Models of Computation CS4026 Formal Models of Computation Turing Machines Turing Machines Abstract but accurate model of computers Proposed by Alan Turing in 1936 There weren t computers back then! Turing s motivation: find

More information

16.1 Countability. CS125 Lecture 16 Fall 2014

16.1 Countability. CS125 Lecture 16 Fall 2014 CS125 Lecture 16 Fall 2014 16.1 Countability Proving the non-existence of algorithms for computational problems can be very difficult. Indeed, we do not know how to prove P NP. So a natural question is

More information

Lecture notes on Turing machines

Lecture notes on Turing machines Lecture notes on Turing machines Ivano Ciardelli 1 Introduction Turing machines, introduced by Alan Turing in 1936, are one of the earliest and perhaps the best known model of computation. The importance

More information

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 27

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 27 CS 70 Discrete Mathematics for CS Spring 007 Luca Trevisan Lecture 7 Infinity and Countability Consider a function f that maps elements of a set A (called the domain of f ) to elements of set B (called

More information

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite The Church-Turing Thesis CS60001: Foundations of Computing Science Professor, Dept. of Computer Sc. & Engg., Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q 0, q accept, q reject ), where

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

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

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

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY No part of this publication may be reproduced or distributed in any form or any means, electronic, mechanical, photocopying, or otherwise without the prior permission of the author. GATE SOLVED PAPER Computer

More information

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever.   ETH Zürich (D-ITET) October, Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) October, 19 2017 Part 5 out of 5 Last week was all about Context-Free Languages Context-Free

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

CS3719 Theory of Computation and Algorithms

CS3719 Theory of Computation and Algorithms CS3719 Theory of Computation and Algorithms Any mechanically (automatically) discretely computation of problem solving contains at least three components: - problem description - computational tool - analysis

More information

Turing Machines. 22c:135 Theory of Computation. Tape of a Turing Machine (TM) TM versus FA, PDA

Turing Machines. 22c:135 Theory of Computation. Tape of a Turing Machine (TM) TM versus FA, PDA Turing Machines A Turing machine is similar to a finite automaton with supply of unlimited memory. A Turing machine can do everything that any computing device can do. There exist problems that even a

More information

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine) CS537 Theory of Computation Lecture : Computability Theory I (Turing Machine) Objectives Introduce the Turing Machine (TM) Proposed by Alan Turing in 936 finite-state control + infinitely long tape A stronger

More information

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta CSE 2001: Introduction to Theory of Computation Fall 2013 Suprakash Datta datta@cse.yorku.ca Office: CSEB 3043 Phone: 416-736-2100 ext 77875 Course page: http://www.cse.yorku.ca/course/2001 11/7/2013 CSE

More information

The Turing Machine. Computability. The Church-Turing Thesis (1936) Theory Hall of Fame. Theory Hall of Fame. Undecidability

The Turing Machine. Computability. The Church-Turing Thesis (1936) Theory Hall of Fame. Theory Hall of Fame. Undecidability The Turing Machine Computability Motivating idea Build a theoretical a human computer Likened to a human with a paper and pencil that can solve problems in an algorithmic way The theoretical provides a

More information

CS20a: Turing Machines (Oct 29, 2002)

CS20a: Turing Machines (Oct 29, 2002) CS20a: Turing Machines (Oct 29, 2002) So far: DFA = regular languages PDA = context-free languages Today: Computability 1 Handicapped machines DFA limitations Tape head moves only one direction 2-way DFA

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 13 CHAPTER 4 TURING MACHINES 1. The definition of Turing machine 2. Computing with Turing machines 3. Extensions of Turing

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

Turing Machine Variants

Turing Machine Variants CS311 Computational Structures Turing Machine Variants Lecture 12 Andrew Black Andrew Tolmach 1 The Church-Turing Thesis The problems that can be decided by an algorithm are exactly those that can be decided

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

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

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total UVa - cs302: Theory of Computation Spring 2008 Final Exam Comments < 50 50 59 60 69 70 79 80 89 90 94 95-102 Total 2 6 8 22 16 16 12 Problem 1: Short Answers. (20) For each question, provide a correct,

More information

1 Definition of a Turing machine

1 Definition of a Turing machine Introduction to Algorithms Notes on Turing Machines CS 4820, Spring 2017 April 10 24, 2017 1 Definition of a Turing machine Turing machines are an abstract model of computation. They provide a precise,

More information

CS6901: review of Theory of Computation and Algorithms

CS6901: review of Theory of Computation and Algorithms CS6901: review of Theory of Computation and Algorithms Any mechanically (automatically) discretely computation of problem solving contains at least three components: - problem description - computational

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 15 Ana Bove May 17th 2018 Recap: Context-free Languages Chomsky hierarchy: Regular languages are also context-free; Pumping lemma

More information

CS20a: Turing Machines (Oct 29, 2002)

CS20a: Turing Machines (Oct 29, 2002) CS20a: Turing Machines (Oct 29, 2002) So far: DFA = regular languages PDA = context-free languages Today: Computability 1 Church s thesis The computable functions are the same as the partial recursive

More information

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY RYAN DOUGHERTY If we want to talk about a program running on a real computer, consider the following: when a program reads an instruction,

More information

ECS 120 Lesson 15 Turing Machines, Pt. 1

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

Computational Models Lecture 8 1

Computational Models Lecture 8 1 Computational Models Lecture 8 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. May 11/13, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Theory of Computation

Theory of Computation Thomas Zeugmann Hokkaido University Laboratory for Algorithmics http://www-alg.ist.hokudai.ac.jp/ thomas/toc/ Lecture 12: Turing Machines Turing Machines I After having dealt with partial recursive functions,

More information

The tape of M. Figure 3: Simulation of a Turing machine with doubly infinite tape

The tape of M. Figure 3: Simulation of a Turing machine with doubly infinite tape UG3 Computability and Intractability (2009-2010): Note 4 4. Bells and whistles. In defining a formal model of computation we inevitably make a number of essentially arbitrary design decisions. These decisions

More information

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS 1. [6 POINTS] For language L 1 = {0 n 1 m n, m 1, m n}, which string is in L 1? ANSWER: 0001111 is in L 1 (with n =

More information

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages COMP/MATH 300 Topics for Spring 2017 June 5, 2017 Review and Regular Languages Exam I I. Introductory and review information from Chapter 0 II. Problems and Languages A. Computable problems can be expressed

More information

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS 1. Cardinal number of a set The cardinal number (or simply cardinal) of a set is a generalization of the concept of the number of elements

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ Today's learning goals Sipser Ch 3 Trace the computation of a Turing machine using its transition function and configurations.

More information

Variants of Turing Machine (intro)

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

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

Non-emptiness Testing for TMs

Non-emptiness Testing for TMs 180 5. Reducibility The proof of unsolvability of the halting problem is an example of a reduction: a way of converting problem A to problem B in such a way that a solution to problem B can be used to

More information

Opleiding Informatica

Opleiding Informatica Opleiding Informatica Tape-quantifying Turing machines in the arithmetical hierarchy Simon Heijungs Supervisors: H.J. Hoogeboom & R. van Vliet BACHELOR THESIS Leiden Institute of Advanced Computer Science

More information

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine) CS537 Theory of Computation Lecture : Computability Theory I (Turing Machine) Objectives Introduce the Turing Machine (TM)? Proposed by Alan Turing in 936 finite-state control + infinitely long tape A

More information

CS 361 Meeting 26 11/10/17

CS 361 Meeting 26 11/10/17 CS 361 Meeting 26 11/10/17 1. Homework 8 due Announcements A Recognizable, but Undecidable Language 1. Last class, I presented a brief, somewhat inscrutable proof that the language A BT M = { M w M is

More information

Decidability. William Chan

Decidability. William Chan Decidability William Chan Preface : In 1928, David Hilbert gave a challenge known as the Entscheidungsproblem, which is German for Decision Problem. Hilbert s problem asked for some purely mechanical procedure

More information

Turing Machine Recap

Turing Machine Recap Turing Machine Recap DFA with (infinite) tape. One move: read, write, move, change state. High-level Points Church-Turing thesis: TMs are the most general computing devices. So far no counter example Every

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

Theory of Computation Lecture Notes

Theory of Computation Lecture Notes Theory of Computation Lecture Notes Prof. Yuh-Dauh Lyuu Dept. Computer Science & Information Engineering and Department of Finance National Taiwan University c 2008 Prof. Yuh-Dauh Lyuu, National Taiwan

More information

Computational Models Lecture 7, Spring 2009

Computational Models Lecture 7, Spring 2009 Computational Models Lecture 7, Spring 2009 The Church-Turing Thesis The language classes R = RE core David Hilbert s Tenth Problem Encoding of TMs Universal Turing Machines The Halting/Acceptance problem

More information

CSCI3390-Assignment 2 Solutions

CSCI3390-Assignment 2 Solutions CSCI3390-Assignment 2 Solutions due February 3, 2016 1 TMs for Deciding Languages Write the specification of a Turing machine recognizing one of the following three languages. Do one of these problems.

More information

UNIT-VIII COMPUTABILITY THEORY

UNIT-VIII COMPUTABILITY THEORY CONTEXT SENSITIVE LANGUAGE UNIT-VIII COMPUTABILITY THEORY A Context Sensitive Grammar is a 4-tuple, G = (N, Σ P, S) where: N Set of non terminal symbols Σ Set of terminal symbols S Start symbol of the

More information

Computational Models Lecture 8 1

Computational Models Lecture 8 1 Computational Models Lecture 8 1 Handout Mode Nachum Dershowitz & Yishay Mansour. Tel Aviv University. May 17 22, 2017 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

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

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

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

Undecidability. We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb)

Undecidability. We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb) We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb) CS /55 Theory of Computation The is A TM = { M,w M is a TM and w L(M)} A TM is Turing-recognizable. Proof Sketch:

More information

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis Harry Lewis October 22, 2013 Reading: Sipser, 3.2, 3.3. The Basic Turing Machine The Basic Turing Machine a a b a

More information

Recap (1) 1. Automata, grammars and other formalisms can be considered as mechanical devices to solve mathematical problems

Recap (1) 1. Automata, grammars and other formalisms can be considered as mechanical devices to solve mathematical problems Computability 1 Recap (1) 1. Automata, grammars and other formalisms can be considered as mechanical devices to solve mathematical problems Mathematical problems are often the formalization of some practical

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

V Honors Theory of Computation

V Honors Theory of Computation V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant

More information

Chapter 20. Countability The rationals and the reals. This chapter covers infinite sets and countability.

Chapter 20. Countability The rationals and the reals. This chapter covers infinite sets and countability. Chapter 20 Countability This chapter covers infinite sets and countability. 20.1 The rationals and the reals You re familiar with three basic sets of numbers: the integers, the rationals, and the reals.

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

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

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics. Section 2.1 Introduction Sets are one of the basic building blocks for the types of objects considered in discrete mathematics. Important for counting. Programming languages have set operations. Set theory

More information

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

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

Section Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence

Section Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence Section 2.4 1 Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations 2 Introduction Sequences are ordered lists of

More information

Computational Models Lecture 8 1

Computational Models Lecture 8 1 Computational Models Lecture 8 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. April 18/ May 2, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Turing Machines (TM) The Turing machine is the ultimate model of computation.

Turing Machines (TM) The Turing machine is the ultimate model of computation. TURING MACHINES Turing Machines (TM) The Turing machine is the ultimate model of computation. Alan Turing (92 954), British mathematician/engineer and one of the most influential scientists of the last

More information

The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational

The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational 1 The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational model. We'll remind you what a Turing machine is --- you

More information

Decidability: Church-Turing Thesis

Decidability: Church-Turing Thesis Decidability: Church-Turing Thesis While there are a countably infinite number of languages that are described by TMs over some alphabet Σ, there are an uncountably infinite number that are not Are there

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