Turing Machines (TM)

Turing Machines (TM)

Turing Machines (TM) • The Turing machine is the ultimate model of computation. TURING MACHINES Alan Turing (1912–1954), British mathematician/engineer and one of the most influential scientists of the last century. 1 2 Turing Machines (TM) Turing Machines (TM) In 1936, Turing introduced his abstract Alan Turing was one of the founding fathers of CS. model for computation. • His computer model –the Turing Machine– was inspiration/premonition of the electronic computer that came two decades later The Turing machine model has become the • Was instrumental in cracking the Nazi Enigma cryptosystem in WWII standard in theoretical computer science. Think of a Turing Machine as a DPDA that can • Invented the “Turing Test” used in AI move freely through its stack (= tape). • Legacy: The Turing Award. Pre-eminent award in Theoretical CS 3 4 Turing Machines (TM) Turing Machines (TM) A Thinking Machine A Thinking Machine First Goal of Turing’s Machine: A model that can Second Goal of Turing’s Machine: A model that’s compute anything that a human can compute. so simple, that can actually prove interesting Before invention of electronic computers the epistemological results. Eyed Hilbert’s 10th term “computer” actually referred to a person problem, as well as a computational analog of who’s line of work is to calculate numerical Gödel’s Incompleteness Theorem in Logic. quantities! Philosophy notwithstanding, Turing’s programs for As this is a philosophical endeavor, it can’t really cracking the Enigma cryptosystem prove that he be proved. really was a true hacker! Turing’s machine is Turing’s Thesis: Any “algorithm” can be carried out actually easily programmable, if you really get by one of his machines into it. Not practically useful, though… 5 6 1 Turing Machines (TM) Turing Machines (TM) A Thinking Machine A Thinking Machine: Example: Successor Program Imagine a super-organized, obsessive-compulsive human computer. The computer wants to avoid Sample Rules: mistakes so everything written down is completely specified one letter/number at a time. If read 1, write 0, go right, repeat. The computer follows a finite set of rules which are referred to every time another symbol is If read 0, write 1, HALT! written down. Rules are such that at any given If read •, write 1, HALT! time, only one rule is active so no ambiguity can arise. Each rule activates another rule Let’s see how they are carried out on a piece of depending on what letter/number is currently paper that contains the reverse binary read. representation of 47: 111101 7 8 Turing Machines (TM) Turing Machines (TM) A Thinking Machine: Example: Successor Program A Thinking Machine: Example: Successor Program If read 1, write 0, go right, repeat. If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read 0, write 1, HALT! If read •, write 1, HALT! If read •, write 1, HALT! 1 1 1 1 0 1 0 1 1 1 0 1 9 10 Turing Machines (TM) Turing Machines (TM) A Thinking Machine: Example: Successor Program A Thinking Machine: Example: Successor Program If read 1, write 0, go right, repeat. If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read 0, write 1, HALT! If read •, write 1, HALT! If read •, write 1, HALT! 0 0 1 1 0 1 0 0 0 1 0 1 11 12 2 Turing Machines (TM) Turing Machines (TM) A Thinking Machine: Example: Successor Program A Thinking Machine: Example: Successor Program If read 1, write 0, go right, repeat. If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read 0, write 1, HALT! If read •, write 1, HALT! If read •, write 1, HALT! 0 0 0 0 0 1 0 0 0 0 1 1 13 14 Turing Machines (TM) Turing Machines (TM) A Thinking Machine: Example: Successor Program A Thinking Machine: Example: Successor Program If read 1, write 0, go right, repeat. So the successor’s output on 111101 was If read 0, write 1, HALT! 000011 which is the reverse binary If read •, write 1, HALT! representation of 48. Similarly, the successor of 127 should be 1 1 1 1 1 1 1 128: 15 16 Turing Machines (TM) Turing Machines (TM) A Thinking Machine: Example: Successor Program A Thinking Machine: Example: Successor Program If read 1, write 0, go right, repeat. If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read 0, write 1, HALT! If read •, write 1, HALT! If read •, write 1, HALT! 0 1 1 1 1 1 1 0 0 1 1 1 1 1 17 18 3 Turing Machines (TM) Turing Machines (TM) A Thinking Machine: Example: Successor Program A Thinking Machine: Example: Successor Program If read 1, write 0, go right, repeat. If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read 0, write 1, HALT! If read •, write 1, HALT! If read •, write 1, HALT! 0 0 0 1 1 1 1 0 0 0 0 1 1 1 19 20 Turing Machines (TM) Turing Machines (TM) A Thinking Machine: Example: Successor Program A Thinking Machine: Example: Successor Program If read 1, write 0, go right, repeat. If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read 0, write 1, HALT! If read •, write 1, HALT! If read •, write 1, HALT! 0 0 0 0 0 1 1 0 0 0 0 0 0 1 21 22 Turing Machines (TM) Turing Machines (TM) A Thinking Machine: Example: Successor Program A Thinking Machine: Example: Successor Program If read 1, write 0, go right, repeat. If read 1, write 0, go right, repeat. If read 0, write 1, HALT! If read 0, write 1, HALT! If read •, write 1, HALT! If read •, write 1, HALT! 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 23 24 4 Turing Machines (TM) Turing Machines (TM) A Thinking Machine: Example: Successor Program It was hard for the ancients to believe that any A Turing Machine (TM) is a device with a finite algorithm could be carried out on such a device. amount of read-only “hard” memory (states), and For us, it’s much easier to believe, especially if an unbounded amount of read/write tape- memory. There is no separate input. Rather, you’ve programmed in assembly! the input is assumed to reside on the tape at the However, ancients did finally believe Turing when time when the TM starts running. Church’s lambda-calculus paradigm (on which Just as with Automata, TM’s can either be lisp programming is based) proved equivalent! input/output machines (compare with Finite State Transducers), or yes/no decision machines. 25 26 Turing Machines (TM) Turing Machines (TM) A Comparison with FA Church Turing thesis TM can both write to and read from the tape The head can move left and right Church Turing Thesis: all reasonable models of computation can be simulated by a (single The string doesn’t have to be read entirely tape) Turing machine. Accept and Reject take immediate effect If we want to investigate what we can and can not do using computers, it is sufficient to study the Turing machine model. 27 28 Turing Machines (TM) Turing Machines (TM) A Comparison with FA and PDA A Comparison with FA and PDA Separate Read/Write Data Deterministic Separate Read/Write Data Deterministic Device Device Input? Structure by default? Input? Structure by default? FA FA Yes None Yes PDA PDA TM TM 29 30 5 Turing Machines (TM) Turing Machines (TM) A Comparison with FA and PDA A Comparison with FA and PDA Separate Read/Write Data Deterministic Separate Read/Write Data Deterministic Device Device Input? Structure by default? Input? Structure by default? FA Yes None Yes FA Yes None Yes PDA Yes LIFO Stack No PDA Yes LIFO Stack No 1-way infinite Yes TM TM No tape. 1 cell (but will also access per step. allow crashes) 31 32 Turing Machines (TM) Turing Machines (TM) read write move 0 ? 0, R ¨ ? ¨, R FINITE qaccept STATEq10 CONTROL 0 ? 0, R ¨ ? ¨, R 0 ? 0, R qreject ¨ ? ¨, L AI N P U T INFINITE TAPE 33 34 Turing Machines (TM) Turing Machines (TM) Notations Notations An edge from the state p to the state q labeled A TM’s next action is completely determined by by … current state and symbol read, so can • aàb,D means if in state p and tape head predict all of future actions if know: reading a, replace a by b and move in the 1. current state direction D, and into state q 2. current tape contents • aàD means if in state p and tape head 3. current position of TM’s reading “head” reading a, don’t change a and move in the direction D, and into state q • a|b|…|z à … means that given that the tape head is reading any of the pipe separated symbols, take same action on any of the symbols 35 36 6 Turing Machines (TM) Turing Machines (TM) Example: Definition STATE A Turing Machine is a 7-tuple q0, FINDq1, #FIND # q#, FINDq0, ¨FINDq1, ¨FIND ¨ qGO LEFT T = (Q, S, G, d, q0, qaccept, qreject), where: Q is a finite set of states S is the input alphabet, where ¨ Ï S 0 10x 1x #1 0# 01x 1 1 Gis the tape alphabet, where ¨ Î Gand S Í G d : Q ´ G? Q ´ G´ {L,R} q0 Î Q is the start state Testing membership in B = { w#w | w Î {0,1}* } qaccept Î Q is the accept state 37 38 qreject Î Q is the reject state, and qreject ¹ qaccept Turing Machines (TM) Turing Machines (TM) CONFIGURATIONS Informal Description At every step, 11010q 00110 Internal State the head of the 7 set Q TM M reads a L R letter xi from the one-way infinite q7 0 1 1 _ 0 # 1 _ _ L tape.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    17 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us