3.3 The Definition of Algorithm What types of machines are equivalent to TMs? PDA with 2-stacks (Minsky) finite automaton with a queue (Post) typical instruction-set machine recursive functions (Kleene) lambda calculus (Church) unrestricted grammars programming languages What common feature do all these machines share? Is there a machine that is more powerful than a TM? What's an Algorithm? collection of instructions for carrying out some task If you can describe an algorithm in English, can you write code for it? Can you implement an algorithm in Java that you can't implement in C++? If you can describe an algorithm in English, can you build a TM for it? Can you think of an algorithm that you can't implement on a TM? What can you conclude about the class of describable algorithms? the class of describable algorithms is fixed and independent of the computational model Church-Turing Thesis What's the Church-Turing Thesis? there is an algorithm to solve a problem if and only if there is a TM that solves the problem Which is easier to describe, a TM or an Algorithm? What benefit do you get from the Church-Turing Thesis? to show a problem is solvable you can describe an algorithm knowing that you could build a TM if needed We've come to a turning point. What kinds of problems are computable? What kinds of problems are not computable? What kinds of problems are easy to compute? What kinds of problems are hard to compute? What's a formal definition of a TM? define the states and the transition function What's an implementation-level description of a TM? describe how the TM moves its head and what the TM writes on the tape What's a high-level description of a TM? describe the algorithm What's the right level of detail for describing solutions to problems? the high-level description is sufficient How can you justify this approach? Church-Turing Thesis What are the possible pitfalls? What's the downside? the description may be ambiguous Why use this approach when there is a downside? describing a TM in detail is too time consuming and inefficient How do you show that a problem is computable? How do you show that a problem can be solved? What format and notation will you use to describe a TM? write text in quotes that describes an algorithm the first line describes the input to the machine What does a TM take as input? the input is always a string What output does a TM produce when given an input? accept or reject How do you need to represent a problem to be solved? you need to represent the problem as a set of strings How can you represent a computational problem as a language? How can you give an arbitrary object as input to a TM? you encode objects from the problem domain as strings strings that are in the language are correct answers What notation is used to represent an object encoded as a string? means object O encoded as a string Consider the example problem. Does a directed graph G have a path from node i to node j? Is the problem computable? How do you encode an instance of the problem as a string? print the adjacency list or adjacency matrix as a string problem instance is the graph string plus two node id's Which strings should be in the language that represents the problem? strings that represent graphs that have the specified path What's the language that represents the problem? L = { | G is a directed graph with a path from node i to node j } How do you show the problem is computable? Give a high-level description of a TM that decides L. M = "on input , where G is a graph and i and j are nodes: 1. if nodes i and j are equal, accept 2. create a list of nodes initialized with node i 3. let node s be the last node on the list nondeterministically choose an edge (s,t) from G where node t is not already on the list if no such edge exists, reject 4. if nodes t and j are equal, accept else add node t to the list of nodes and go to step 3"