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

2 Alan Turing – 1954 Mathematician, a computer scientis Influantial Development of computer sciences provided an influential formalisation of the concept of the algorithm and computation with the Turing Machine Turing Test contribute to the debate of AI Can machines think? One of the 100 more imp. People in 20 th century 21 st on BBC nation wide poll of the 100 Greatest britons 2

3 3 The Turing Machine 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.

4 4 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

5 5 A Turing Machine Tape Read-Write head Control Unit

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

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

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

9 9 Time Time 2 1. Reads 2. Writes 3. Moves Right b s s b f f

10 10 The Input String Blank symbol head Head starts at the leftmost position of the input string. The input string is never empty Input string #####

11 11 States & Transitions Read Write Move Left Move Right

12 Time Time 2 Example: current state a d Rda,

13 Time Time 2 Example: a b

14 Time Time 2 Example: Lg, #### ###

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

16 16 Partial Transition Function Example: No transition for input symbol Allowed: ## # # #

17 17 Halting The machine halts if there are no possible transitions to follow ## # # # No possible transition HALT!!!

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

19 19 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

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

21 21 Time 0

22 22 Time 1

23 23 Time 2

24 24 Time 3

25 25 Time 4 Halt & Accept

26 26 Rejection Example Time 0

27 27 Time 1 No possible Transition Halt & Reject

28 28 Infinite Loop Example A Turing machine for language

29 29 Time 0

30 30 Time 1

31 31 Time 2

32 32 Time 2 Time 3 Time 4 Time 5 Infinite loop

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

34 34 Another Turing Machine Example Turing machine for the language

35 35 Time 0

36 36 Time 1

37 37 Time 2

38 38 Time 3

39 39 Time 4

40 40 Time 5

41 41 Time 6

42 42 Time 7

43 43 Time 8

44 44 Time 9

45 45 Time 10

46 46 Time 11

47 47 Time 12

48 48 Halt & Accept Time 13

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

50 50 Formal Definitions for Turing Machines

51 51 Transition Function

52 52 Transition Function

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

54 54 Configuration Instantaneous description:

55 55 Time 4Time 5 A Move:

56 56 Time 4Time 5 Time 6Time 7

57 57 Equivalent notation:

58 58 Initial configuration: Input string

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

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

61 61 Computing Functions with Turing Machines

62 62 A function Domain: Result Region: has:

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

64 64 Integer Domain Unary: Binary: Decimal: We prefer unary representation: easier to manipulate with Turing machines

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

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

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

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

69 69 Start Finish final state initial state

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

71 71 Turing machine for function

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

73 73 Time 0

74 74 Time 1

75 75 Time 2

76 76 Time 3

77 77 Time 4

78 78 Time 5

79 79 Time 6

80 80 Time 7

81 81 Time 8

82 82 Time 9

83 83 Time 10

84 84 Time 11

85 85 HALT & accept Time 12

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

87 87 Start Finish final state initial state

88 88 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

89 89 Turing Machine for

90 90 Example Start Finish

91 91 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. # ……. # ……….

92 92 Simple TM Examples TM: U+1 (s 0, 1) |-- (s 0, 1, R) (s 0, 0) |-- (h, 1, STOP) #s ….. #1s ….. #11s ….. #111s ….. #1111s ….. #11111h0000….. STOP

93 93 Another Example The function is computable if

94 94 Turing Machine for Input: Output: or if

95 95 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

96 96 Combining Turing Machines

97 97 Block Diagram Turing Machine inputoutput

98 98 Example: if Comparer Adder Eraser

99 99 Turings 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.

100 100 Turings Thesis Turings 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 Turings thesis.

101 101 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.

102 Lab2 Write some simpleTuring machine programs QUESTIONS? 102


Download ppt "1 Introduction to Turing Machines 011011111101101100010."

Similar presentations


Ads by Google