Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fall 2006Costas Busch - RPI1 Turing Machines. Fall 2006Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?

Similar presentations


Presentation on theme: "Fall 2006Costas Busch - RPI1 Turing Machines. Fall 2006Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?"— Presentation transcript:

1 Fall 2006Costas Busch - RPI1 Turing Machines

2 Fall 2006Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?

3 Fall 2006Costas Busch - RPI3 Regular Languages Context-Free Languages Languages accepted by Turing Machines

4 Fall 2006Costas Busch - RPI4 A Turing Machine...... Tape Read-Write head Control Unit

5 Fall 2006Costas Busch - RPI5 The Tape...... Read-Write head No boundaries -- infinite length The head moves Left or Right

6 Fall 2006Costas Busch - RPI6...... Read-Write head The head at each transition (time step): 1. Reads a symbol 2. Writes a symbol 3. Moves Left or Right

7 Fall 2006Costas Busch - RPI7...... Example: Time 0...... Time 1 1. Reads 2. Writes 3. Moves Left

8 Fall 2006Costas Busch - RPI8...... Time 1...... Time 2 1. Reads 2. Writes 3. Moves Right

9 Fall 2006Costas Busch - RPI9 The Input String...... Blank symbol head Head starts at the leftmost position of the input string Input string

10 Fall 2006Costas Busch - RPI10 States & Transitions Read Write Move Left Move Right

11 Fall 2006Costas Busch - RPI11 Example:...... Time 1 current state

12 Fall 2006Costas Busch - RPI12...... Time 1...... Time 2

13 Fall 2006Costas Busch - RPI13...... Time 1...... Time 2 Example:

14 Fall 2006Costas Busch - RPI14...... Time 1...... Time 2 Example:

15 Fall 2006Costas Busch - RPI15 Determinism Allowed Not Allowed No lambda transitions allowed Turing Machines are deterministic

16 Fall 2006Costas Busch - RPI16 Partial Transition Function...... Example: No transition for input symbol Allowed:

17 Fall 2006Costas Busch - RPI17 Halting The machine halts in a state if there is no transition to follow

18 Fall 2006Costas Busch - RPI18 Halting Example 1:...... No transition from HALT!!!

19 Fall 2006Costas Busch - RPI19 Halting Example 2:...... No possible transition from and symbol HALT!!!

20 Fall 2006Costas Busch - RPI20 Accepting States Allowed Not Allowed Accepting states have no outgoing transitions The machine halts and accepts

21 Fall 2006Costas Busch - RPI21 Acceptance Accept Input If machine halts in an accept state Reject Input If machine halts in a non-accept state or If machine enters an infinite loop string

22 Fall 2006Costas Busch - RPI22 Observation: In order to accept an input string, it is not necessary to scan all the symbols in the string

23 Fall 2006Costas Busch - RPI23 Turing Machine Example Accepts the language: Input alphabet

24 Fall 2006Costas Busch - RPI24 Time 0

25 Fall 2006Costas Busch - RPI25 Time 1

26 Fall 2006Costas Busch - RPI26 Time 2

27 Fall 2006Costas Busch - RPI27 Time 3

28 Fall 2006Costas Busch - RPI28 Time 4 Halt & Accept

29 Fall 2006Costas Busch - RPI29 Rejection Example Time 0

30 Fall 2006Costas Busch - RPI30 Time 1 No possible Transition Halt & Reject

31 Fall 2006Costas Busch - RPI31 Accepts the language: but for input alphabet A simpler machine for same language

32 Fall 2006Costas Busch - RPI32 Time 0 Halt & Accept Not necessary to scan input

33 Fall 2006Costas Busch - RPI33 Infinite Loop Example A Turing machine for language

34 Fall 2006Costas Busch - RPI34 Time 0

35 Fall 2006Costas Busch - RPI35 Time 1

36 Fall 2006Costas Busch - RPI36 Time 2

37 Fall 2006Costas Busch - RPI37 Time 2 Time 3 Time 4 Time 5 Infinite loop

38 Fall 2006Costas Busch - RPI38 Because of the infinite loop: The accepting state cannot be reached The machine never halts The input string is rejected

39 Fall 2006Costas Busch - RPI39 Another Turing Machine Example Turing machine for the language

40 Fall 2006Costas Busch - RPI40 Match as with bs: Repeat: replace leftmost a with x find leftmost b and replace it with y Until there are no more as or bs If there is a remaining a or b reject Basic Idea:

41 Fall 2006Costas Busch - RPI41 Time 0

42 Fall 2006Costas Busch - RPI42 Time 1

43 Fall 2006Costas Busch - RPI43 Time 2

44 Fall 2006Costas Busch - RPI44 Time 3

45 Fall 2006Costas Busch - RPI45 Time 4

46 Fall 2006Costas Busch - RPI46 Time 5

47 Fall 2006Costas Busch - RPI47 Time 6

48 Fall 2006Costas Busch - RPI48 Time 7

49 Fall 2006Costas Busch - RPI49 Time 8

50 Fall 2006Costas Busch - RPI50 Time 9

51 Fall 2006Costas Busch - RPI51 Time 10

52 Fall 2006Costas Busch - RPI52 Time 11

53 Fall 2006Costas Busch - RPI53 Time 12

54 Fall 2006Costas Busch - RPI54 Halt & Accept Time 13

55 Fall 2006Costas Busch - RPI55 If we modify the machine for the language we can easily construct a machine for the language Observation:

56 Fall 2006Costas Busch - RPI56 Formal Definitions for Turing Machines

57 Fall 2006Costas Busch - RPI57 Transition Function

58 Fall 2006Costas Busch - RPI58 Transition Function

59 Fall 2006Costas Busch - RPI59 Turing Machine: States Input alphabet Tape alphabet Transition function Initial state blank Accept states

60 Fall 2006Costas Busch - RPI60 Configuration Instantaneous description:

61 Fall 2006Costas Busch - RPI61 Time 4Time 5 A Move: (yields in one mode)

62 Fall 2006Costas Busch - RPI62 Time 4Time 5 Time 6Time 7 A computation

63 Fall 2006Costas Busch - RPI63 Equivalent notation:

64 Fall 2006Costas Busch - RPI64 Initial configuration: Input string

65 Fall 2006Costas Busch - RPI65 The Accepted Language For any Turing Machine Initial stateAccept state

66 Fall 2006Costas Busch - RPI66 If a language is accepted by a Turing machine then we say that is: Turing Acceptable Recursively Enumerable Turing Recognizable Other names used:

67 Fall 2006Costas Busch - RPI67 Computing Functions with Turing Machines

68 Fall 2006Costas Busch - RPI68 A function Domain: Result Region: has:

69 Fall 2006Costas Busch - RPI69 A function may have many parameters: Example: Addition function

70 Fall 2006Costas Busch - RPI70 Integer Domain Unary: Binary: Decimal: 11111 101 5 We prefer unary representation: easier to manipulate with Turing machines

71 Fall 2006Costas Busch - RPI71 Definition: A function is computable if there is a Turing Machine such that: Initial configurationFinal configuration Domain accept stateinitial state For all

72 Fall 2006Costas Busch - RPI72 Initial Configuration Final Configuration A function is computable if there is a Turing Machine such that: In other words: Domain For all

73 Fall 2006Costas Busch - RPI73 Example The function is computable Turing Machine: Input string: unary Output string: unary are integers

74 Fall 2006Costas Busch - RPI74 Start initial state The 0 is the delimiter that separates the two numbers

75 Fall 2006Costas Busch - RPI75 Start Finish final state initial state

76 Fall 2006Costas Busch - RPI76 Finish final state The 0 here helps when we use the result for other operations

77 Fall 2006Costas Busch - RPI77 Turing machine for function

78 Fall 2006Costas Busch - RPI78 Execution Example: Time 0 Final Result (=2)

79 Fall 2006Costas Busch - RPI79 Time 0

80 Fall 2006Costas Busch - RPI80 Time 1

81 Fall 2006Costas Busch - RPI81 Time 2

82 Fall 2006Costas Busch - RPI82 Time 3

83 Fall 2006Costas Busch - RPI83 Time 4

84 Fall 2006Costas Busch - RPI84 Time 5

85 Fall 2006Costas Busch - RPI85 Time 6

86 Fall 2006Costas Busch - RPI86 Time 7

87 Fall 2006Costas Busch - RPI87 Time 8

88 Fall 2006Costas Busch - RPI88 Time 9

89 Fall 2006Costas Busch - RPI89 Time 10

90 Fall 2006Costas Busch - RPI90 Time 11

91 Fall 2006Costas Busch - RPI91 HALT & accept Time 12

92 Fall 2006Costas Busch - RPI92 Another Example The function is computable Turing Machine: Input string: unary Output string:unary is integer

93 Fall 2006Costas Busch - RPI93 Start Finish accept state initial state

94 Fall 2006Costas Busch - RPI94 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

95 Fall 2006Costas Busch - RPI95 Turing Machine for

96 Fall 2006Costas Busch - RPI96 Example Start Finish

97 Fall 2006Costas Busch - RPI97 Another Example The function is computable if Input: Output: or

98 Fall 2006Costas Busch - RPI98 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

99 Fall 2006Costas Busch - RPI99 Combining Turing Machines

100 Fall 2006Costas Busch - RPI100 Block Diagram Turing Machine inputoutput

101 Fall 2006Costas Busch - RPI101 Example: if Comparator Adder Eraser


Download ppt "Fall 2006Costas Busch - RPI1 Turing Machines. Fall 2006Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?"

Similar presentations


Ads by Google