Lecture 18: Turing Machines

Size: px
Start display at page:

Download "Lecture 18: Turing Machines"

Transcription

1 Lecture 18: Turing Machines

2 Some Languages are not Context-Free At the end of the last section, we used the Pumping Lemma for Context Free Languages to prove that there are languages that are not context free. This means that languages exist for which there is no corresponding push-down automata that recognizes them and there is no context-free grammar (CFG) that generates them. Just as we did when we found non-regular languages, we need to devise a new model of computation with sufficient computational power to recognize and/or generate members of the class (or classes) of languages that are not context free.

3 Introducing the Turing Machine Our new, more powerful model of computation is the Turing Machine (TM). A TM is made up of a finite set of states and transitions called the state control (similar to the state controls in FSA's and PA's), but there are a few differences which we will enumerate here: 1. A TM can write to the input string as well as read from it. We will refer to this I/O string as a symbol tape. 2. The TM has a read/write head that can move in both directions on the tape. 3. The tape is infinite. (Although the input strings were also arbitrarily large in FSA and PA they could not use them as a data store. 4. Special states for accepting or rejecting the input string take effect immediately. That is, we don't necessarily have to wait until we reach the end of the input string in order to make a decision to accept or reject a candidate member.

4 Example Before we give a formal definition of TMs we will look at an example TM in action. Consider the language B={w#w w is in {0,1}*}. In words we say that B is the set of all strings over the alphabet {#,0,1} that is comprised of two identical strings of 0's and 1's separated by a # symbol. Since we do not know the length of the candidate strings we will design our TM to mark a symbol (0 or 1) move to the corresponding position on the other side of the # symbol and verify that the same symbol is in this position. This symbol is then marked and we return to the next symbol in the first string of 0's and 1's. This process is repeated until we consume all the 0's and 1's or until a non-matching symbol is found.

5 Turing Machine Operating on the Symbol Tape

6 Another example Consider a TM that recognizes the language consisting of all strings of 0's whose length is an integer power of 2. A={0 2 n n >=0}. Let's take a look at the state control for this TM. start state reject state accept state transition rule cur_state,new_state,read_symbol,write_symbol,move_dir

7 From the start state we move to state q 2 on the first zero, writing a blank _ in its place and moving the read/write head to the right (R). From q 2 if we encounter a blank _ we accept immediately since the string 0 contains 2 0 =1 zeros. If we encounter another 0 we write an x and move to the right (R). From here we alternate between states q 3 and q 4 replacing every other 0 with an x until we reach a blank _ If we encounter a blank _ while in q 4 we reject immediately since we have encountered an odd number of 0's. If we encounter a blank while in q 3 we have encountered an even number of 0's so we move to state q 5, where we return to the beginning of the input string, replacing the first 0 with an x.

8 Starting over we return to the q 3, q 4 cycle, this time ignoring the x's encountered and replacing every other 0 with an x. This process in repeated until all the 0's are consumed or until an odd number of remaining 0's is encountered. The only number of 0's that can be repeated divided by two until a single 0 remains is an integer power of 2 number of 0's. We have seen two simple examples of TM's. Now it is time to introduce a more complete definition of Turing Machines.

9 Turing Machine a formal definition Formally a Turing Machine (TM) is a 7-tuple (Q,Σ,Γ,δ,q o,q a,q r ), where Q,Σ,Γ are all finite sets and, 1. Q is the set of states. 2. Σ is the input alphabet not containing the special blank symbol _, 3. Γ is the tape alphabet, including _ and Σ is a subset of Γ. 4. δ: QxΓ->QxΓx{L,R} (L and R indicate the direction to move the read/write head). 5. q 0 is in Q and is the start state. 6. q accept or q a is in Q and is the accept state (only one needed). 7. q reject or q r is in Q and is the reject state (only one needed).

10 Turing Machine Behavior A TM receives input w = w 1 w 2...w n (i.e. strings from Σ*) on the leftmost n positions of the tape. Note that the tape is infinite (semi-infinite, actually) and the the remaining positions are filled with blanks. This is important to the computational power of the TM since it gives an unlimited amount of storage space to hold the results of computations. The set of input symbols Σ does not include the blank symbol _ so that the TM can know when it has reached the end of the input string. As the TM computes, its current state changes according to the transition rules. Since the TM can write on the tape, it can store information there as well. Finally the read/write head of the TM can be in any position on the tape. Any of these factors can affect the eventual behavior of the TM so we define the configuration of the TM as its (1) current state, (2) current tape contents and the (3) current read/write head position. These three elements completely define the current configuration of the TM so that, starting from this configuration, the TM will always exhibit the same behavior.

11 Executing a Turing Machine Program In the start configuration, the read/write head of the TM is point to the first symbol on the tape, the input tape is initialized with the input string followed by all blanks and the TM state control is in the start state q 1. In an accepting configuration the current state of the configuration is q accept. configuration the current state is q reject. In a rejecting Accepting and rejecting configuration are halting configurations, which means that the TM stops when entering one of these configurations. A TM accepts input w is a sequence of configurations exists starting at the start state, ending in the accept state and the sequence of configurations are follow valid transitions. The collection of strings accepted by some TM M is said to be the language of M also denoted by L(M).

12 Turing-recognizable & Turing-decidable Definition: A language is Turing-recognizable is some TM recognizes it or accepts it. Definition: A language is Turing-decidable or simply decidable if some TM either accepts it or rejects it. A language is decidable if there exits a TM which eventually halts for every member of the language input to the TM. Every decidable language is Turing-recognizable but not all Turing-recognizable languages are decidable. What does this mean? For one thing, it means that there are languages for which members are accepted by a TM but some non-members may never to rejected by the TM. In other words the TM that recognizes the language may never halt while scanning a non-member of the language. This does not mean that the TM does not halt for every non-member string, but rather that there exists some non-member strings for which the TM does not halt.

13 Building Turing Machines Usually we will employ pseudo code or textual descriptions of TM's as step algorithms rather than explicitly listing the elements of the 7-tuple. Consider the following examples: Example: Describe a TM that recognizes the language L={a i b j c k ixj=k and i,j,k >= 1}. In words L is the set of all strings of over the alphabet {a,b,c} in which a string of a's is followed by a string of b's which is, in turn followed by a string of c's and the number of c's is equal to the product of the numbers of a's and b's. Let M be a TM scanning the string w: 1. Scan w to be sure that it is a member of a*b*c* and reject if it is not. 2. Return the beginning of w. 3. Move back and forth between the b's and the c's marking one of the b's and one of the c's until all of the b's have been marked. If you exhaust the c's before this is accomplished then reject w. 4. Reset all the b's back to their unmarked condition. Check to see if there are any more a's. If not, then check to see if all the c's have been marked. If not reject otherwise accept. If there are more a's then mark one of them and return the the beginning of the string and repeat Step 3. We can see that the computational model of a TM can embody the operations implied by this description.

14 Example: Describe a TM that recognizes a language for which each member is a string of segments of 0's and 1's separated by # symbols and for which no two segments are the same. This is also called the element distinctness problem and is described symbolically as, D={#X 1 #X 2 #...#X n X i is in (0+1)* and X i /=X j for each i/=j} In this example we will include two tape symbols # and _, called marked and unmarked. Let M be a TM scanning the string w: 1. Mark the first symbol in w. If the first symbol is a blank _ then accept. If the first symbol is a #, continue, otherwise reject. 2. Scan right to the next # and mark it. If a blank _ is encountered then accept since there was only one segment of (0+1)*. 3. Scan back and forth comparing corresponding symbols and the two segments being compared. When a non-matching symbol is encountered continue to Step 4. If the ends of two segments being compared is reached this means the two segments are the same and we reject. 4. Unmark the rightmost marked # and mark the next # to the right if one exists and return to Step 3. If the marked # is at the end of the string, unmark the leftmost marked # and mark the next # to the right. If this # is at the end of the string then accept. Else mark the next # and return to Step 3. In this example we are comparing every segment to every other segment which would be an order O(n 2 ) algorithm if implemented on a standard (real) computer.

15 Multitape Turing Machines A multitape Turing machine is the same as a single-tape TM except that it has multiple tapes to read to and write from. One of the tapes holds the input string while the other can be used to hold intermediate values during the TM's computation. Theorem: Every multitape TM has an equivalent single tape TM. This theorem says that we may assume multiple tapes and multiple read/write heads in order to simplify a derivation or a demonstration that a TM recognizes a particular language. Just as with the interchanging of DFA's, NFA's and regular expression's. We can use the TM model that best fits a particular problem and be assured that we are working with the same computation power as is exhibited by a single-tape TM.

16 Nondeterministic Turing Machines A nondeterministic TM is a TM in which the transition function d is replaced with δ:qxγ -> P(QxΓx{L,R}) The computation of a nondeterministic TM is a tree whose branches represent different sequences of valid state transitions through its state control. If all paths terminate then the TM rejects the string being scanned. If one or more of the sequences leads to the accept state the TM accepts. Theorem: For every nondeterministic TM there is an equivalent deterministic TM.

17 Enumerators An enumerator is a TM attached to a printing device. The TM can send strings to the printer to be printed. The purpose of the enumerator is to list or enumerate all the members of a language. An enumerator may generate members of a language in any order and it may repeat some members before all the members of the language are enumerated. Theorem: A language is Turing-recognizable if and only if some enumerator enumerates it.

18 Comparing Turing Machines to Real Computers There are many other models of computation equivalent in computational power to Turing machines. The two essential elements are: 1. Unrestricted access to unlimited memory, and 2. The model of computation can perform a finite amount of work in a single step. How do real-world computers compare to TM's? One major difference is that the program of a TM is hard-wired into the state control while the program of a real-world computer is part of the memory store. That is, the input includes the instructions for execution as well as the string being evaluated. So what do we place into the state control? Rather than hard-wiring the program to recognize a particular language we place the operations required to execute the instructions placed on the tape. The portion of the real-world computer corresponding to the state control is the CPU. The hard-wired component in the CPU perform the FETCH-DECODE-EXECUTE operations on each instruction loaded in a designated location on the tape.

19 Hilbert's 10th Problem In the 3rd century A.D., Diophantus of Alexandria wrote a book on the subject of finding integer or whole number solutions to arithmetic expressions. In the summer of 1900, in a address to the Second International Congress of Mathematicians, David Hilbert introduced a list of 23 major challenges to mathematicians for the future. Some of these problems remain unsolved, others have led to new mathematical theories and one (problem number 10) is at the core of theoretical computer science. Hilbert's 10th problem is stated as: Is there a computer algorithm by which Diophantine equations can be tested to see if any solutions exist? 17th Century Printing of Diophantus' Arithmetica translated into Latin

20 Does an Algorithm Exist for Hilbert's 10th Problem? Of course, at a meeting of mathematicians in 1900, the problem did not directly refer to computers or algorithms. In Hilbert's words the 10th problem is stated: Given a Diophantine equation with any number of unknown quantities and with rational integral numerical coefficients: to devise a process according to which it can be determined by a finite number of operations whether the equation is solvable in rational integers. It's important to note that Hilbert is not asking for a method to find the solutions but rather for a procedure to determine if the equation has integer solutions. This process should be a well-defined formal procedure that could be implemented as a program for a computer and thatwould be guaranteed to work for every Diophantine expression. We refer to such processes as algorithms. Ref: Martin Davis & Reuben Hersh, "Hilbert's 10th Problem." Scientific American Inc.1973.

21 There is nothing special about a Diophantine equation. Actually, the term refers to the admissible solutions. For example, the equation x 2 + y 2-2 = 0 has infinitely many solutions if we do not restrict valid solutions to integers x 2 + y 2 2 = 0 x 2 + y 2 3 = 0 Ref: Martin Davis & Reuben Hersh, "Hilbert's 10th Problem." Scientific American Inc.1973.

22 Fermat's Last Theorem A famous family of Diophantine equations has the form x n + y n = z n where n may equal 2, 3, 4 or any larger integer. If n is equal to 2, the equation is satisfied by the lengths of the sides of any right triangle and is called the Pythagorean theorem. One solution is the set of numbers x=3, y=4, z=5. If n > 2 this equation is known a Fermat's equation. Pierre de Fermat thought he had proved that these equations have no positive whole-number solutions. In the margin of his copy of Diophantus' Arithmetica he wrote that he had found a "marvelous proof" that was unfortunately too long to be written down in that space. He never made the proof public if he actually had one. No correct proof was found for 357 years, until one was finally published by Andrew Wiles in The term "Last Theorem" resulted because all the other theorems and results proposed by Fermat were eventually proved or disproved, either by his own proofs or by those of other mathematicians, in the two centuries following their proposition. Although it is a theorem now that it has been proved, the status of Fermat's Last Theorem before then, in spite of the name, was that of a conjecture, a mathematical statement whose status (true or false) had not been conclusively settled.

23 Wiles and Taylor Prove Fermat's Last Theorem Although Wiles had reviewed his argument beforehand with a Princeton colleague, Nick Katz, he soon discovered that the proof contained a gap. There was an error in a critical portion of the proof which gave a bound for the order of a particular group. Wiles and his former student Richard Taylor spent almost a year trying to repair the proof, under the close scrutiny of the media and the mathematical community. In September 1994, they were able to complete the proof by using a very novel approach in the troublesome part of the argument. Taylor and Wiles's proof is extremely technical in that it relies on the mathematical techniques developed in the twentieth century, most of which would be totally alien to mathematicians who had worked on Fermat's Last Theorem only a century earlier. Fermat's alleged "marvelous proof", on the other hand, would have had to be fairly elementary, given the state of the mathematical knowledge at the time, and so could not have been the same as Wiles's. Most mathematicians and science historians doubt that Fermat had a valid proof of his theorem for all exponents n, as it seems unlikely there is an elementary proof.

24 The Green Light Machine x y x y : : : : x 2 + y 2-2 = 0 x 2 + y 2-3 = x + y 2 = 0 x + y 3 = Ref: Martin Davis & Reuben Hersh, "Hilbert's 10th Problem." Scientific American Inc.1973.

25 The Green Light Red Light Machine AKA - The Hilbert Machine Suppose S stands for a particular subset of integers. S is listable if a green-light machine can be built that will do the following job: Accept any integer as an input, and turn on a green light after a finite number of steps if and only if the input integer belongs to S. For example, Let S = the set of even numbers. S is listable. In this case the machine would divide the input by 2 and turn on a green light if the remainder is 0. The set S is computable if a green light-red light machine can be built to do a more difficult job: Accept any integer as input and, after a finite number of steps, turn on a green light if the integer is in S and a red light if the integer is not in S. The set of even numbers is also computable. x 2 + y 2-2 = 0 n -> S n = Ref: Martin Davis & Reuben Hersh, "Hilbert's 10th Problem." Scientific American Inc.1973.

26 The Computable and the Listable Let S denote the complement of S, that is, the set of all integers that do not belong to S. If in the two examples S is the set of even integers, then S is the set of odd integers. We can prove that if S is computable, S and S are both listable. In other words, If a green light-red light machine exists for S, then there exists a green-light machine for S and a green-light machine for S. To build a green-light machine for S, simply unscrew the red bulb of the green light-red light machine. To build a green-light machine for S, move the green bulb to the socket for the red light. The converse is also true: If S and S are listable then S is computable. That is, if green-light machines exists for S and S, then a green light-red light machine can be built for S. Just take the green light machine for S and replace the green bulb with a red one and then hook the two machine in parallel. x 2 + n y-> 2 -S2 = 0 Ref: Martin Davis & Reuben Hersh, "Hilbert's 10th Problem." Scientific American Inc.1973.

27 Some Sets are Listable but not Computable There is a set K for which there exists a green light machine but for which there is no green light machine for K, the complement of K. Let each green light machine be described in detail in an owner's manual. This manual explains exactly how the machine is constructed and how it operates. Every green light machine has a manual and every manual is numbered M 1, M 2,... and so on. Now we define the set K as the set of numbers n such that the nth machine lights up if it receives n as an input. That is, the number 1 belongs to K iff M 1 lights up when 1 is entered into its input, the number 2 belongs to K iff M 2 lights up when 2 is entered, and so on n->s 1 n->s 2 list of all green machines Ref: Martin Davis & Reuben Hersh, "Hilbert's 10th Problem." Scientific American Inc.1973.

28 Building a Green Light Machine for K Our green light machine for K is built in the following manner: We build a new green light machine modified to accept both the value n and the manual for the nth green light machine. This new green light machine reads the manual and reconfigures itself to produce the same result as the nth green light machine. list of all green machine manuals For example we check to see if 3,781 is a member of the set K. We load the manual M 3,781, the value 3,781 and turn the crank. If green light machine number 3,781 accepts 3,781 then 3,781 is a member of the set K. n->s M 3,781 Ref: Martin Davis & Reuben Hersh, "Hilbert's 10th Problem." Scientific American Inc.1973.

29 There is no Green Light Machine for K Imagine that such a machine existed. Since K is the complement of K, this machine would light up for an input say 297, iff M 297 does not light up for 297. Therefore the machine for K is not M 297. Of course this argument holds for any n. So the green machine for K cannot be a member of the list of all green machines, therefore... K is not listable And so, there is no green light-red light machine for K. There can never be a formal procedure (an algorithm or a machine program) for sorting K from K. This is an example of a problem that can never be solved by mechanical means. This is a major theorem of recursive function theory, established in the 1930's.. by Godel, Church, Post, Kleene and Turing. Ref: Martin Davis & Reuben Hersh, "Hilbert's 10th Problem." Scientific American Inc.1973.

30 There is no Green Light Machine for K: Redux For those who are still feeling uncertain about this proof idea. Consider the alternatives. If the green light machine for K exists, then it must be in the list of green light machines somewhere, say position p. If it is a green light machine, its manual will then be Mp. When we input to this green light machine its own manual Mp and the number p, does it light up? By the definition of K, this machine must light up iff p is not a member of the set of numbers that cause the pth green light machine to light...but since this is the pth green light machine and the machine lights, then p is a member of the set defining K and therefore p cannot be a member of K...an apparent contradiction. The Alternatives 1. There is no green light machine for K. - Traditional interpretation of this result. 2. There is no way to write Mp. - Essentially the same argument as We cannot build the modified green light machine for K. - That is, the set S is not well defined. 4. The green light machines are not listable. - There is no one-to-one correspondence between the natural numbers and the set of green light machines

31 Decidability We have learned about a model of computation called a Turing Machine (TM) that can be used to recognize and/or generate wide variety of languages. We also learned that the part of the TM that determines the particular language being recognized can be expressed as an algorithm. Now we will investigate the power of algorithms and their limitations. We will discover that some problems can be well defined but not solved using algorithmic methods or TM's.

32 Decidable Languages and Decidable Problems Just as we learned that there are some languages that are not decidable we will see that there are undecidable problems as well. The relationship between decidable problems and decidable languages is a subtle one. The acceptance problem for DFAs of testing whether a particular finite automaton accepts a given string can be expressed as a language, A DFA. This language contains the encoding of all DFAs together with strings that the DFAs accept. In general, let A DFA = { <B,w> B is a DFA that accepts input string w} The problem of telling whether a DFA B accepts an input w is the same as the problem of testing whether <B,w> is a member of the language A DFA.

33 Theorems for Decidable Languages Theorem: ADFA is a decidable language. The proof of this theorem is simple. We only need to describe a TM that decides ADFA. Let M be a TM M. The input to M is <B,w> which includes a description of B followed by the string w. We simulate B on input w and, if the simulation ends in an accept state we accept <B,w> otherwise we reject <B,w>. We can prove a similar theorems for non deterministic finite automata and regular expressions. This is not surprising since NFA's and regular expressions have been shown to be equivalent to DFA's in terms of their computational power. Theorem: ANFA is a decidable language. Theorem: AREX is a decidable language.

34 Emptiness Testing We want to show that the problem of determining if two DFA's recognize the same language is decidable. In order to do this we first need to establish a rather odd theorem called emptiness testing. We need to show that a TM can test to see if a DFA accepts any strings at all. That is we want to prove that E DFA = {<A> A is a DFA and L(A)=φ} To accomplish this we define a TM T that reads <A> as its input, marks the start state of A and then continues to mark every state that can be reached from a marked state along a valid transition. Once all reachable states are marked, T accepts if an accept state of the DFA is marked, otherwise T rejects. Theorem: E DFA is decidable.

35 Deciding if Two Turing Machines Accept the Same Language Now that we have proved we can decide if a DFA accepts no string, we can show that we can decide if two DFA's accept the same language. We wish to prove that EQ DFA = {<A,B> A and B are DFA's and L(A) = L(B)} Construct a new DFA C from A and B such that C accepts only those strings accepted by A or B but not both. That is, L(C) = (L(A) and ~L(B)) or (~L(A) and L(B)) We now define a TM F that takes <A,B> as its input and builds the DFA C. We now apply the TM for emptiness testing to <C>. If this TM accepts <C> we accept (i.e. conclude that the symmetric difference of L(A) and L(B) is empty), otherwise we reject. Theorem: EQ DFA is a decidable language.

36 Are Context-Free Languages Decidable? Next we want to see if the class of context-free languages is decidable. A CFG = {<G,w> G is a CFG that generates string w}. For CFG G and string w we must test to see if G can generate w. We have to be careful here since we must use a method of derivation that does not result in an infinite number of steps. That is, if w can be generated by G it must be accomplished in a finite number of steps and if w cannot be generated by G we must determine this fact in a finite number of steps. 1. Convert G into an equivalent CNF grammar. 2. List all derivations possible for the number of steps required to derive w.* 3. If any of the derivations generate w, accept, otherwise reject. * How to we determine the number of steps in 2 above and how do we know that this number is finite?

37 The Number of Derivations is Finite Recall that all rules in CNF grammars are of the form A->BC A->a so we can determine the exact number of steps (application of rules) needed to generate any string w where w is made up of n terminal symbols. Starting with A we need to apply n-1 rules of the form A -> BC to obtain n non-terminals, then we apply n rules of the form A -> a to replace the n non terminals with terminals. Therefore the operation in 2 requires us to list all derivations reachable from exactly 2n-1 steps, which completes the proof. Theorem: A CFG is a decidable language.

38 Emptiness Test for CFG's Just as with the regular languages we want to show that we can decide if a particular CFG can generate any strings at all. E CFG = {<G> G is a CFG and L(G)=φ} Since we don't know the length of the strings we would generate, we cannot simply attempt to generate all strings to show that G can generate no strings. We need a way to analyze the grammar directly to determine if any strings can be generated. This is OK since the grammar itself must be finite. Let R be a TM reading <G> as its input where G is a CFG in Chomsky Normal Form (CNF). 1. Mark all terminals symbols in the grammar G. 2. Repeatedly mark every occurrence of any variables that appear on the LHS of any rule in which all symbols (terminals or variables) on the RHS are marked. 3. When no more variables are marked in 2, check to see if the start symbol has been marked. If not accept, otherwise reject.

39 Showing that Two CFG's Generate the Same Language Giddy with our successes, we might attempt to show that, EQ CFG = {<G,H> G and H are CFLs and L(G) = L(H)}. But we would discover that this is not possible. It is rather involved to show a formal proof for this fact but it is related to the fact that context-free grammars are not closed under complementation. That is, if L(G) is a context-free language it is not necessarily true that ~L(G) is also context free. In general, Theorem: EQ CFG is not decidable.

40 Every CFL is Decidable It is straightforward to prove that, Theorem: Every CFL is decidable. Given a CFG G that generates A we need to design a TM M G that decides A. Since we already have a theorem stating that ACFG is a decidable language we can construct a TM that contains a copy of G. This TM reads a string w and performs the following operations, 1. Run the TM that decides ACFG = {<G,w> G is a CFG that generate string w}. 2. If this TM accepts then accept otherwise reject.

41 A Complete (?) Description of Levels of Computation Now we can fill in our computational power diagram for the relationship between the classes of languages. In summary, we have models of computation for regular languages, context-free languages, and a class of context-sensitive languages called decidable. We have found that there are types of languages whose members can be recognized by TM's but some non-members cannot be proved non-members.

42 Halting Problem We are now ready to look at one of the most philosophically important theorems of the theory of computation and formal axiomatic systems in general. This theorem is called the halting problem. Given an computer program and a precise description of what that program is supposed to do, there may not be an automated technique for demonstrating the correctness of the program. We will need to review a number of theorems in preparation for our study of the halting problem. First we will look at A TM, which is the problem of testing whether a TM accepts a given input string. A TM = {<M,w> M is a TM and M accepts w} We note that A TM is Turing-recognizable since we can always devise a TM U that loops on <M,w> whenever M is a TM that loops on w.

43 The Universal Turing Machine We call U the Universal Turing Machine. This machine was first proposed by Alan Turing as a machine that could simulate any other TM using the description of the machine. In fact, Turing's idea of a universal TM was influential in the development of the first stored-program computers.

44 Correspondences & Countable Sets Given two sets A and B and a function f from A to B, we say that f is one-to-one if it never maps different elements in a and b to the same place. That is f(a) /= f(b) whenever a /= b. We say that f is onto if it reaches every element in B from an element in A. That is for every element b in B there is an element a in A such that f(a) = b. We say that A and B are the same size if there is a one-to-one and onto function f : A -> B. A function that is one-to-one and onto is called a correspondence. In a correspondence, every element of A maps to a unique element of B and each element of B has a unique element of A mapping to it. A correspondence gives us a way to pair the element of A with the elements of B. We can devise explicit correspondences between finite sets, but when the sets are infinite we demonstrate a correspondence by establishing an ordering between the two sets that ensures that every member of one set corresponds to a member of the other. We can show a correspondence between the natural numbers N (1,2,3,...) with the positive integers divisible by 7 (7, 14, 21,...) In general we can develop a correspondence between N and any subset of N. Weird... Definition: A set A is said to be countable if either it is finite or it has the same size as N.

45 Levels of Infinity We can find a correspondence between N and the rational numbers Q. As we have seen there are infinite sets that do not correspond to N. These sets are said to be uncountable. Real numbers are an example of an uncountable set. Cantor's Diagonalization Method is used to prove that the real numbers in the range (0.0,1.0) are uncountable. Remember our problem of = ? A method has been suggested to avoid this problem. When choosing the number that is not in the correspondence list, just never select the digits 0 or 9 when constructing the value x that is not in the list.

46 Recall that our concern with diagonalization was in the construction of the correspondence in the first place. We needed to create the list and then use it to construct a value x to prove that the list could not be created. The problem is not whether the value x is in the list but whether proof by contradiction can be used at all in this case. In a proof by contradiction we show that the direct result of accepting the contradictory statement is an impossible result such as A=~A or 0=1, etc. In this case the contradiction is demonstrated by using the result (i.e. the correspondence between N and ( ) (which we believe to be impossible) to infer the existence of another value x which can only exist if it can be constructed from a correspondence that cannot exist. Specifically we may argue that the proof of contradiction may not rely on the construction of an object or the derivation an entity from some other non-existent object or entity. Analogous to the case of 0/0, we can ascribe to the non-existent entity any properties we wish. Given the statement, A Case Against the Axiom of Choice If pigs have wings, then I have a zillion dollars. It is valid to prove that pigs do not have wings by showing that I do not have a zillion dollars. However it is not valid to argue that, with a zillion dollars I could construct a flying swine, and since I have not performed such a construction pigs cannot have not have wings...

47 A TM is Undecidable To prove that A TM is undecidable we first assume that it is decidable (i.e. U exists and decides A TM ) and then obtain a contradiction. Suppose that U is a decider for A TM. This means that U halts and accepts when M accepts w and U halts and rejects when M fails to accept w. We construct another TM D that calls U as a subroutine and does the opposite of U. That is, it accepts when U rejects and rejects when U accepts. Now we run D on its own description D(<M>) accepts if M does not accept <M> D(<M>) rejects is M accepts <M> D(<D>) accepts if D does not accept <D> and D(<D>) rejects is D accepts <D> No matter what D does, it is forced to do the opposite, which is a contradiction. Thus neither TM D or TM U can exist.

48 If a language is Turing-recognizable and its complement is Turing-recognizable then it is said to be co-turing-recognizable. Theorem: A language is decidable if and only if it is both Turing-recognizable and co-turing-recognizable. We have shown (sort of) that ATM is Turing-recognizable but not decidable. From these two results we must conclude that ~ATM is not Turing-recognizable. Otherwise would be decidable. Theorem: ~ATM is not Turing-recognizable Therefore (if you accept the diagonalization proof) there is something else, a class of languages that cannot be recognized at all. There is no universal Turing machine. co-turing-recognizable There are true statements that cannot be proved true. There are statements that can neither be proved true or false. There are correct programs that cannot be proved to be correct. And finally, there are well-defined problems for which no program can be written to solve them.

49 THE END??

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and Computer Language Theory Chapter 4: Decidability 1 Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

More information

Computer Sciences Department

Computer Sciences Department 1 Reference Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER 3 D E C I D A B I L I T Y 4 Objectives 5 Objectives investigate the power of algorithms to solve problems.

More information

Outline. Language Hierarchy

Outline. Language Hierarchy Outline Language Hierarchy Definition of Turing Machine TM Variants and Equivalence Decidability Reducibility Language Hierarchy Regular: finite memory CFG/PDA: infinite memory but in stack space TM: infinite

More information

Decidable Problems. We examine the problems for which there is an algorithm.

Decidable Problems. We examine the problems for which there is an algorithm. Decidable Problems We examine the problems for which there is an algorithm. Decidable Problems A problem asks a yes/no question about some input. The problem is decidable if there is a program that always

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.2, 3.3 Define variants of TMs Enumerators Multi-tape TMs Nondeterministic TMs

More information

Theory of Computation, Homework 3 Sample Solution

Theory of Computation, Homework 3 Sample Solution Theory of Computation, Homework 3 Sample Solution 3.8 b.) The following machine M will do: M = "On input string : 1. Scan the tape and mark the first 1 which has not been marked. If no unmarked 1 is found,

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation CISC 4090 Theory of Computation Turing machines Professor Daniel Leeds dleeds@fordham.edu JMH 332 Alan Turing (1912-1954) Father of Theoretical Computer Science Key figure in Artificial Intelligence Codebreaker

More information

Theory of Languages and Automata

Theory of Languages and Automata Theory of Languages and Automata Chapter 3- The Church-Turing Thesis Sharif University of Technology Turing Machine O Several models of computing devices Finite automata Pushdown automata O Tasks that

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 9 January 26, 2018 Outline Turing Machines and variants multitape TMs nondeterministic TMs Church-Turing Thesis decidable, RE, co-re languages Deciding and Recognizing

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 sec 3.2 Describe several variants of Turing machines and informally explain why they

More information

Material from Recitation 1

Material from Recitation 1 Material from Recitation 1 Darcey Riley Frank Ferraro January 18, 2011 1 Introduction In CSC 280 we will be formalizing computation, i.e. we will be creating precise mathematical models for describing

More information

Recursively Enumerable Languages, Turing Machines, and Decidability

Recursively Enumerable Languages, Turing Machines, and Decidability Recursively Enumerable Languages, Turing Machines, and Decidability 1 Problem Reduction: Basic Concepts and Analogies The concept of problem reduction is simple at a high level. You simply take an algorithm

More information

ECS 120 Lesson 16 Turing Machines, Pt. 2

ECS 120 Lesson 16 Turing Machines, Pt. 2 ECS 120 Lesson 16 Turing Machines, Pt. 2 Oliver Kreylos Friday, May 4th, 2001 In the last lesson, we looked at Turing Machines, their differences to finite state machines and pushdown automata, and their

More information

Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.

Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject. Turing Machines Transducers: A transducer is a finite state machine (FST) whose output is a string and not just accept or reject. Each transition of an FST is labeled with two symbols, one designating

More information

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function TAFL 1 (ECS-403) Unit- V 5.1 Turing Machine 5.2 TM as computer of Integer Function 5.2.1 Simulating Turing Machine by Computer 5.2.2 Simulating Computer by Turing Machine 5.3 Universal Turing Machine 5.4

More information

CT32 COMPUTER NETWORKS DEC 2015

CT32 COMPUTER NETWORKS DEC 2015 Q.2 a. Using the principle of mathematical induction, prove that (10 (2n-1) +1) is divisible by 11 for all n N (8) Let P(n): (10 (2n-1) +1) is divisible by 11 For n = 1, the given expression becomes (10

More information

14.1 Encoding for different models of computation

14.1 Encoding for different models of computation Lecture 14 Decidable languages In the previous lecture we discussed some examples of encoding schemes, through which various objects can be represented by strings over a given alphabet. We will begin this

More information

Theory of Computations Spring 2016 Practice Final Exam Solutions

Theory of Computations Spring 2016 Practice Final Exam Solutions 1 of 8 Theory of Computations Spring 2016 Practice Final Exam Solutions Name: Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try

More information

Variants of Turing Machines

Variants of Turing Machines November 4, 2013 Robustness Robustness Robustness of a mathematical object (such as proof, definition, algorithm, method, etc.) is measured by its invariance to certain changes Robustness Robustness of

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016 Lecture 15 Ana Bove May 23rd 2016 More on Turing machines; Summary of the course. Overview of today s lecture: Recap: PDA, TM Push-down

More information

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar Code No: R05310501 Set No. 1 III B.Tech I Semester Regular Examinations, November 2008 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science & Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE

More information

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman And Introduction to Languages and The by J. C. Martin Basic Mathematical

More information

Theory of Programming Languages COMP360

Theory of Programming Languages COMP360 Theory of Programming Languages COMP360 Sometimes it is the people no one imagines anything of, who do the things that no one can imagine Alan Turing What can be computed? Before people even built computers,

More information

CS402 - Theory of Automata Glossary By

CS402 - Theory of Automata Glossary By CS402 - Theory of Automata Glossary By Acyclic Graph : A directed graph is said to be acyclic if it contains no cycles. Algorithm : A detailed and unambiguous sequence of instructions that describes how

More information

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007. Closure Properties of CFLs; Introducing TMs CS154 Chris Pollett Apr 9, 2007. Outline Closure Properties of Context Free Languages Algorithms for CFLs Introducing Turing Machines Closure Properties of CFL

More information

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG) CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG) Objectives Introduce Pushdown Automaton (PDA) Show that PDA = CFG In terms of descriptive power Pushdown Automaton (PDA) Roughly

More information

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all of

More information

Introduction to Computers & Programming

Introduction to Computers & Programming 16.070 Introduction to Computers & Programming Theory of computation 5: Reducibility, Turing machines Prof. Kristina Lundqvist Dept. of Aero/Astro, MIT States and transition function State control A finite

More information

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : III Year, V Semester Section : CSE - 1 & 2 Subject Code : CS6503 Subject

More information

Ambiguous Grammars and Compactification

Ambiguous Grammars and Compactification Ambiguous Grammars and Compactification Mridul Aanjaneya Stanford University July 17, 2012 Mridul Aanjaneya Automata Theory 1/ 44 Midterm Review Mathematical Induction and Pigeonhole Principle Finite Automata

More information

Equivalence of NTMs and TMs

Equivalence of NTMs and TMs Equivalence of NTMs and TMs What is a Turing Machine? Similar to a finite automaton, but with unlimited and unrestricted memory. It uses an infinitely long tape as its memory which can be read from and

More information

Theory of Computations Spring 2016 Practice Final

Theory of Computations Spring 2016 Practice Final 1 of 6 Theory of Computations Spring 2016 Practice Final 1. True/False questions: For each part, circle either True or False. (23 points: 1 points each) a. A TM can compute anything a desktop PC can, although

More information

I have read and understand all of the instructions below, and I will obey the Academic Honor Code.

I have read and understand all of the instructions below, and I will obey the Academic Honor Code. Midterm Exam CS 341-451: Foundations of Computer Science II Fall 2014, elearning section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all

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/ Today's learning goals Sipser Ch 2, 3.1 State and use the Church-Turing thesis. Describe several variants of Turing

More information

Turing Machine Languages

Turing Machine Languages Turing Machine Languages Based on Chapters 23-24-25 of (Cohen 1997) Introduction A language L over alphabet is called recursively enumerable (r.e.) if there is a Turing Machine T that accepts every word

More information

Final Course Review. Reading: Chapters 1-9

Final Course Review. Reading: Chapters 1-9 Final Course Review Reading: Chapters 1-9 1 Objectives Introduce concepts in automata theory and theory of computation Identify different formal language classes and their relationships Design grammars

More information

Actually talking about Turing machines this time

Actually talking about Turing machines this time Actually talking about Turing machines this time 10/25/17 (Using slides adapted from the book) Administrivia HW due now (Pumping lemma for context-free languages) HW due Friday (Building TMs) Exam 2 out

More information

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems The Turing Machine Unsolvable Problems 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 machine

More information

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? R1 SET - 1 1. a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? 2. a) Design a DFA that accepts the language over = {, 1} of all strings that

More information

Multiple Choice Questions

Multiple Choice Questions Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Formal Language and Automata Theory Subject Code: CS 402 Multiple Choice Questions 1. The basic limitation of an FSM

More information

Reflection in the Chomsky Hierarchy

Reflection in the Chomsky Hierarchy Reflection in the Chomsky Hierarchy Henk Barendregt Venanzio Capretta Dexter Kozen 1 Introduction We investigate which classes of formal languages in the Chomsky hierarchy are reflexive, that is, contain

More information

Problems, Languages, Machines, Computability, Complexity

Problems, Languages, Machines, Computability, Complexity CS311 Computational Structures Problems, Languages, Machines, Computability, Complexity Lecture 1 Andrew P. Black Andrew Tolmach 1 The Geography Game Could you write a computer program to play the geography

More information

05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability.

05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability. 05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability. 1. Turing Machines A Turing machine (TM) consists of (Turing 1936): Alan Turing 1. An unbounded tape. Divided into squares,

More information

Normal Forms for CFG s. Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form

Normal Forms for CFG s. Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form Normal Forms for CFG s Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form 1 Variables That Derive Nothing Consider: S -> AB, A -> aa a, B -> AB Although A derives

More information

CSC-461 Exam #2 April 16, 2014

CSC-461 Exam #2 April 16, 2014 Pledge: On my honor, I pledge that I have not discussed any of the questions on this exam with fellow students, nor will I until after 7 p.m. tonight. Signed: CSC-461 Exam #2 April 16, 2014 Name Time Started:

More information

1. [5 points each] True or False. If the question is currently open, write O or Open.

1. [5 points each] True or False. If the question is currently open, write O or Open. University of Nevada, Las Vegas Computer Science 456/656 Spring 2018 Practice for the Final on May 9, 2018 The entire examination is 775 points. The real final will be much shorter. Name: No books, notes,

More information

UNIT I PART A PART B

UNIT I PART A PART B OXFORD ENGINEERING COLLEGE (NAAC ACCREDITED WITH B GRADE) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS YEAR/SEM: III/V STAFF NAME: Dr. Sangeetha Senthilkumar SUB.CODE: CS6503 SUB.NAME:

More information

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 The entire examination is 925 points. The real final will be much shorter. Name: No books, notes, scratch paper, or calculators. Use pen

More information

Theory Bridge Exam Example Questions Version of June 6, 2008

Theory Bridge Exam Example Questions Version of June 6, 2008 Theory Bridge Exam Example Questions Version of June 6, 2008 This is a collection of sample theory bridge exam questions. This is just to get some idea of the format of the bridge exam and the level of

More information

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table. Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) Note: This question paper contains two parts A and B. Part A is compulsory

More information

Theory of Computation

Theory of Computation Theory of Computation For Computer Science & Information Technology By www.thegateacademy.com Syllabus Syllabus for Theory of Computation Regular Expressions and Finite Automata, Context-Free Grammar s

More information

Turing Machines Part Two

Turing Machines Part Two Turing Machines Part Two Recap from Last Time The Turing Machine A Turing machine consists of three parts: A finite-state control that issues commands, an infinite tape for input and scratch space, and

More information

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets? Diagonalization Cardinalities The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets? We say that a set S has at least as great cardinality as set T, written S T, if

More information

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Theory of Computation Dr. Weiss Extra Practice Exam Solutions Name: of 7 Theory of Computation Dr. Weiss Extra Practice Exam Solutions Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try to be

More information

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C. 219 Lemma J For all languages A, B, C the following hold i. A m A, (reflexive) ii. if A m B and B m C, then A m C, (transitive) iii. if A m B and B is Turing-recognizable, then so is A, and iv. if A m

More information

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur Finite Automata Dr. Nadeem Akhtar Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur PhD Laboratory IRISA-UBS University of South Brittany European University

More information

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack. Other Automata We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack. From all of this information we decide what state

More information

Lecture 1. 1 Notation

Lecture 1. 1 Notation Lecture 1 (The material on mathematical logic is covered in the textbook starting with Chapter 5; however, for the first few lectures, I will be providing some required background topics and will not be

More information

THEORY OF COMPUTATION

THEORY OF COMPUTATION THEORY OF COMPUTATION UNIT-1 INTRODUCTION Overview This chapter begins with an overview of those areas in the theory of computation that are basic foundation of learning TOC. This unit covers the introduction

More information

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions. THREE LECTURES ON BASIC TOPOLOGY PHILIP FOTH 1. Basic notions. Let X be a set. To make a topological space out of X, one must specify a collection T of subsets of X, which are said to be open subsets of

More information

Theory of Computation p.1/?? Theory of Computation p.2/?? A Turing machine can do everything that any computing

Theory of Computation p.1/?? Theory of Computation p.2/?? A Turing machine can do everything that any computing 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

JNTUWORLD. Code No: R

JNTUWORLD. Code No: R Code No: R09220504 R09 SET-1 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five

More information

(Refer Slide Time: 0:19)

(Refer Slide Time: 0:19) Theory of Computation. Professor somenath Biswas. Department of Computer Science & Engineering. Indian Institute of Technology, Kanpur. Lecture-15. Decision Problems for Regular Languages. (Refer Slide

More information

A Characterization of the Chomsky Hierarchy by String Turing Machines

A Characterization of the Chomsky Hierarchy by String Turing Machines A Characterization of the Chomsky Hierarchy by String Turing Machines Hans W. Lang University of Applied Sciences, Flensburg, Germany Abstract A string Turing machine is a variant of a Turing machine designed

More information

Lecture 5: The Halting Problem. Michael Beeson

Lecture 5: The Halting Problem. Michael Beeson Lecture 5: The Halting Problem Michael Beeson Historical situation in 1930 The diagonal method appears to offer a way to extend just about any definition of computable. It appeared in the 1920s that it

More information

t!1; R 0! 1; R q HALT

t!1; R 0! 1; R q HALT CS 181 FINA EXAM SPRING 2014 NAME UCA ID You have 3 hours to complete this exam. You may assume without proof any statement proved in class. (2 pts) 1 Give a simple verbal description of the function f

More information

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: P R O B L E M S Finite Autom ata. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: a) Are a multiple of three in length. b) End with the string

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 11 Ana Bove April 26th 2018 Recap: Regular Languages Decision properties of RL: Is it empty? Does it contain this word? Contains

More information

Lecture T4: Computability

Lecture T4: Computability Puzzle ("Post s Correspondence Problem") Lecture T4: Computability Given a set of cards: N card types (can use as many of each type as possible) Each card has a top string and bottom string Example : N

More information

Universal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued

Universal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued CD5080 AUBER odels of Computation, anguages and Automata ecture 14 älardalen University Content Universal Turing achine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Decidability

More information

Solutions to Homework 10

Solutions to Homework 10 CS/Math 240: Intro to Discrete Math 5/3/20 Instructor: Dieter van Melkebeek Solutions to Homework 0 Problem There were five different languages in Problem 4 of Homework 9. The Language D 0 Recall that

More information

Enumerations and Turing Machines

Enumerations and Turing Machines Enumerations and Turing Machines Mridul Aanjaneya Stanford University August 07, 2012 Mridul Aanjaneya Automata Theory 1/ 35 Finite Sets Intuitively, a finite set is a set for which there is a particular

More information

Does this program exist? Limits of computability. Does this program exist? A helper function. For example, if the string program is

Does this program exist? Limits of computability. Does this program exist? A helper function. For example, if the string program is Does this program exist? For example, if the string program is Limits of computability public void abc(string s) { if( s == "abc" ) { print "Hello world!"; } else { print "Whatever"; }} then test called

More information

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1} CSE 5 Homework 2 Due: Monday October 6, 27 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in

More information

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2 6.045J/18.400J: Automata, omputability and omplexity March 21, 2007 Practice Quiz 2 Prof. Nancy Lynch Elena Grigorescu Please write your name in the upper corner of each page. INFORMATION ABOUT QUIZ 2:

More information

CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia

CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia Gabriel Robins Please start solving these problems immediately, and work in study groups. Please prove

More information

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207 Name: 1 a 20 b 20 c 20 d 20 e 20 f 20 g 20 2 10 3 30 4 12 5 15 Total 207 CS 341 Practice Final Exam 1. Please write neatly. You will lose points if we cannot figure out what you are saying. 2. Whenever

More information

Lecture 2 Finite Automata

Lecture 2 Finite Automata Lecture 2 Finite Automata August 31, 2007 This lecture is intended as a kind of road map to Chapter 1 of the text just the informal examples that I ll present to motivate the ideas. 1 Expressions without

More information

pp Variants of Turing Machines (Sec. 3.2)

pp Variants of Turing Machines (Sec. 3.2) pp. 176-176-182. Variants of Turing Machines (Sec. 3.2) Remember: a language is Turing recognizable if some TM accepts it. Adding features may simplify programmability but DO NOT affect what a TM can compute.

More information

Languages and Automata

Languages and Automata Languages and Automata What are the Big Ideas? Tuesday, August 30, 2011 Reading: Sipser 0.1 CS235 Languages and Automata Department of Computer Science Wellesley College Why Take CS235? 1. It s required

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2018 http://cseweb.ucsd.edu/classes/sp18/cse105-ab/ Today's learning goals Sipser Section 2.2 Define push-down automata informally and formally Trace the computation

More information

Computability via Recursive Functions

Computability via Recursive Functions Computability via Recursive Functions Church s Thesis All effective computational systems are equivalent! To illustrate this point we will present the material from chapter 4 using the partial recursive

More information

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine CS 275 Automata and Formal Language Theory Course Notes Part III: Limits of Computation Chapt. III.3: Turing Machines Anton Setzer http://www.cs.swan.ac.uk/ csetzer/lectures/ automataformallanguage/13/index.html

More information

Learn Smart and Grow with world

Learn Smart and Grow with world Learn Smart and Grow with world All Department Smart Study Materials Available Smartkalvi.com TABLE OF CONTENTS S.No DATE TOPIC PAGE NO. UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation

More information

Computability, Cantor s diagonalization, Russell s Paradox, Gödel s s Incompleteness, Turing Halting Problem.

Computability, Cantor s diagonalization, Russell s Paradox, Gödel s s Incompleteness, Turing Halting Problem. Computability, Cantor s diagonalization, Russell s Paradox, Gödel s s Incompleteness, Turing Halting Problem. Advanced Algorithms By Me Dr. Mustafa Sakalli March, 06, 2012. Incompleteness. Lecture notes

More information

Formal Languages and Automata

Formal Languages and Automata Mobile Computing and Software Engineering p. 1/3 Formal Languages and Automata Chapter 3 Regular languages and Regular Grammars Chuan-Ming Liu cmliu@csie.ntut.edu.tw Department of Computer Science and

More information

CS 125 Section #4 RAMs and TMs 9/27/16

CS 125 Section #4 RAMs and TMs 9/27/16 CS 125 Section #4 RAMs and TMs 9/27/16 1 RAM A word-ram consists of: A fixed set of instructions P 1,..., P q. Allowed instructions are: Modular arithmetic and integer division on registers; the standard

More information

Regular Languages (14 points) Solution: Problem 1 (6 points) Minimize the following automaton M. Show that the resulting DFA is minimal.

Regular Languages (14 points) Solution: Problem 1 (6 points) Minimize the following automaton M. Show that the resulting DFA is minimal. Regular Languages (14 points) Problem 1 (6 points) inimize the following automaton Show that the resulting DFA is minimal. Solution: We apply the State Reduction by Set Partitioning algorithm (särskiljandealgoritmen)

More information

Derivations of a CFG. MACM 300 Formal Languages and Automata. Context-free Grammars. Derivations and parse trees

Derivations of a CFG. MACM 300 Formal Languages and Automata. Context-free Grammars. Derivations and parse trees Derivations of a CFG MACM 300 Formal Languages and Automata Anoop Sarkar http://www.cs.sfu.ca/~anoop strings grow on trees strings grow on Noun strings grow Object strings Verb Object Noun Verb Object

More information

CS 44 Exam #2 February 14, 2001

CS 44 Exam #2 February 14, 2001 CS 44 Exam #2 February 14, 2001 Name Time Started: Time Finished: Each question is equally weighted. You may omit two questions, but you must answer #8, and you can only omit one of #6 or #7. Circle the

More information

Decision Properties for Context-free Languages

Decision Properties for Context-free Languages Previously: Decision Properties for Context-free Languages CMPU 240 Language Theory and Computation Fall 2018 Context-free languages Pumping Lemma for CFLs Closure properties for CFLs Today: Assignment

More information

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA TABLE OF CONTENTS SNo DATE TOPIC PAGE NO UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation Techniques 3 3 Finite State systems 4 4 Basic Definitions 6 5 Finite Automaton 7 6 DFA NDFA

More information

2.8 Universal Turing Machines and the Halting Problem

2.8 Universal Turing Machines and the Halting Problem 2.8 Universal Turing Machines and the Halting Problem Through the hierarchy of Slide 74 we indirectly get a sense that Turing Machines are at least as computationally powerful as any other known model

More information

CS 531: Notes II. January 31, 2014

CS 531: Notes II. January 31, 2014 CS 531: Notes II January 31, 2014 1 Acceptable and Decidable Languages Let P be a program and x be a string. What happens when we run P on on input x. There are there possibilities. i) The program runs

More information

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions)

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions) By the end of this course, students should CIS 1.5 Course Objectives a. Understand the concept of a program (i.e., a computer following a series of instructions) b. Understand the concept of a variable

More information

Cantor s Diagonal Argument for Different Levels of Infinity

Cantor s Diagonal Argument for Different Levels of Infinity JANUARY 2015 1 Cantor s Diagonal Argument for Different Levels of Infinity Michael J. Neely University of Southern California http://www-bcf.usc.edu/ mjneely Abstract These notes develop the classic Cantor

More information

Automata & languages. A primer on the Theory of Computation. The imitation game (2014) Benedict Cumberbatch Alan Turing ( ) Laurent Vanbever

Automata & languages. A primer on the Theory of Computation. The imitation game (2014) Benedict Cumberbatch Alan Turing ( ) Laurent Vanbever Automata & languages A primer on the Theory of Computation The imitation game (24) Benedict Cumberbatch Alan Turing (92-954) Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) September, 2 27 Brief CV

More information

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS JOSHUA LENERS Abstract. An algorithm is function from ω to ω defined by a finite set of instructions to transform a given input x to the desired output

More information

Chapter 3. Set Theory. 3.1 What is a Set?

Chapter 3. Set Theory. 3.1 What is a Set? Chapter 3 Set Theory 3.1 What is a Set? A set is a well-defined collection of objects called elements or members of the set. Here, well-defined means accurately and unambiguously stated or described. Any

More information

CpSc 421 Final Solutions

CpSc 421 Final Solutions CpSc 421 Final Solutions Do any eight of the ten problems below. If you attempt more than eight problems, please indicate which ones to grade (otherwise we will make a random choice). This allows you to

More information