Ch. 11 Theory of Computation A bare bones programming. Turing machines. Computable functions. A noncomputable function. Complexity and its measure. Problem classification.
11.1 Functions and Their Computation The purpose of this chapter is to investigate the capabilities of computers The process of determining the particular output value that a function assigns to a given input is called computing the function
The study of computable and non_computable function is an important undertaking in computer science. If we discover that the solution to a problem requires the computation of non-computable function,we can conclude that the solution to the problem lies beyond the capability of machines.
Figure 11. 1: An attempt to display the function Figure 11.1: An attempt to display the function that converts measurements in yards into meters
11.2 Turing Machines Today’s computers <=> Turing machines finite memories <=> infinite supply of tape CPU <=> the control unit bit patterns <=> states The significance of Turing machines in theoretical computer science - the computation power of Turing machines is as great as any algorithmic system.
Turing Machines Turing machines - are conceptual devices for studying the power of algorithmic processes. A Turing machine consists of a control unit that can read and write symbols on a tape The machine must be in one of a finite number of states, start/halt states.
Figure 11.2: The components of a Turing machine
Figure 11.3: A Turing machine for incrementing a value
Computing process of “5+1” (1)
Computing process of “5+1” (2)
Computing process of “5+1” (3)
Computing process of “5+1” (4)
The Church-Turing Thesis A function that can be computed by a Turing machine is called Turing Computable Turing Conjecture: Turing computable function is as the same as Computable function The Church-Turing Thesis: The computation power of Turing Machine encompasses that of any algorithmic system .
11.3 Universal Programming Language The purpose is to describe a simple language that is rich enough to allow us to express programs for computing all the computable functions. If one problem cannot be solved using our language ,the reason will not be the fault of our language,but will be that there are not algorithm to solve the problem.
The Bare Bones Language Data description statements - all variables are considered to be of type “bit pattern of any length.” => no need a declarative part. Process description statements - three assignment statements: clear, incr, decr and one control structure: while-end.
Programming in bare bones “move tax to extra” Clear aux; clear extra; while tax not 0 do; incr aux; decr tax; end; while aux not 0 do; incr tax; incr extra; decr aux;
Figure 11.4: A Bare Bones program for computing X Y
Figure 11. 5: A Bare Bones implementation of the Figure 11.5: A Bare Bones implementation of the instruction “copy Today to Tomorrow”
Computable Functions How to measure computing power? Goal: using Turing machines to investigate the power of the bare bones language. Computing the functions is the process of determining an output of a function from its inputs. If one machine is capable of computing more functions than another, the former is considered the more powerful.
Computable Functions Ex. A system in which function outputs are predetermined and recorded in a table. Ex. Finding function outputs would be to describe how to compute the output. Computable - the functions whose output values can be determined algorithmically from their input values. Noncomputable functions!
Computable Functions Turing computable. The Church-Turing thesis. If a computational system is capable of computing all the Turing-computable functions, it is considered to be a universal system. Apply the Church-Turing these to confirm that the bare bones language is a universal programming language.
11.4 A Non-computable Function Computing the Godel number. The halting problem. Halting Problem: a problem of determining whether the bare bones programs are or are not self-terminating.
Figure 11.6: Testing a program for self-termination
Figure 11. 7: Proving the unsolvability of the Figure 11.7: Proving the unsolvability of the halting program (continued)
Figure 11. 7: Proving the unsolvability of the Figure 11.7: Proving the unsolvability of the halting program (continued)
Figure 11.7: Proving the unsolvability of the halting program
11.5 Complexity of Problem Time and storage complexities (Big O). Order of complexity. Polynomial and nonpolynomial problems. NP problems - nondeterministic polynomial problems. NP-complete problems.
Measuring a Problem Complexity Big Theta Notation is used to classify algorithms according to the time required to execute them. Insertion Sort algorithm : in ( n2 ) Sequential Search : in ( n ) Binary Search : in (log n) We use this to classify the complexity of problems
A problem complexity is in (f( n)), where f(n) is some mathematical expression in n,if there is an algorithm for solving this problem whose time complexity is in (f( n)),and no other algorithm for solving the problem has lower time complexity. Big O Notation: if f(n) is some mathematical expression, to say a problem belongs to O(f(n)) means that it has a solution whose time complexity is (f( n)), but it could possibly have a better solution.
Figure 11.8: A procedure MergeLists for merging two lists
Figure 11.9: The merge sort algorithm implemented as a procedure MergeSort
Figure 11. 10: The hierarchy of problems generated Figure 11.10: The hierarchy of problems generated by the merge sort algorithm
Polynomial versus Non-polynomial Problems Polynomial Problem: if the problem is in O(f(n)) ,where the f(n) is ether polynomial itself or bounded by a polynomial. The collection of all polynomial problems are represented by P
Figure 11. 11: Graphs of the mathematical Figure 11.11: Graphs of the mathematical expressions n, lg n, n lg n, and n2
NP problems Pick one of the possible paths, and compute its total distance; If (this distance is not greater than the allowable mileage) then (declare a success) else (declare nothing) Non-deterministic algorithm
A problem that can be solved in polynomial time by a non-deterministic algorithm is called Non-deterministic problem , or NP problem All problems in P are also in NP Are all problems in NP also in P? NP-Complete Problem: problems in NP, polynomial time solution for any one of this problems will provide a polynomial time solution for all problems in NP.
Figure 11.12: A graphic summation of problem classification
11.6 Public key Cryptography
Figure 11.13: Encrypting a bit pattern as a knapsack problem
Figure 11.14: Public key encryption using knapsack problems
Figure 11.15: Constructing a public key encryption system
Roadmap to Computer Science Study Fundamental courses: Physics, Mathematics, and Introduction to Computer Science. Software: 1. Fundamental: Problem Solving and Programming, Data Structure, Algorithm, and Software Engineering. 2. Language: Assembly Language, Programming Language, C, and JAVA.
Roadmap to Computer Science Study 3. Theory: Formal Language and Theory of Computation. 4. System: Operating System, Compiler, Networking, Database, and Multimedia. Hardware: 1. Fundamental: Electronics, Logic Design, Digital System Design, and Computer Architecture.
Roadmap to Computer Science Study 2. System: Microprocessors and VLSI design. Applications: 1. Consumer products. 2. Artificial Intelligence. 3. Networking. 4. Image Processing. 5. Computer Architecture and Compiler.
Roadmap to Computer Science Study 6. VLSI and Computer-Aided Design. 7. Biological (Medical) Computing. 8. Multimedia. 9. Databases. 10. Education. 11. Business and management. 12. And more!!!
See you next time !