Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Introduction to Turing Machines 011011111101101100010.

Similar presentations


Presentation on theme: "1 Introduction to Turing Machines 011011111101101100010."— Presentation transcript:

1 1 Introduction to Turing Machines 011011111101101100010

2 2 The Turing Machine 0110111111011011000101 A TM consists of an infinite length tape, on which input is provided as a finite sequence of symbols. A head reads the input tape. The TM starts at start state s 0. On reading an input symbol it optionally replaces it with another symbol, changes its internal state and moves one cell to the right or left.

3 3 The Turing Machine A TM is defined as: TM = where, S is a set of TM states T is a set of tape symbols s 0 is the start state H  S is a set of halting states  : S x T  S x T x {L,R} is the transition function

4 4 A Turing Machine...... Tape Read-Write head Control Unit

5 5 The Tape...... Read-Write head No boundaries -- infinite length The head moves Left or Right

6 6...... Read-Write head The head at each time step: 1. Reads a symbol 2. Writes a symbol 3. Moves Left or Right

7 7...... Example: Time 0...... Time 1 1. Reads 2. Writes 3. Moves Left

8 8...... Time 1...... Time 2 1. Reads 2. Writes 3. Moves Right

9 9 The Input String...... Blank symbol head Head starts at the leftmost position of the input string Input string

10 10...... Blank symbol head Input string Remark: the input string is never empty

11 11 States & Transitions Read Write Move Left Move Right

12 12 Example:...... Time 1 current state

13 13...... Time 1...... Time 2

14 14...... Time 1...... Time 2 Example:

15 15...... Time 1...... Time 2 Example:

16 16 Determinism Allowed Not Allowed No lambda transitions allowed Turing Machines are deterministic

17 17 Partial Transition Function...... Example: No transition for input symbol Allowed:

18 18 Halting The machine halts if there are no possible transitions to follow

19 19 Example:...... No possible transition HALT!!!

20 20 Final States Allowed Not Allowed Final states have no outgoing transitions In a final state the machine halts

21 21 Acceptance Accept Input If machine halts in a final state Reject Input If machine halts in a non-final state or If machine enters an infinite loop

22 22 Turing Machine Example A Turing machine that accepts the language:

23 23 Time 0

24 24 Time 1

25 25 Time 2

26 26 Time 3

27 27 Time 4 Halt & Accept

28 28 Rejection Example Time 0

29 29 Time 1 No possible Transition Halt & Reject

30 30 Infinite Loop Example A Turing machine for language

31 31 Time 0

32 32 Time 1

33 33 Time 2

34 34 Time 2 Time 3 Time 4 Time 5 Infinite loop

35 35 Because of the infinite loop: The final state cannot be reached The machine never halts The input is not accepted

36 36 Another Turing Machine Example Turing machine for the language

37 37 Time 0

38 38 Time 1

39 39 Time 2

40 40 Time 3

41 41 Time 4

42 42 Time 5

43 43 Time 6

44 44 Time 7

45 45 Time 8

46 46 Time 9

47 47 Time 10

48 48 Time 11

49 49 Time 12

50 50 Halt & Accept Time 13

51 51 If we modify the machine for the language we can easily construct a machine for the language Observation:

52 52 Formal Definitions for Turing Machines

53 53 Transition Function

54 54 Transition Function

55 55 Turing Machine: States Input alphabet Tape alphabet Transition function Initial state blank Final states

56 56 Configuration Instantaneous description:

57 57 Time 4Time 5 A Move:

58 58 Time 4Time 5 Time 6Time 7

59 59 Equivalent notation:

60 60 Initial configuration: Input string

61 61 The Accepted Language For any Turing Machine Initial stateFinal state

62 62 Standard Turing Machine Deterministic Infinite tape in both directions Tape is the input/output file The machine we described is the standard:

63 63 Computing Functions with Turing Machines

64 64 A function Domain: Result Region: has:

65 65 A function may have many parameters: Example: Addition function

66 66 Integer Domain Unary: Binary: Decimal: 11111 101 5 We prefer unary representation: easier to manipulate with Turing machines

67 67 Definition: A function is computable if there is a Turing Machine such that: Initial configurationFinal configuration Domain final stateinitial state For all

68 68 Initial Configuration Final Configuration A function is computable if there is a Turing Machine such that: In other words: Domain For all

69 69 Example The function is computable Turing Machine: Input string: unary Output string: unary are integers

70 70 Start initial state The 0 is the delimiter that separates the two numbers

71 71 Start Finish final state initial state

72 72 Finish final state The 0 helps when we use the result for other operations

73 73 Turing machine for function

74 74 Execution Example: Time 0 Final Result (2)

75 75 Time 0

76 76 Time 1

77 77 Time 2

78 78 Time 3

79 79 Time 4

80 80 Time 5

81 81 Time 6

82 82 Time 7

83 83 Time 8

84 84 Time 9

85 85 Time 10

86 86 Time 11

87 87 HALT & accept Time 12

88 88 Another Example The function is computable Turing Machine: Input string: unary Output string:unary is integer

89 89 Start Finish final state initial state

90 90 Turing Machine Pseudocode for Replace every 1 with $ Repeat: Find rightmost $, replace it with 1 Go to right end, insert 1 Until no more $ remain

91 91 Turing Machine for

92 92 Example Start Finish

93 93 Simple TM Examples Turing Machine U+1: Given a string of 1s on a tape (followed by an infinite number of 0s), add one more 1 at the end of the string. #111100000000…….  #1111100000000……….

94 94 Simple TM Examples TM: U+1  (s 0, 1) |-- (s 0, 1, R)  (s 0, 0) |-- (h, 1, STOP) #s 0 111100000…..  #1s 0 11100000…..  #11s 0 1100000…..  #111s 0 100000…..  #1111s 0 00000…..  #11111h0000….. STOP

95 95 Another Example The function is computable if

96 96 Turing Machine for Input: Output: or if

97 97 Turing Machine Pseudocode: Match a 1 from with a 1 from Repeat Until all of or is matched If a 1 from is not matched erase tape, write 1 else erase tape, write 0

98 98 Combining Turing Machines

99 99 Block Diagram Turing Machine inputoutput

100 100 Example: if Comparer Adder Eraser

101 101 Turing’s Thesis Any mathematical problem solving that can be described by a mechanical procedure (algorithm) can be modeled by a Turing machine. All computers today perform only mechanical problem solving. They are no more expressive than a Turing machine.

102 102 Turing’s Thesis Turing’s thesis is not a “theorem” there is no “proof” for the thesis. The theorem may be refuted by showing at least one task that is performed by a digital computer which cannot be performed by a Turing machine. Many contentions have been made to this end. However, till date there have not been any conclusive evidence to refute Turing’s thesis.

103 103 Conclusions TMs are at a level that is much below the assembly language of any typical microprocessor. So in the practical world, TMs are more useful in what they cannot do rather than in what they can.


Download ppt "1 Introduction to Turing Machines 011011111101101100010."

Similar presentations


Ads by Google