1 / 25

Chapter 12 Theory of Computation

Chapter 12 Theory of Computation. Introduction to CS 1 st Semester, 2014 Sanghyun Park. Outline. Functions and Their Computation Turing Machines Universal Programming Languages A Noncomputable Function Complexity of Problems. Functions and Their Computation.

elwyn
Télécharger la présentation

Chapter 12 Theory of Computation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 12Theory of Computation Introduction to CS 1st Semester, 2014 Sanghyun Park

  2. Outline • Functions and Their Computation • Turing Machines • Universal Programming Languages • A Noncomputable Function • Complexity of Problems

  3. Functions and Their Computation • A function is a ______________ between a collection of possible input values and a collection of output values • The process of determining the particular output value that a function assigns to a given input is called _________ the function • Our question is whether we can always find a systemfor computing functions, regardless of their _________ • The answer is ___

  4. Computable vs. Noncomputable Functions • There are functions that are so _______ that there is no well-defined, step-by-step process for determining their outputs based on their input values; these functions are said to be _____________ • The functions whose output values can be determined algorithmically from their input values are said to be ___________ • The study of computable and noncomputable functionsis an important undertaking in computer science

  5. Turing Machines • In an effort to understand the ________ of machines, the Turing machine was proposed by Alan M. Turing in 1936 • A Turing machine consists of a ______ unit that can read and write symbols on a tape • The tape extends indefinitely at both ends and is divided into ____, each of which can contain a symbol • At any time during a Turning machine’s computation,the machine must be in one of a finite number of ______

  6. Turing Machine’s Computation • A Turing machine’s computation consists of a sequence of steps that are executed by the control unit • Each step consists of • _________ the symbol in the current tape cell • _______ a symbol in that cell • Possibly _______ the read/write head one cell to the left or right • ________ states • The exact action to be performed is determined by a program that tells the control unit what to do based on the machine’s _____ and the ______ of the current tape ____

  7. A Turing Machine forIncrementing a Value

  8. * 1 0 1 * Machine State = START CurrentPosition * 1 0 1 * Machine State = ADD CurrentPosition * 1 0 0 * Machine State = CARRY CurrentPosition A Turing Machine Example (1/2)

  9. * 1 1 0 * Machine State = RETURN CurrentPosition * 1 1 0 * Machine State = RETURN CurrentPosition * 1 1 0 * Machine State = HALT CurrentPosition A Turing Machine Example (2/2)

  10. The Church-Turing Thesis (1/2) • The Turing machine in the preceding example can be used to compute the __________ function • A function that can be computed in this manner by a Turing machine is said to be ______ computable • Turing’s conjecture was that the Turing-computable functions were the same as the __________ functions;this conjecture is referred to as the Church-Turing thesis

  11. The Church-Turing Thesis (2/2) • Today this thesis is widely ________; that is,the computable functions and the Turing-computable functions are considered ____ and the same • If a computational system can compute all the Turing-computable functions, it is considered to be as ________ as any computational system can be

  12. Universal Programming Language • Most features in today’s high-level languages merely enhance ___________ rather than contribute to the fundamental _____ of the language • Our approach here is to describe a simple imperative programming language powerful enough to express programs for computing all the computable functions • A programming language with this power is called a _________ programming language • The language we present is quite simple; we call it Bare Bones in that it isolates a _______ set of requirements of a universal programming language

  13. assignment loop structure The Bare Bones Languages • All variables are considered to be of type “___ pattern of arbitrary length” • Variable names must begin with a letter, which can be followed by any combination of letters and digits • Contains three assignment statements and one loop structure • _____name; • _____name; • _____name; • whilename not 0 do;..end;

  14. Programming in Bare Bones A Bare Bones programfor “copy Today to Tomorrow” A Bare Bones programfor computing X * Y

  15. The Universality of Bare Bones • Researchers have shown that the Bare Bones language can be used to express algorithms for computing ___ the Turing-computable functions • That is, any computable function can be computed by a program written in Bare Bones • Thus Bare Bones is a ________ programming language; if an algorithm exists for solving a problem, then that problem can be solved by some Bare Bones program • Bare Bones could ___________ serve as a general-purpose programming language

  16. Halting Problem • The ______ problem is the problem of trying to predict in advance whether a program will _________ if started under certain conditions • Consider the simple Bare Bones programIf the initial value of X is __, then the program will halt;otherwise, the loop will be executed forever • It is easy in the above example to predict a program’s behavior; however, this task may be more complicatedor even impossible in some cases while X not 0 do; incr X; end;

  17. Self-Reference • Whether a program ultimately halts can depend on the ______ values of its variables • We assign a program’s variables an initial value representing the _______ itself; that is, we assign the _________ version of a program as the value of its variables

  18. Self-Termination • A Bare Bones program is self-terminating if its execution terminates when started with _____ as its input • The ______ problem is now precisely described as the problem of determining whether Bare Bones programs are or are not self-terminating • There is ___ algorithm for answering this question in general; thus, the solution to the halting problem lies _______ the capabilities of computers

  19. Unsolvability of the Halting Problem (1/3)

  20. Unsolvability of the Halting Problem (2/3)

  21. Unsolvability of the Halting Problem (3/3) Therefore, the halting problem is __________

  22. Complexity of Problems (1/2) • We are interested in the question of whether a solvable problem has a ________ solution • The complexity of a problem is determined by the properties of the algorithms that solve that problem • More precisely, the complexity of the _______ algorithm for solving a problem is considered to be the complexity of the problem itself • We measure an algorithm’s complexity in terms of the time required for its execution, which is proportional to the number of ______ that must be performed

  23. Complexity of Problems (2/2) • The complexity of a problem is Θ(f(n)) if there is an algorithm with complexity of Θ(f(n)) for solving the problem and no other algorithm has a _____ complexity • Finding the best solution to a problem and knowing that it is the best is often a difficult problem itself;in such situations, big O notation is used • The complexity of a problem is O(f(n)) if it has a solution whose complexity is Θ(f(n)) but it could possibly have a ______ solution

  24. Polynomial vs. Nonpolynomial Problems • “g(n) is bounded by f(n)” means that the graph of f(n) will be _______ the graph of g(n) for “large” values of n • A problem is a polynomial problem if the problem is in O(f(n)), where the expression f(n) is either a polynomial itself or bounded by a polynomial • The collection of all polynomial problems is denoted by P • Problems that are outside the class P are characterized as having extremely _____ execution times • Identifying the problems that belong to P is of major importance in computer science because it tells whether problems have _________ solutions

  25. NP Problems • A problem that can be solved in polynomial time by a _______________ algorithm is called a nondeterministic polynomial problem, or an NP problem • It is customary to denote the class of NP problems by NP • All the problems in P are also in NP;However, whether all the NP problems are also in P isan _____ question

More Related