100 likes | 128 Views
Computability and Modeling Computation. What are some really impressive things that computers can do? Land the space shuttle (and other aircraft) from the ground Automatically track the location of a space or land vehicle Beat a grandmaster at chess
E N D
Computability andModeling Computation • What are some really impressive things that computers can do? • Land the space shuttle (and other aircraft) from the ground • Automatically track the location of a space or land vehicle • Beat a grandmaster at chess • Are there any things that computers can't do? • Yes, and these are referred to as “undecidable problems,” “unsolvable problems,” or “non-computable functions.”
Some Difficult Problems • For example, could a computer tell us what the meaning of life is? • Suppose a computer outputs the string "You are born, live your life, and then you die.” • Has that computer given us the meaning of life? • The statement may or may not be true • Doesn't tell one how to live a happy life • Doesn't tell one how to live a successful life • Doesn't tell if there is an afterlife • The program doesn’t arrive at the solution by itself • Point #1: Problems need to be precisely defined, before we can determine if they are solvable.
Some Difficult Problems, Cont. • Similarly, could a computer tell us if there is life after death? • Consider the following two programs – the first simply outputs the string “There is life after death,” and the second simply outputs “There is no life after death.” • Note that one of the two programs answers the question correctly, but which one? Also note that neither justifies or develops its’ own answer. • Point #2: Before we can determine if something can be solved or computed, we have to define what we mean by “compute.”
A Formal Model of Computation:Turing Machines • Before determining what computers are ultimately capable of, one must answer the following questions: • What is computation? • What are “reasonable” steps that can be performed in a computation? • Formally, computation is represented by a mathematical model called a Turing Machine. • Proposed in 1926 by Alan Turing to model “any possible computation” • Church’s hypothesis is that any general and reasonable way to compute, or any type of general purpose computer can be modeled/represented by a Turing machine. • Detailed discussion of Turing machines is beyond the scope of this course. • Other, less computer-like models of computation include recursive function theory and predicate calculus.
A Less Formal Model of Computation: Algorithms • Informally, an algorithm is a finite length sequence of operations, each of which is well-defined and finite. In addition, an algorithm must terminate after a finite number of operations. • Well-defined means it should be clear at each step what is to be done. • “Compare x and y" doesn't say how x any are to be compared • Finite means each step must involve a finite amount of information (i.e., data), which is manipulated to only a finite degree. • Adding 1 to a number is finite • Repeatedly dividing a number by 2 forever is not.
Algorithms, Cont. • Intuitively, a well-defined and finite step could be performed by a person by pencil and paper in a fixed amount of time. • Algorithms can be described by a computer program, flowchart, pseudo-code, or by some other similar method. • Example: • Set x =0 reasonable • Let x = x +1 reasonable • Set y = x/0 unreasonable • Place an arbitrary question in a memory location, wait 2 seconds for the answer, and then process the answer. unreasonable
Problems to be Solved • What kinds of problems are there? • Mathematical problems (simple and complex) • Logical problems • Data processing problems, etc. • Consider just mathematical decision (I.e., yes/no) problems: • Let x be an integer, is x even? • Let x and y be integers, is x<y? • Are there integers x, y and z such that x*2+y = zy?
Unsolvable Problems • Can all mathematical decision problems be solved with algorithms? • Answer: No! (by “solved,” we mean in all cases) • Example of unsolvable problems: • Let P be a program. Does P contain an infinite loop, i.e., will P terminate eventually or loop forever? • Let P be a program, and let x be a variable in P. Is x ever assigned a value when P is executed? • Let P be a program, and let s be a statement in P. Is s ever executed when P is executed?
Problems vs. Computational Steps • In general, problems fall into one of three categories: • Those which are provably solvable • Those which are provable unsolvable • Those whose status is unknown; currently there is no algorithm to solve the problem, but it has not been proven that none exists • Among this last category of problems, there is considerable debate as to their ultimate status, e.g., is there a program that can “understand” a natural language such as English? • Note however, that this is an entirely different question from what constitutes a “reasonable” step in a computation, and on that issue there is no debate. • A “reasonable” step in a computation is well-defined and finite, and can be performed by pencil and paper in a fixed amount of time.
Efficiency vs. Inefficiency • In addition, solvable problems fall into one of three categories: • Solvable problems which have been proven to be solvable efficiently, i.e., solvable in (deterministic) polynomial time. • Solvable problems which have been proven not to be solvable efficiently, i.e., NP-hard or NP-complete (NP stands for Nondeterministic Polynomial). • Solvable problems for which there is no efficient solution, but which have not been proven not be be solvable efficiently.