Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2011.

Similar presentations


Presentation on theme: "1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2011."— Presentation transcript:

1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2011

2 2 Content Chomsky’s Language Hierarchy Turing Machines Determinism Halting TM Examples Standard TM Computing Functions with TM Combining TMs Turing Thesis

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

4 4 Regular Languages Context-free languages Recursively enumerable languages

5 5 Finite Automata Push-down Automata Turing Machines

6 6 http://www.turing.org.uk/turing/ Who was Alan Turing? Founder of Computability Theory, mathematician, philosopher, codebreaker, visionary man before his time. http://www.cs.usfca.edu/www.AlanTuring.net/turing_archive/index.html- Jack Copeland and Diane Proudfoot http://www.turing.org.uk/turing/ The Alan Turing Home Page Andrew Hodges/

7 7 Alan Turing 1912 (23 June): Birth, London 1926-31: Sherborne School 1930: Death of friend Christopher Morcom 1931-34: Undergraduate at King's College, Cambridge University 1932-35: Quantum mechanics, probability, logic 1935: Elected fellow of King's College, Cambridge 1936: The Turing machine, computability, universal machine 1936-38: Princeton University. Ph.D. Logic, algebra, number theory 1938-39: Return to Cambridge. Introduced to German Enigma cipher machine 1939-40: The Bombe, machine for Enigma decryption 1939-42: Breaking of U-boat Enigma, saving battle of the Atlantic

8 8 Alan Turing 1943-45: Chief Anglo-American crypto consultant. Electronic work. 1945: National Physical Laboratory, London 1946: Computer and software design leading the world. 1947-48: Programming, neural nets, and artificial intelligence 1948: Manchester University 1949: First serious mathematical use of a computer 1950: The Turing Test for machine intelligence 1951: Elected FRS. Non-linear theory of biological growth 1952: Arrested as a homosexual, loss of security clearance 1953-54: Unfinished work in biology and physics 1954 (7 June): Death (suicide) by cyanide poisoning, Wilmslow, Cheshire.

9 9 Hilbert’s Program, 1900 Hilbert’s hope was that mathematics would be reducible to finding proofs (manipulating the strings of symbols) from a fixed system of axioms, axioms that everyone could agree were true. Can all of mathematics be made algorithmic, or will there always be new problems that outstrip any given algorithm, and so require creative acts of mind to solve?

10 10 Turing Machines and Computability The question Hilbert raised was whether there could be a general method or process by which one could decide whether a mathematical proposition could be proved. But what exactly was meant by a 'method' or 'process'? People had already used the concept of a 'mechanical' process, and Turing had an idea which made this quite precise: computability. Turing wrote in his first sentences: “The "computable" numbers may be described briefly as the real numbers whose expressions as a decimal are calculable by finite means... a number is computable if its decimal can be written down by a machine. “ http://www.turing.org.uk/turing/scrapbook/machine.html

11 11 Turing Machines and Computability The Turing machine concept involves specifying a very restricted set of logical operations, but Turing showed how other more complex mathematical procedures could be built out of these atomic components. Turing argued that his formalism was sufficiently general to encompass anything that a human being could do when carrying out a definite method. Turing's famous 1936-7 paper On computable numbers, with an application to the Entscheidungsproblem, which worked out the theory of Turing machines and the definition of computability, is available as a PDF file on-line: http://www.cs.ox.ac.uk/activities/ieg/e-library/sources/tp2-ie.pdf

12 12 Turing Machines

13 Turing’s "Machines". These machines are humans who calculate. (Wittgenstein) A man provided with paper, pencil, and rubber, and subject to strict discipline, is in effect a universal machine. (Turing) 13

14 14...... Tape Read-Write head Control Unit Turing Machine

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

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

17 17 Example Time 0...... Time 1...... 1. Reads 2. Writes 3. Moves Left

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

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

20 20 Read Write Move Left Move Right States & Transitions

21 21 Example...... Time 1 current state

22 22...... Time 1...... Time 2

23 23...... Time 1...... Time 2 Example

24 24...... Time 1...... Time 2 Example

25 25 Determinism Allowed Not Allowed No lambda transitions allowed in TM! Turing Machines are deterministic

26 26 Determinism Note the difference between state indeterminism when not even possible future states are known in advance and choice indeterminism when possible future states are known, but we do not know which state will be taken.

27 27 Partial Transition Function...... Example No transition for input symbol Allowed

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

29 29 Example...... No possible transition HALT!

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

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

32 32 Turing Machine Example A TM that accepts the language

33 33 Time 0

34 34 Time 1

35 35 Time 2

36 36 Time 3

37 37 Time 4 Halt & Accept

38 38 Rejection Example Time 0

39 39 Time 1 No possible Transition Halt & Reject

40 40 Infinite Loop Example Another TM for language

41 41 Time 0

42 42 Time 1

43 43 Time 2

44 44 Time 2 Time 3 Time 4 Time 5... infinite loop…

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

46 46 Another Turing Machine Example Turing machine for the language

47 47 Time 0

48 48 Time 1

49 49 Time 2

50 50 Time 3

51 51 Time 4

52 52 Time 5

53 53 Time 6

54 54 Time 7

55 55 Time 8

56 56 Time 9

57 57 Time 10

58 58 Time 11

59 59 Time 12

60 60 Halt & Accept Time 13

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

62 62 Formal Definitions for Turing Machines

63 63 Transition Function

64 64 Transition Function

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

66 66 Instantaneous description: Configuration

67 67 Time 4Time 5 A move:

68 68 Time 4Time 5 Time 6Time 7

69 69 Equivalent notation:

70 70 Initial configuration: Input string

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

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

73 73 Computing Functions with Turing Machines

74 74 A function has: Domain (domän): Range (värdemängd):

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

76 76 Integer Domain Binary:101 Decimal:5 We prefer unary representation: easier to manipulate Unary:11111

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

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

79 79 Example (Addition) The function is computable Turing Machine: Input string: unary Output string: unary are integers

80 80 Start Finish final state initial state

81 81 Turing machine for function

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

83 83 Time 0

84 84 Time 1

85 85 Time 2

86 86 Time 3

87 87 Time 4

88 88 Time 5

89 89 Time 6

90 90 Time 7

91 91 Time 8

92 92 Time 9

93 93 Time 10

94 94 Time 11

95 95 HALT & accept Time 12

96 96 Another Example (Multiplication) The functionis computable Turing Machine Input string: unary Output string:unary is integer

97 97 Start Finish final state initial state

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

99 99 Turing Machine for

100 100 Start Finish

101 101 Time 0

102 102 Time 1

103 103 Time 2

104 104 Time 3

105 105 Time 4

106 106 Time 5

107 107 Time 6

108 108 Time 7

109 109 Time 8

110 110 Time 9

111 111 Time 10

112 112 Time 11

113 113 Time 12

114 114 Time 13

115 115 Time 14

116 116 Another Example The function is computable if Turing Machine for Output: or Input:

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

118 118 Combining Turing Machines

119 119 Block Diagram Turing Machine inputoutput

120 120 Example if Comparer Adder Eraser

121 121 Turing’s Thesis

122 122 Do Turing machines have the same power with a digital computer? Intuitive answer: Yes There is no formal answer! Question:

123 123 Turing’s thesis Any computation carried out by mechanical means can be performed by a Turing Machine (1930) http://www.engr.uconn.edu/~dqg/papers/myth.pdf The Origins of the Turing Thesis Myth Goldin & Wegner

124 124 And, the other way round: A computation is mechanical if and only if it can be performed by a Turing Machine Strong Turing Thesis: There is no known model of computation more powerful than Turing Machines Wrong! Asynchronous parallel computation is more powerful than TM model, and cannot be reduced to TM.

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

126 126 When we say There exists an algorithm Algorithms are Turing Machines It means There exists a Turing Machine

127 127 LanguageGrammarMachine Chomsky Hierarchy Non-computable?? Recursively enumerable (RE) UnrestrictedTuring machines 0 Recursive Turing machines that always halt 0 Context-sensitive Context-sensitive grammar Linear-bounded automata 1 Context-free Context-free grammar Non-deterministic pushdown automata 2 Regular Regular expressions Finite state automata 3 properly inclusive Languages, Grammars, Machines

128 128 Regular Languages FINITE AUTOMATA Context-free languages PUSH-DOWN AUTOMATA Unrestricted grammar languages TURING MACHINES

129 Interesting further reading Computational and evolutionary aspects of language http://www.nature.com/nature/journal/v417/n6889/full/nature00771.html Turing’s thesis http://www.ams.org/notices/200610/fea-feferman.pdf http://www.mathcomp.leeds.ac.uk/turing2012/give-page.php?408 2012 The Alan Turing World https://sites.google.com/site/naturalcomputingaisbiacap2012 Symposium on Natural/Unconventional Computing AISB/IACAP World Congress 129


Download ppt "1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2011."

Similar presentations


Ads by Google