Like this presentation? Why not share!

477

Published on

No Downloads

Total Views

477

On Slideshare

0

From Embeds

0

Number of Embeds

0

Shares

0

Downloads

0

Comments

0

Likes

2

No embeds

No notes for slide

- 1. M. S. Ramaiah School of Advanced Studies 1 CSN2505 AFM Presentation Turing Machine Anshuman Biswal PT 2012 Batch, Reg. No.: CJB0412001 M. Sc. (Engg.) in Computer Science and Networking Module Leader: Dr. Hariharan Ramasangu Module Name: Applied Formal Methods Module Code : CSN2505
- 2. M. S. Ramaiah School of Advanced Studies 2 Marking Head Maximum Score Technical Content 10 Grasp and Understanding 10 Delivery – Technical and General Aspects 10 Handling Questions 10 Total 40
- 3. M. S. Ramaiah School of Advanced Studies 3 Presentation Outline • Introduction and Historical background • Historical Background-TM in WW-II • A Thinking machine-Successor Program Example • Turing Machine • Turing Machine Formal Definition and Description • Turing Machine Transition Functions • Turing Machine Instantaneous Description and Move • Turing Machine Example • Turing Machine Variants • Conclusion • Referenses
- 4. M. S. Ramaiah School of Advanced Studies 4 Introduction and Historical Background • The desire to capture the complexities of mathematical reasoning and computation in a simple and powerful manner has been a major theme of 20th Century mathematics. • The 1930’s saw two of these great negative results in the foundations of mathematics, the first of which was Godel’s very unexpected proof of 1931 (Godel’s Incompleteness Theorem). • 1936 saw the independent development of three influential models of computation :lambda calculus, recursive functions and Turing machines. • Alonzo Church’s lambda calculus and Steven Kleene’s recursive functions were arguably more elegant in this respect, but it was the mechanical action of Turing’s machines that most agreed with intuitions about how people go about computing mathematical functions.
- 5. M. S. Ramaiah School of Advanced Studies 5 • 1936-Alan Turing a British cryptologist invented a mechanical device, which from that day forth was called the “Turing machine”. • Based on Turing’s prior thoughts and ideas, his invention was able to compute every given mathematical expression . • It only consists of three main components: A tape (e.g. paper) that can hold data and serves as some kind of memory,a head that can read data from or write data to the tape and finally an application, which controls the whole process. • The Turing machine addresses two major problems of theoretical computer science, namely the decision problem and the halting problem. Introduction and Historical Background
- 6. M. S. Ramaiah School of Advanced Studies 6 • In 1936 Alan Turing was member of the Royal Army and worked in the British codebreaking centre, located at Bletchley Park in South East England. • His major task during World War II was breaking the Enigma, a device that was used by the Germans, in order to encode military messages. At least two different versions of the Enigma were commonly used at wartime: On the one hand the so-called “Wehrmachts-Enigma” and on the other hand a naval edition, which was primary used by German warships and submarines Historical Background-TM in WW-II
- 7. M. S. Ramaiah School of Advanced Studies 7 • Alan Turing made use of terms and phrases that were frequently used in German military so-called “cribs”. • He searched certain patterns and tried to understand the encoding algorithm. However a single message could be interpreted in more than 150 quadrillion ways (> 150,000,000,000,000 or 150 * 10¹²). • British scientists made use of technical support. They used a cluster of four Turing machines which could successfully decode a secret message within several hours and thus was a huge advantage for the Royal British Army in their battle against Nazi Germany. This machine is called the “Turing Bombe”. Historical Background-TM in WW-II
- 8. M. S. Ramaiah School of Advanced Studies 8 A Thinking Machine-Successor Program Imagine a super-organized, obsessive-compulsive human computer. The computer wants to avoid mistakes so everything written down is completely specified one letter/number at a time. The computer follows a finite set of rules which are referred to every time another symbol is written down. Rules are such that at any given time, only one rule is active so no ambiguity can arise. Each rule activates another rule depending on what letter/number is currently read, EG: Sample Rules: If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! Let’s see how they are carried out on a piece of paper that contains the reverse binary representation of 47:
- 9. M. S. Ramaiah School of Advanced Studies 9 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 1 1 1 1 0 1 A Thinking Machine-Successor Program
- 10. M. S. Ramaiah School of Advanced Studies 10 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 1 1 1 0 1 A Thinking Machine-Successor Program
- 11. M. S. Ramaiah School of Advanced Studies 11 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 0 1 1 0 1 A Thinking Machine-Successor Program
- 12. M. S. Ramaiah School of Advanced Studies 12 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 0 0 1 0 1 A Thinking Machine-Successor Program
- 13. M. S. Ramaiah School of Advanced Studies 13 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 0 0 0 0 1 A Thinking Machine-Successor Program
- 14. M. S. Ramaiah School of Advanced Studies 14 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 0 0 0 1 1 A Thinking Machine-Successor Program
- 15. M. S. Ramaiah School of Advanced Studies 15 So the successor’s output on 111101 was 000011 which is the reverse binary representation of 48. Similarly, the successor of 127 should be 128: A Thinking Machine-Successor Program
- 16. M. S. Ramaiah School of Advanced Studies 16 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 1 1 1 1 1 1 1 A Thinking Machine-Successor Program
- 17. M. S. Ramaiah School of Advanced Studies 17 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 1 1 1 1 1 1 A Thinking Machine-Successor Program
- 18. M. S. Ramaiah School of Advanced Studies 18 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 0 1 1 1 1 1 A Thinking Machine-Successor Program
- 19. M. S. Ramaiah School of Advanced Studies 19 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 0 0 1 1 1 1 A Thinking Machine-Successor Program
- 20. M. S. Ramaiah School of Advanced Studies 20 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 0 0 0 1 1 1 A Thinking Machine-Successor Program
- 21. M. S. Ramaiah School of Advanced Studies 21 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 0 0 0 0 1 1 A Thinking Machine-Successor Program
- 22. M. S. Ramaiah School of Advanced Studies 22 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 0 0 0 0 0 1 A Thinking Machine-Successor Program
- 23. M. S. Ramaiah School of Advanced Studies 23 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 0 0 0 0 0 0 A Thinking Machine-Successor Program
- 24. M. S. Ramaiah School of Advanced Studies 24 If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read •, write 1, HALT! 0 0 0 0 0 0 0 1 A Thinking Machine-Successor Program
- 25. M. S. Ramaiah School of Advanced Studies 25 It was hard for the ancients to believe that any algorithm could be carried out on such a device. For us, it’s much easier to believe, especially if we’ve programmed in assembly! However, ancients did finally believe Turing when Church’s lambda-calculus paradigm (on which lisp programming is based) proved equivalent! A Thinking Machine
- 26. M. S. Ramaiah School of Advanced Studies 26 Turing Machines A Turing Machine (TM) is a device with a finite amount of read-only “hard” memory (states), and an unbounded amount of read/write tape-memory. There is no separate input. Rather, the input is assumed to reside on the tape at the time when the TM starts running.
- 27. M. S. Ramaiah School of Advanced Studies 27 TM Formal Definition • DEF: A Turing machine (TM) consists of a the 8-tuple: M = (Q, , Γ, δ, q0, B, qa, qr) G is the tape alphabet which necessarily contains the blank symbol •, as well as the input alphabet S. d is as follows: Therefore given a non-halt state p, and a tape symbol x, d(p,x) = (q,y,D) means that TM goes into state q, replaces x by y, and the tape head moves in direction D. }RL,{}),{-(:δ rejacc GG QQ qq
- 28. M. S. Ramaiah School of Advanced Studies 28 Turing Machine Description • Q = finite states of the control , set of states • = finite set of input symbols, which is a subset of Γ below, input alphabet • Γ = finite set of tape symbols, tape alphabet • δ = partial transition function. δ(q,X) are a state and tape symbol X. – The output is the triple, (p, Y, D) – Where p = next state, Y = new symbol written on the tape, D = direction to move the tape head • q0= start state for finite control, initial state • B = blank symbol. This symbol is in Γ but not in . • qaccept = set of final or accepting states of Q. • qreject = set of rejecting states of Q
- 29. M. S. Ramaiah School of Advanced Studies 29 TM Transition Functions The transition function for Turing machines is given by }RL,{}),{-(:δ rejacc GG QQ qq This means: When the machine is in a given state (Q) and reads a given symbol (Γ) from the tape, it replaces the symbol on the tape with some other symbol (Γ), goes to some other state (Q), and moves the tape head one square left (L) or right (R)
- 30. M. S. Ramaiah School of Advanced Studies 30 TM Instantaneous description and Move • An instantaneous description or configuration of a Turing machine requires (1) the state the Turing machine is in, (2) the contents of the tape, and (3) the position of the tape head on the tape. This can be summarized in a string of the form xi...xjqmxk...xl where the x's are the symbols on the tape, qm is the current state, and the tape head is on the square containing xk (the symbol immediately following qm). • A move of a Turing machine can therefore be represented as a pair of instaneous descriptions, separated by the symbol " ├”. For example, if (q5, b) = (q8, c, R)then a possible move might be abbabq5babb ├ abbabcq8abb
- 31. M. S. Ramaiah School of Advanced Studies 31 TM Example • Make a TM that recognizes the language L = { w#w | w (0,1)* }. That is, we have a language separated by a # symbol with the same string on both sides. • Here is a strategy we can employ to create the Turing machine: – read the first symbol, then cross it out, and then, remember what that symbol was, move until it reaches the # – Then check to see if the symbols match, and if they do cross it off and go back to the symbol after the one we crossed out, – and then continue in this same manner, except going to the first non- crossed off symbol in the transversals. – Finally we need to make sure that we accept if this is all that the input consists of. • Here is a formal description of a Turing machine which does this 1. Q = {q1; q2; : : : q8; qa; qr} 2. = {0,1,#} and G = {0, 1,x,#,_} 3. The start state is q1. The accept state is qa. The reject state is qr.
- 32. M. S. Ramaiah School of Advanced Studies 32 TM Example And now we need to specify the transition function. We do this with a state diagram.
- 33. M. S. Ramaiah School of Advanced Studies 33 • Now there are some points about this transition function which we should point out. First of all where is the reject state qr? Well we have obmitted it. Indeed we have followed a convention where every allowed transition which is not labeled is a transition to qr. •All rules should be of the form s → a, d where s, a ϵ G and d ϵ {L,R} But some of these don't have an a, i.e. they are of the form s → d. This is shorthand for the fact that the same symbol which is on the tape is being written onto the tape, i.e. that symbol is not changed. Finally we often write multiple elements which lead to the transition separated via commas. TM Example
- 34. M. S. Ramaiah School of Advanced Studies 34 TM Example- Instantaneous Description • Sometimes it is useful to describe what a TM does in terms of its ID (instantaneous description.) • The ID shows all non-blank cells in the tape, pointer to the cell the head is over with the name of the current state – use the turnstile symbol ├ to denote the move. – As before, to denote zero or many moves, we can use ├*. • Let's run through how this machine acts on an input. Lets do 010#010.
- 35. M. S. Ramaiah School of Advanced Studies 35 TM Example Inputs i.e Symbols on Tape is 010#010 • q1010#010 ├ xq210#010 • ├ x1q20#010├ x10q2#010 • ├ x10#q4010 ├ x10q6#x10 • ├ x1q70#x10 ├ xq710#x10 • ├ q7x10#x10 ├ xq110#x10 • ├ xxq30#x10 ├ xx0q3#x10 • ├ xx0#q5x10 ├ xx0#xq510 • ├ xx0#q6xx0 ├ xx0q6#xx0 • ├ xxq70#xx0 ├ xq7x0#xx0 • ├ xxq10#xx0 ├ xxxq2#xx0 • ├ xxx#q4xx0 ├ xxx#xq4x0 • ├ xxx#xq6xx ├ xxx#q6xxx • ├xxxq6#xxx├xxq7x#xxx • ├xxxq1#xxx├xxx#q8xxx • ├ xxx#xq8xx ├ xxx#xxq8x • ├ xxx#xxxq8 ├ xxx#xxx_qa
- 36. M. S. Ramaiah School of Advanced Studies 36 Turing Machine Variants • There are a number of other types of Turing machines in addition to the one we have seen. • Turing Machines with Two Dimensional Tapes : It has one finite control, one read-write head and one two dimensional tape. The tape has the top end and the left end but extends indefinitely to the right and down. • Here the numbers indicate the correspondence of squares in the two tapes: square i of the two dimensional tape is mapped to square i of the one dimensional tape. h and v are symbols which are not in the tape alphabet and they are used to mark the left and the top end of the tape, respectively.
- 37. M. S. Ramaiah School of Advanced Studies 37 • Turing Machines with Multiple Tapes : This is a kind of Turing machines that have one finite control and more than one tapes each with its own read- write head. It is denoted by a 5-tuple < Q , , q0, d > • Its transition function is a partial function d : Q X ( G {} )n -> ( Q { h } ) X ( G {} )n X{R ,L,S }n . • A configuration for this kind of Turing machine must show the current state the machine is in and the state of each tape. • Turing Machines with Multiple Heads : This is a kind of Turing machines that have one finite control and one tape but more than one read-write heads. In each state only one of the heads is allowed to read and write. It is denoted by a 5-tuple < Q , , G, q0, d >. The transition function is a partial function d : Q X { H1 , H2 ... , Hn } X( G {} ) -> (Q { h } )X( G {} )X { R , L , S } , where H1 , H2 ... , Hn denote the tape heads. Turing Machine Variants
- 38. M. S. Ramaiah School of Advanced Studies 38 • Turing Machines with Infinite Tape : This is a kind of Turing machines that have one finite control and one tape which extends infinitely in both directions. • Nondeterministic Turing Machines :A nondeterministic Turing machine is a Turing machine which, at any state it is in and for the tape symbol it is reading, can take any action selecting from a set of specified actions rather than taking one definite predetermined action. Even in the same situation it may take different actions at different times. Here an action means the combination of writing a symbol on the tape, moving the tape head and going to a next state. • Formally a nondeterministic Turing machine is a Turing machine whose transition function takes values that are subsets of (Q { h } ) X (G {}X{ R , L , S } Turing Machine Variants
- 39. M. S. Ramaiah School of Advanced Studies 39 Conclusion • It is often said that Turing machines, are as powerful as real machines, and are able to execute any operation that a real program can. • According to Church-Turing thesis any possible calculation can be performed by an algorithm, running on a computer that provides sufficient time and storage space. Admittedly it is just pure theory, when we say that a Turing machine can solve every given mathematical problem. In practice this idea is very limited like they do not model the concurrency well i.e. There is a bound on the size of the integer
- 40. M. S. Ramaiah School of Advanced Studies 40 References [1] H,Willkommen. (June 25 2006) “The Turing Machine Artikel ” [Online]. Available from:http://www.saschaseidel.de/html/programmierung/pr ogrammierungindex.html (Accessed: 08 June 2013). [2] Wikipedia. “Turing machine”. [Online].Available from: http://en.wikipedia.org/wiki/Turing_machine (Accessed:18 June 2013)

Be the first to comment