Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Turing Machines

Similar presentations


Presentation on theme: "Introduction to Turing Machines"— Presentation transcript:

1 Introduction to Turing Machines
1 1 1 1 1 1 1 1 1 1 1 1 1

2 Alan Turing -- 1912 – 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 20th century 21st on BBC nation wide poll of the 100 Greatest britons

3 The Turing Machine A TM consists of an infinite length tape, on which
1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 s0. 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. In the above diagram, TM states are depicted by different colours. So, when the head moves, its colour also changes indicating that it has changed its internal state.

4 The Turing Machine A TM is defined as:
TM = <S, T, s0, d, H> where, S is a set of TM states T is a set of tape symbols s is the start state H  S is a set of halting states d : S x T S x T x {L,R} is the transition function A TM begins computation at state s0. At each computational step, it reads the present tape symbol, changes its internal state, optionally writes another symbol onto tape, and moves one cell to the left or right in the tape. The TM halts computation (and accepts the input string) when it reaches one of the halt states in H.

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

6 The Tape No boundaries -- infinite length ...... ......
Read-Write head 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 ...... d 1. Reads 2. Writes d 3. Moves Left

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

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

11 States & Transitions Write Read Move Left Move Right

12 R d a , ® Example: Time 1 ...... ...... a current state Time 2 ......

13 Example: Time 1 ...... ...... a Time 2 ...... ...... b

14 L g , ® # Example: Time 1 ...... ...... Time 2 ...... ...... # # # # #

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

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

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

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

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

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

21 Time 0

22 Time 1

23 Time 2

24 Time 3

25 Time 4 Halt & Accept

26 Rejection Example Time 0

27 Time 1 No possible Transition Halt & Reject

28 Infinite Loop Example A Turing machine for language

29 Time 0

30 Time 1

31 Time 2

32 Time 2 Time 3 Infinite loop Time 4 Time 5

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

34 Another Turing Machine Example
Turing machine for the language

35 Time 0

36 Time 1

37 Time 2

38 Time 3

39 Time 4

40 Time 5

41 Time 6

42 Time 7

43 Time 8

44 Time 9

45 Time 10

46 Time 11

47 Time 12

48 Time 13 Halt & Accept

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

50 Formal Definitions for Turing Machines

51 Transition Function

52 Transition Function

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

54 Configuration Instantaneous description:

55 Time 4 Time 5 A Move:

56 Time 4 Time 5 Time 6 Time 7

57 Equivalent notation:

58 Initial configuration:
Input string

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

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

61 Computing Functions with Turing Machines

62 A function has: Result Region: Domain:

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

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

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

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

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

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

69 Start initial state Finish final state

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

71 Turing machine for function

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

73 Time 0

74 Time 1

75 Time 2

76 Time 3

77 Time 4

78 Time 5

79 Time 6

80 Time 7

81 Time 8

82 Time 9

83 Time 10

84 Time 11

85 Time 12 HALT & accept

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

87 Start initial state Finish final state

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 Turing Machine for

90 Example Start Finish

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. # ……. # ………. A tape is denoted by # …. Where # is the start of the tape.

92 Simple TM Examples TM: U+1 d(s0, 1) |-- (s0, 1, R)
d(s0, 0) |-- (h, 1, STOP) #s …..  #1s …..  #11s …..  #111s …..  #1111s000000…..  #11111h0000….. STOP TM computations are illustrated in the form #s … which shows the TM to be in state s, and at the beginning of the tape.

93 Another Example if The function if is computable

94 Turing Machine for if if Input: Output: or

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

96 Combining Turing Machines

97 Block Diagram Turing Machine input output

98 Example: if if Adder Comparer Eraser

99 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. A philosophical question: Do digital computers today perform only mechanical computations? What about our thinking? Do we think mechanically? Can we reduce our thought processes to an algorithm?

100 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. Although Turing’s a-machine were the most popular, there are many more machines proposed by Turing. Basically they are meant to be more powerful than a-machines. These include the c-machines (choice machines), o-machines (oracle machines) and u-machines (unorganized machines). However, there have been no conclusive proofs about whether they are more expressive than a-machines.

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?


Download ppt "Introduction to Turing Machines"

Similar presentations


Ads by Google