1 / 88

Theory of Computation

Theory of Computation. Computation. Computation is a general term for any type of information processing that can be represented as an algorithm precisely (mathematically). Computation.

Download Presentation

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. Theory of Computation

  2. Computation • Computation is a general term for any type of information processing that can be represented as an algorithm precisely (mathematically).

  3. Computation • Computation is a general term for any type of information processing that can be represented as an algorithm precisely (mathematically). Examples: • Adding two numbers in our brains, on a piece of paper or using a calculator.

  4. Computation • Computation is a general term for any type of information processing that can be represented as an algorithm precisely. (mathematically) Examples: • Adding two numbers in our brains, on a piece of paper or using a calculator. • Converting a decimal number to its binary presentation or vise versa.

  5. Computation • Computation is a general term for any type of information processing that can be represented as an algorithm precisely (mathematically). Examples: • Adding two numbers in our brains, on a piece of paper or using a calculator. • Converting a decimal number to its binary presentation or vise versa. • Finding the greatest common divisors of two numbers. • …

  6. Theory of Computation • A very fundamental and traditional branch of Theory of Computation seeks:

  7. Theory of Computation • A very fundamental and traditional branch of Theory of Computation seeks: • A more tangible definition for the intuitive notion of algorithm which results in a more concrete definition for computation.

  8. Theory of Computation • A very fundamental and traditional branch of Theory of Computation seeks: • A more tangible definition for the intuitive notion of algorithm which results in a more concrete definition for computation. • Finding the boundaries (limitations) of computation.

  9. Algorithm • A finite sequence of simple instructions that is guaranteed to halt in a finite amount of time.

  10. Algorithm • A finite sequence of simple instructions that is guaranteed to halt in a finite amount of time. • This is a very abstract definition, since: • We didn’t specify the nature of this simple instructions. • For example an instruction can be “increment a number by one” or “Calculate the triple integral”

  11. Algorithm • A finite sequence of simple instructions that is guaranteed to halt in a finite amount of time. • This is a very abstract definition, since: • We didn’t specify the nature of this simple instructions. • For example an instruction can be “increment a number by one” or “Calculate the triple integral” • We didn’t specify the entity which can execute these instructions.

  12. Algorithm • A finite sequence of simple instructions that is guaranteed to halt in a finite amount of time. • This is a very abstract definition, since: • We didn’t specify the nature of this simple instructions. • For example an instruction can be “increment a number by one” or “Calculate the triple integral” • We didn’t specify the entity which can execute these instructions. • For example is this entity a person, a computer, … • If it is a computer what is the processor type? How much memory does it have? …. ?

  13. An Abstract Machine • To make a more solid definition of algorithm we need to define an abstract (general) machine which can perform any algorithm that can be executed by any computer.

  14. An Abstract Machine • To make a more solid definition of algorithm we need to define an abstract (general) machine which can perform any algorithm that can be executed by any computer. • Then, We need to show that indeed this machine can run any algorithm that can be executed by any other computer. Then,

  15. An Abstract Machine • To make a more solid definition of algorithm we need to define an abstract (general) machine which can perform any algorithm that can be executed by any computer. • Then, We need to show that indeed this machine can run any algorithm that can be executed by any other computer. Then, • We can associate the notion of algorithm with this abstract machine. • We can study this machine to find the limitations of computations. (Problems with no computation available to solve.)

  16. Turing Machine • A conceptual model for general purpose computers proposed by Alan Turing in 1936.

  17. Turing Machine • A conceptual model for general purpose computers proposed by Alan Turing in 1936. • A Turing machine has an unlimited and unrestricted amount of memory.

  18. Turing Machine • A conceptual model for general purpose computers proposed by Alan Turing in 1936. • A Turing machine has an unlimited and unrestricted amount of memory. • A Turing machine can do everything a real computer can do.

  19. Turing Machine • A conceptual model for general purpose computers proposed by Alan Turing in 1936. • A Turing machine has an unlimited and unrestricted amount of memory. • A Turing machine can do everything a real computer can do. • Nevertheless there are problems that a Turing machine cannot solve.

  20. Turing Machine • A conceptual model for general purpose computers proposed by Alan Turing in 1936. • A Turing machine has an unlimited and unrestricted amount of memory. • A Turing machine can do everything a real computer can do. • Nevertheless there are problems that a Turing machine cannot solve. • In a real sense, these problems are beyond the theoretical limits of computations.

  21. Turing Machine Specification Components of Turing Machine: • An unlimited length tape of discrete cells.

  22. Turing Machine Specification Components of Turing Machine: • An unlimited length tape of discrete cells. • A head which reads and writes on tape.

  23. Turing Machine Specification Components of Turing Machine: • An unlimited length tape of discrete cells. • A head which reads and writes on tape. • A control device with a finite number of states which can

  24. Turing Machine Specification Components of Turing Machine: • An unlimited length tape of discrete cells. • A head which reads and writes on tape. • A control device with a finite number of states which can • Instruct the head to read the symbol on the tape currently under head.

  25. Turing Machine Specification Components of Turing Machine: • An unlimited length tape of discrete cells. • A head which reads and writes on tape. • A control device with a finite number of states which can • Instruct the head to read the symbol on the tape currently under head. • Instruct the head to write a symbol on the cell of the tape currently under tape.

  26. Turing Machine Specification Components of Turing Machine: • An unlimited length tape of discrete cells. • A head which reads and writes on tape. • A control device with a finite number of states which can • Instruct the head to read the symbol on the tape currently under head. • Instruct the head to write a symbol on the cell of the tape currently under tape. • Move the head one cell to left or right.

  27. Turing Machine Specification Components of Turing Machine: • An unlimited length tape of discrete cells. • A head which reads and writes on tape. • A control device with a finite number of states which can • Instruct the head to read the symbol on the tape currently under head. • Instruct the head to write a symbol on the cell of the tape currently under tape. • Move the head one cell to left or right. • Change its current state.

  28. A Turning Machine

  29. Turing Machine Instructions • Instructions of Turing Machine have the following format: (Current State, Current Symbol, Write, Move L/R or No move, New State) Ex: (2, 0, 1, L, 3) (3, 1, blank, N, 4) (1, #, 0, R, 7)

  30. Turing Machine Instructions • The interpretation of the TM (Turing Machine) instructions: • (2, 0, 1, L, 3) • When Turing machine (the control unit of TM) is at state 2 and the current tape symbol is 0, write symbol 1 at current tape cell and go to state 3.

  31. Visualization of TM instruction (2, 0, 1, L, 3)

  32. Visualization of TM instruction (2, 0, 1, L, 3)

  33. TM Conventions • We always use state 1 as the initial state. (That is the execution of the algorithm or program begins with stating of the TM being 1.

  34. TM Conventions • We always use state 1 as the initial state. (That is the execution of the algorithm or program begins with stating of the TM being 1. • The tape is used for recording input and output, one symbol per cell. Initially, the string to serve as input to our computation is recorded beginning from the leftmost tape cell.

  35. TM Conventions • We always use state 1 as the initial state. (That is the execution of the algorithm or program begins with stating of the TM being 1. • The tape is used for recording input and output, one symbol per cell. Initially, the string to serve as input to our computation is recorded beginning from the leftmost tape cell. • Initially, the position of head is at left most cell.

  36. Initial Configuration of TM

  37. The Output of TM • The output of a TM program or algorithm is the sequence of symbols on the tape when the TM halts on that program.

  38. TM Programs • A Turing machine program is a set of TM instructions.

  39. TM Programs • A Turing machine program is a set of TM instructions. • Turing machine halts on a program if there is no instruction in the program which its current state is the current state of the machine and its current symbol is the current symbol of the tape of the machine (symbol under head of the machine).

  40. Example 1 { (1, 1, 1, R, 2), (2, 1, 1, R, 2), (2, blank, blank, R, 3), (3, 1, blank, L, 4), (4, blank, 1, R, 2) }

  41. Example 1 { (1, 1, 1, R, 2), (2, 1, 1, R, 2), (2, blank, blank, R, 3), (3, 1, blank, L, 4), (4, blank, 1, R, 2) } • This program outputs the sum of two integers m and n given as input.

  42. Example 1 { (1, 1, 1, R, 2), (2, 1, 1, R, 2), (2, blank, blank, R, 3), (3, 1, blank, L, 4), (4, blank, 1, R, 2) } • This program outputs the sum of two integers m and n given as input. • The numbers are in base 1 (unary notation).

  43. Example 1 { (1, 1, 1, R, 2), (2, 1, 1, R, 2), (2, blank, blank, R, 3), (3, 1, blank, L, 4), (4, blank, 1, R, 2) } • This program outputs the sum of two integers m and n given as input. • The numbers are in base 1 (unary notation). • Examples of integers in unary notation: 1 = 1 2 = 11 3 = 111 4 = 1111 …. number n = n number of 1s.

  44. Example 1 The input on tape (the initial configuration): 1 1 b 1 1 1 1 b b b … state = 1 ^ Inputs : operands 2 and 4.

  45. Example 1 The input on tape (the initial configuration): 1 1 b 1 1 1 1 b b b … state = 1 ^ Inputs : operands 2 and 4. The output on tape (when the program halts): 1 1 1 1 1 1 b b b … state = 3 output : 6 b stands for blank.

  46. Example 1 • Executing the program:

  47. Example 1 1 1 b 1 1 1 1 b b … state = 1 ^ Instruction which is going to be executed: (1, 1, 1, R, 2)

  48. Example 1 1 1 b 1 1 1 1 b b … state = 2 ^ Instruction which is going to be executed: (2, 1, 1, R, 2)

  49. Example 1 1 1 b 1 1 1 1 b b … state = 2 ^ Instruction which is going to be executed: (2, blank, blank, R, 3)

  50. Example 1 1 1 b 1 1 1 1 b b … state = 3 ^ Instruction which is going to be executed: (3, 1, blank, L, 4)

More Related