Presentation is loading. Please wait.

Presentation is loading. Please wait.

T URING M ACHINE ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala CSE-501 F ORMAL L ANGUAGE & A UTOMATA T HEORY Aug-Dec,2010.

Similar presentations


Presentation on theme: "T URING M ACHINE ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala CSE-501 F ORMAL L ANGUAGE & A UTOMATA T HEORY Aug-Dec,2010."— Presentation transcript:

1 T URING M ACHINE ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala CSE-501 F ORMAL L ANGUAGE & A UTOMATA T HEORY Aug-Dec,2010

2 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?

3 3 Regular Languages Context-Free Languages Languages accepted by Turing Machines

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 Read-Write head The head at each time step: 1. Reads a symbol 2. Writes a symbol 3. Moves Left or Right

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

8 Time 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 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 Time Time 2

14 Time Time 2 Example:

15 Time 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 F ORMAL D EFINITIONS FOR T URING M ACHINES 36

37 37 Transition Function

38 38 Transition Function

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

40 40 Configuration Instantaneous description:

41 41 Time 4Time 5 A Move:

42 42 Time 4Time 5 Time 6Time 7

43 43 Equivalent notation:

44 44 Initial configuration: Input string

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

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

47 C OMPUTING F UNCTIONS WITH T URING M ACHINES 47

48 48 A function Domain: Result Region: has:

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

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

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

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

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

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

55 55 Start Finish final state initial state

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

57 57 Turing machine for function

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

59 59 Time 0

60 60 Time 1

61 61 Time 2

62 62 Time 3

63 63 Time 4

64 64 Time 5

65 65 Time 6

66 66 Time 7

67 67 Time 8

68 68 Time 9

69 69 Time 10

70 70 Time 11

71 71 HALT & accept Time 12

72 72 Another Example – SELF STUDY The function is computable Turing Machine: Input string: unary Output string:unary is integer

73 73 Start Finish final state initial state

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

75 75 Turing Machine for

76 76 Example Start Finish

77 77 Block Diagram Turing Machine inputoutput

78 T URING S T HESIS 78

79 79 Turings thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)

80 80 Computer Science Law: A computation is mechanical if and only if it can be performed by a Turing Machine There is no known model of computation more powerful than Turing Machines

81 81 Definition of Algorithm: An algorithm for function is a Turing Machine which computes

82 82 When we say: There exists an algorithm Algorithms are Turing Machines We mean: There exists a Turing Machine that executes the algorithm

83 Construct a Turing Machine: Construct a TM to accept the set L of all strings over {0,1} ending with

84 Can a TM simulate a TM? Can one TM simulate every TM? Yes, obviously.

85 An Any TM Simulator Input: Output: result of running m on w Universal Turing Machine m w Output Tape for running TM- m starting on tape w

86 Universal Turing Machine (UTM) functional notation of UTM: U(mw) = m(w) takes 2 arguments: –m : a description of a Turing Machine TM –w : description of an input string w have 2 properties: – UTM halts on input m w if & only if TM halts on input w. 86

87 Halting Problem 87

88 T HANK YOU 88


Download ppt "T URING M ACHINE ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala CSE-501 F ORMAL L ANGUAGE & A UTOMATA T HEORY Aug-Dec,2010."

Similar presentations


Ads by Google