foundations of computer science lecture 26 turing machines
play

Foundations of Computer Science Lecture 26 Turing Machines The - PowerPoint PPT Presentation

Foundations of Computer Science Lecture 26 Turing Machines The Turing Machine: DFA with Random Access Memory (RAM) Transducer Turing Machines Infinite Loops Encodings of Turing Machines Last Time: CFGs and Pushdown Automata L = { w # w r | w


  1. Foundations of Computer Science Lecture 26 Turing Machines The Turing Machine: DFA with Random Access Memory (RAM) Transducer Turing Machines Infinite Loops Encodings of Turing Machines

  2. Last Time: CFGs and Pushdown Automata L = { w # w r | w ∈ { 0 , 1 } ∗ } S → # | 0 S 0 | 1 S 1 0 # 0 0 1 1 0 0 1 1 0 DFA with stack memory (push, pop, read). q 0 q 7 q 1 yes Push the first half of the string. or q 6 q 2 0 For each bit in the second half, pop the stack and compare. q 5 q 3 no q 4 DFAs with stack memory closely related to CFGs. Creator: Malik Magdon-Ismail Turing Machines: 2 / 13 Non Context Free →

  3. Non Context Free repetition { w # w } { 0 • n 1 • n 0 • n } multiple-equality { 0 • n 2 } , { 0 • n 1 • n 2 } squaring { 0 • 2 n } , { 0 • n 1 • 2 n } exponentiation w # w r 0 • n 1 • n 0 • n w # w Creator: Malik Magdon-Ismail Turing Machines: 3 / 13 Today →

  4. Non Context Free repetition { w # w } { 0 • n 1 • n 0 • n } multiple-equality { 0 • n 2 } , { 0 • n 1 • n 2 } squaring { 0 • 2 n } , { 0 • n 1 • 2 n } exponentiation w # w r 0 • n 1 • n 0 • n w # w 0 0 1 1 0 0 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0011 is pushed. 0011 is pushed. 000111 is pushed onto the stack. Creator: Malik Magdon-Ismail Turing Machines: 3 / 13 Today →

  5. Non Context Free repetition { w # w } { 0 • n 1 • n 0 • n } multiple-equality { 0 • n 2 } , { 0 • n 1 • n 2 } squaring { 0 • 2 n } , { 0 • n 1 • 2 n } exponentiation w # w r 0 • n 1 • n 0 • n w # w 0 0 1 1 0 0 1 1 # 1 1 0 0 0 0 1 1 0 0 0 1 1 1 1 p o p 1 ; h c t a 1 1 1 m 1 1 0 0 0 0 0 0 0 0011 is pushed. 0011 is pushed. 000111 is pushed onto the stack. DFA matches 1100 by popping. Creator: Malik Magdon-Ismail Turing Machines: 3 / 13 Today →

  6. Non Context Free repetition { w # w } { 0 • n 1 • n 0 • n } multiple-equality { 0 • n 2 } , { 0 • n 1 • n 2 } squaring { 0 • 2 n } , { 0 • n 1 • 2 n } exponentiation w # w r 0 • n 1 • n 0 • n w # w 0 0 1 1 0 0 1 1 # 1 1 0 0 0 0 1 1 # 0 0 1 1 0 0 1 1 0 0 0 1 1 1 1 p o p match; pop 1 ; h c t a 1 1 1 m 1 1 0 0 0 0 0 0 0 0011 is pushed. 0011 is pushed. 000111 is pushed onto the stack. DFA matches 1100 by popping. DFA needs bottom-access to match. Creator: Malik Magdon-Ismail Turing Machines: 3 / 13 Today →

  7. Non Context Free repetition { w # w } { 0 • n 1 • n 0 • n } multiple-equality { 0 • n 2 } , { 0 • n 1 • n 2 } squaring { 0 • 2 n } , { 0 • n 1 • 2 n } exponentiation w # w r 0 • n 1 • n 0 • n w # w 0 0 1 1 # 1 1 0 0 0 0 1 1 0 0 1 1 # 0 0 1 1 0 0 1 1 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 p o match; pop p match; pop 1 ; h c t a 1 1 1 m 1 1 0 0 0 0 0 0 0 0011 is pushed. 0011 is pushed. 000111 is pushed onto the stack. DFA matches 1100 by popping. DFA needs bottom-access to match. DFA needs random access to match. The file clerk who only has access to the top of his stack of papers has fundamentally less power than the file clerk who has a filing cabinet with access to all his papers. We need a new model, one with Random Access Memory (RAM). Creator: Malik Magdon-Ismail Turing Machines: 3 / 13 Today →

  8. Today: Turing Machines Solving a non context free language: w # w r . 1 Transducer Turing Machines. 2 Infinite Loops 3 Encodings of Turing Machines 4 Creator: Malik Magdon-Ismail Turing Machines: 4 / 13 Turing’s 1936 Miracle →

  9. Turing’s 1936 Miracle “On Computable Numbers with an Application to the Entscheidungsproblem” A classic which epitomizes the beauty of pure thought, where Alan Turing Invented a notion of what it means for a number to be computable. Invented the computer. Invented and used subroutines. Invented the programmable computer. Gave a negative answer to Hilbert’s Entscheidungsproblem. All this before the world even saw its first computer. Wow! (Oh, and by the way, he helped Britain win WWII against Hitler by decrypting the Enigma machine.) . . . and for all this, society drove him to suicide. Go figure! Creator: Malik Magdon-Ismail Turing Machines: 5 / 13 Turing’s Machine →

  10. Turing’s Machine L R q 0 q 5 q 1 q 4 q 3 q 2 ␣ ␣ ␣ * ␣ ␣ ␣ ␣ ␣ ␣ ␣ ␣ 0 0 1 0 0 1 # States. Can move L/R (or stay put) giving random access to an infinite read-write tape. Input written on the tape to start. Instructions specify what to do based on state and what is on the tape. Beacon symbol ∗ (start of the tape). Let’s see the capabilities of this machine on the non context free problem L = { w # w } . Creator: Malik Magdon-Ismail Turing Machines: 6 / 13 Solving w # w →

  11. Solving w # w 001 # 001 * 0 0 1 # 0 0 1 ␣ 1: Check for one “ # ”, otherwise reject (a DFA can do this). 2: Return to “ ∗ ”. 3: Move right to first non-marked bit before “ # ”. Mark the location and remember the bit. (If you reach “ # ” before any non-marked bit, goto step 5.) 4: Move right to first non-marked bit after “ # ”. If you reach “ ␣ ” before any non-marked bit, reject . If the bit does not match the bit from step 3, reject . Otherwise (bit matches), mark the location. goto step 2. 5: Move right to first non-marked bit after “ # ”. If you reach “ ␣ ” before any non-marked bit, accept . If you find a bit (string on the right is too long), reject . Creator: Malik Magdon-Ismail Turing Machines: 7 / 13 Turing Machine Instructions →

  12. Solving w # w 001 # 001 * 0 0 1 # 0 0 1 ␣ ✓ 1: Check for one “ # ”, otherwise reject (a DFA can do this). * 0 0 1 # 0 0 1 ␣ 2: Return to “ ∗ ”. 3: Move right to first non-marked bit before “ # ”. Mark the location and remember the bit. (If you reach “ # ” before any non-marked bit, goto step 5.) 4: Move right to first non-marked bit after “ # ”. If you reach “ ␣ ” before any non-marked bit, reject . If the bit does not match the bit from step 3, reject . Otherwise (bit matches), mark the location. goto step 2. 5: Move right to first non-marked bit after “ # ”. If you reach “ ␣ ” before any non-marked bit, accept . If you find a bit (string on the right is too long), reject . Creator: Malik Magdon-Ismail Turing Machines: 7 / 13 Turing Machine Instructions →

  13. Solving w # w 001 # 001 * 0 0 1 # 0 0 1 ␣ ✓ 1: Check for one “ # ”, otherwise reject (a DFA can do this). * 0 0 1 # 0 0 1 ␣ 2: Return to “ ∗ ”. ✓ ✓ * 0 0 1 # 0 0 1 ␣ 3: Move right to first non-marked bit before “ # ”. Mark the location and remember the bit. (If you reach “ # ” before any non-marked bit, goto step 5.) 4: Move right to first non-marked bit after “ # ”. If you reach “ ␣ ” before any non-marked bit, reject . If the bit does not match the bit from step 3, reject . Otherwise (bit matches), mark the location. goto step 2. 5: Move right to first non-marked bit after “ # ”. If you reach “ ␣ ” before any non-marked bit, accept . If you find a bit (string on the right is too long), reject . Creator: Malik Magdon-Ismail Turing Machines: 7 / 13 Turing Machine Instructions →

  14. Solving w # w 001 # 001 * 0 0 1 # 0 0 1 ␣ ✓ 1: Check for one “ # ”, otherwise reject (a DFA can do this). * 0 0 1 # 0 0 1 ␣ 2: Return to “ ∗ ”. ✓ ✓ * 0 0 1 # 0 0 1 ␣ 3: Move right to first non-marked bit before “ # ”. Mark the location and remember the bit. ✓ ✓ 2: * 0 0 1 # 0 0 1 ␣ (If you reach “ # ” before any non-marked bit, goto step 5.) 4: Move right to first non-marked bit after “ # ”. If you reach “ ␣ ” before any non-marked bit, reject . If the bit does not match the bit from step 3, reject . Otherwise (bit matches), mark the location. goto step 2. 5: Move right to first non-marked bit after “ # ”. If you reach “ ␣ ” before any non-marked bit, accept . If you find a bit (string on the right is too long), reject . Creator: Malik Magdon-Ismail Turing Machines: 7 / 13 Turing Machine Instructions →

  15. Solving w # w 001 # 001 * 0 0 1 # 0 0 1 ␣ ✓ 1: Check for one “ # ”, otherwise reject (a DFA can do this). * 0 0 1 # 0 0 1 ␣ 2: Return to “ ∗ ”. ✓ ✓ * 0 0 1 # 0 0 1 ␣ 3: Move right to first non-marked bit before “ # ”. Mark the location and remember the bit. ✓ ✓ 2: * 0 0 1 # 0 0 1 ␣ (If you reach “ # ” before any non-marked bit, goto step 5.) 4: Move right to first non-marked bit after “ # ”. ✓ ✓ ✓ 3: * 0 0 1 # 0 0 1 ␣ If you reach “ ␣ ” before any non-marked bit, reject . If the bit does not match the bit from step 3, reject . Otherwise (bit matches), mark the location. goto step 2. 5: Move right to first non-marked bit after “ # ”. If you reach “ ␣ ” before any non-marked bit, accept . If you find a bit (string on the right is too long), reject . Creator: Malik Magdon-Ismail Turing Machines: 7 / 13 Turing Machine Instructions →

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend