CSCE 355 Foundations of Computation Lecture 23 Turing
- Slides: 29
CSCE 355 Foundations of Computation Lecture 23 Turing Machines II Topics: n Turing Machines again l Formal definition l Instantaneous descriptors, moves n n n Transition diagrams Language accepted by TM What’s Computable ? December 1, 2008
Last Time: n n Turing Machines: IDs and moves New: n n Transitions diagrams What’s computation? l (slides from last lecture that we did not get to) n – 2– Test 2 take home CSCE 355 Fall 2008
Turing Machines • Model of “any possible computation” i. e. an algorithm • Finite State Control + “infinite tape” for memory – 3– CSCE 355 Fall 2008
Formal Definition of Turing Machine M = (Q, Σ, Γ, δ, q 0 , B, F) • Q • Σ • Γ • δ: Q x Γ x {L, R} n δ(q, X) = (p, Y, D) • q 0 • B – blank symbol in Γ but not in Σ • F – 4– CSCE 355 Fall 2008
Instantaneous Descriptors • What do we need to describe to characterize the state of a Turing Machine? n n n State Contents of the tape Where the read/write head is located • So an instantaneous descriptor looks like X 1 X 2…Xi-1 q Xi Xi+1, … Xn • exceptions – 5– CSCE 355 Fall 2008
Moves of the Turing Machine • ID 1 ├ ID 2 • ID 1 ├* ID 2 – 6– CSCE 355 Fall 2008
– 7– CSCE 355 Fall 2008
– 8– CSCE 355 Fall 2008
– 9– CSCE 355 Fall 2008
Example figure 8. 9 – 10 – CSCE 355 Fall 2008
– 11 – CSCE 355 Fall 2008
What is computable? – 12 – CSCE 355 Fall 2008
Hello World Programs 1. Hello. World. rb 2. Hello. Fermat. rb 3. Hello. World. Detecter 1. rb 4. Hello. World. Detecter 2. rb 5. Hello. World. Detecter 3. rb – 13 – CSCE 355 Fall 2008
Hello. World 0. rb puts "Hello World!" – 14 – CSCE 355 Fall 2008
Fermat’s Last Theorem • Conjecture from 1637 n "I have a truly marvellous proof of this proposition which this margin is too narrow to contain. “ • proved by Andrew Wiles in 1995 (358 years later) • But for discussion assume still not proven. – 15 – http: //en. wikipedia. org/wiki/Fermat%27 s_Last_Theorem CSCE 355 Fall 2008
Hello. Fermat. rb n = 3; total = 3 ## Fermat’s Last Theorem Checker as hello. World found. Solution = 0 while found. Solution = 0 1. upto(total-2) do |x| 1. upto(total-x-1) do |y| z = total-x-y if (x**n + y**n == z**n) puts "Hello World!" found. Solution = 1 end; total = total+1 puts "total=#{total}" – end; 16 – CSCE 355 Fall 2008
Questions on Hello. Fermat. rb • Will it print “Hello World!” ? • Is it possible to modify the ruby interpreter to tell if it will print “Hello World!” ? – 17 – CSCE 355 Fall 2008
– 18 – http: //iti. zcu. cz/domazlice 08/ CSCE 355 Fall 2008
Hello. World. Tester. rb • Write ruby simulator “Hello. World. Tester. rb” that will test 1. Read a ruby program prog. rb and its input “I” 2. Simulate the program on that input 3. Print “yes” if the first thing “prog. rb” would print when run on Input would be “Hello World!” • Assumptions 1. All I/O is character based 2. Only using the function puts 3. Assume “print Hello World!” means the first characters printed are “Hello World!” – 19 – CSCE 355 Fall 2008
Hello. World. Tester. rb (figure 8. 3) Input Program Hello World! tester. rb H yes no • To simplify n Input will just be “I” n Program will just be “P” Hello. World. Tester will just be H n I P – 20 – H yes no CSCE 355 Fall 2008
Hello. World. Tester 1. rb (figure 8. 4) I P H 1 yes Hello World! • Modify the original Hello. World tester H so that when it would have printed “no” it now prints “Hello World!” • Note this new program H 1 behaves just like H except when H prints no. – 21 – CSCE 355 Fall 2008
Hello. World. Tester 2. rb (figure 8. 5) P H 2 yes Hello World! • Interested in programs that read other programs as their input • Now Modify H 1 to get H 2 • Treat P as both the program and its input “operate P on itself as the data” • Note on H 2’s behavior n n – 22 – If P would print “Hello World!” then H 2 prints yes Else if P would not print it then H 2 prints “Hello World!” CSCE 355 Fall 2008
What does H 2 do when run on itself ? (figure 8. 6) H 2 yes Hello World! • But now consider P = H 2 • Note on H 2’s behavior now is n n – 23 – If H 2 would print “Hello World!” then H 2 prints yes Else if H 2 would not print it then H 2 prints “Hello World!” CSCE 355 Fall 2008
Contradiction • So assuming writing a program H that can tell whether another arbitrary program will print “Hello World!” is impossible • So some problems are not solvable by computers. • Godel’s Incompleteness Theorem – 24 – CSCE 355 Fall 2008
Distinguished sets of prefixes • IDEA again: • Let S = { a 1, a 2, … , an} • Then choose two arbitrary prefixes say ai and aj • Then let z = bi, • In this case ai bi is in L, but aj bi is not in L so L distinguishes the two prefixes • Thus L is not regular. – 25 – CSCE 355 Fall 2008
Mistakes Let S = { a 1, a 2, … , an} choose two prefixes ai and aj 1. Not letting k=j or k=0 in z = bjck 2. Not error but not needed: i>j, i-j < n 3. Show S 1 and S 2 are not regular therefore S 1 union S 2 is not regular. 4. S = { a 1 b 1 c 1, a 2 b 2 c 2, … , anbncn} or other sets in the language – 26 – CSCE 355 Fall 2008
Pumping Lemma {aibjck | i=j or i=k} – 27 – CSCE 355 Fall 2008
Mistakes: Pumping Lemma {aibjck | i=j or i=k} • Given n choose w independent of n. • Arbitrary w, no real choice. • aibici with no relation expressed between i and n. • Two separate cases aib 0 ci and aibic 0. – 28 – CSCE 355 Fall 2008
Homework 1. *8. 2. 1 b 2. ****8. 2. 3 – 29 – CSCE 355 Fall 2008
- Csce 355
- Csce 355
- Julius mathison turing
- 01:640:244 lecture notes - lecture 15: plat, idah, farad
- Sn bilangan ganjil
- Sentencia c-355 de 2006
- Sanglier attila 355 kg
- 645 rounded to the nearest hundred
- Ece 355
- Attila sanglier 355 kg
- Ece 355 understanding behavior & family dynamics
- Iat 355
- Iat 355
- Zoomology
- Sentencia 355 de 2006
- Factors of 355
- Iat 355
- Iat 355
- Mahmut kunter
- Kj355
- The theory of computation
- Parabon computation
- Types of error in numerical methods
- Fertilizer computation
- Transition graph in theory of computation
- Nutrition29
- Index de computation
- Umut acar
- Fertilizer computation philrice
- Ucl computer science modules