html5-img
1 / 84

::ICS 804:: Theory of Computation - Ibrahim Otieno - iotieno@uonbi.ac.ke +254-0722-429297

::ICS 804:: Theory of Computation - Ibrahim Otieno - iotieno@uonbi.ac.ke +254-0722-429297 SCI/ICT Building Rm. G15. Course Outline. Mathematical Preliminaries Turing Machines Recursion Theory Markov Algorithms Register Machines Regular Languages and finite-state automata

gelsey
Télécharger la présentation

::ICS 804:: Theory of Computation - Ibrahim Otieno - iotieno@uonbi.ac.ke +254-0722-429297

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ::ICS 804:: Theory of Computation - Ibrahim Otieno - iotieno@uonbi.ac.ke +254-0722-429297 SCI/ICT Building Rm. G15

  2. Course Outline • Mathematical Preliminaries • Turing Machines • Recursion Theory • Markov Algorithms • Register Machines • Regular Languages and finite-state automata • Aspects of Computability

  3. Last Time: Turing Machines • What is Computation? • Informal Description of Turing Machines • Formal Description of Turing Machines • Turing Machines as Language acceptors and Language recognizers • Turing Machines as Computers of number-theoretic functions • Modular Turing Machines • Complexity Theory

  4. Course Outline • Mathematical Preliminaries • Turing Machines • Additional Varieties of Turing Machines • Recursion Theory • Markov Algorithms • Register Machines • Regular Languages and finite-state automata • Aspects of Computability

  5. Additional Varieties of Turing Machines • Turing Machines with One-Way-Infinite tape • Turing Machines that accept by terminal state • Multitape Turing Machines • Encoding of Turing Machines • Universal Turing Machines • Nondeterministic Turing Machines • Turing-Computability • Turing Machines and Artificial Intelligence • Turing Machines and Cognitive Science

  6. Turing Machines with One-Way-Infinite Tape

  7. Tapes • So far: Turing machines with two-way infinite tape • Turing (1936): one-way infinite tape • No difference in computational power • A function Turing computable in a 2-way infinite tape setup is also Turing computable with a 1-way infinite tape

  8. Turing Machines with One-Way-Infinite Tape • Machine tape infinite only to the right • Leftmost tape square containing left endmarker  (use , in Deus Ex Machina) • What happens on reaching left most square? • One-way function computation • One-way language acceptance (recognition)

  9. Equivalence Result • Central to theory of computability • Let f be a k-ary number-theoretic function: • Then there exists a Turing Machine with two-way-infinite tape that two-way computes f if and only if there exists a Turing machine with one-way-infinite tape that one-way computes f

  10. Turing Machines that accept by terminal state

  11. Acceptance (Recap) • Word acceptance: Deterministic Turing Machine M accepts nonempty word w if, when started scanning the leftmost symbol of w on an input tape that contains w and is otherwise blank, M ultimately halts scanning a 1 on an otherwise blank tape. • “Acceptance by 1”

  12. Terminal State • A single terminal state qt( “one or more”) • Sex-tuple Q, S, G, qinit, qt , d • qt Q • d is undefined for pairs of the form < qt , d > • Turing Machine M can still halt in any other state • Not necessarily distinct from qinit • Exercise: Draw a TM that accepts L = { (abc)n | n >=1} by terminal state

  13. Language Acceptance by Terminal State • M accepts w if halts in qt • M accepts language L by terminal state provided that M accepts, by terminal state, all and only the words of L • Tape content upon halting in state qt is not defined • No requirement that M has read word w completely

  14. Equivalence Result • Theorem: Let L be a language over alphabet S. Then there exists a Turing machine that accepts L “by 1” if and only if there exists a Turing machine that accepts L by terminal state. • Equivalence result: forward and reverse proof involve maintaining new end markers  and 

  15. Multitape Turing Machines

  16. Multitape Turing Machines • Has K+2 tapes where K >= 0 • (Possibly read-only) input tape at top • (Possibly write-only) output tape at bottom • 0 or more worktapes in between • Referred to as offline TM

  17. No worktapes Initially input tape: H11111111 output tape: HB Ultimately halts in the configuration input tape: H11111111 (unchanged) output tape: H1111

  18. Worktapes Initially input tape: HababB worktape1: HBBBBB worktape2: HBBBBB … output tape: HBBBBB Ultimately halts in the configuration input tape: HababB (unchanged) worktape1: … worktape2: … … output tape: H1BBB

  19. Clarification • Let M be a multitape Turing machine. Suppose that tape t is one of M’s k + 2tapes. In general, determination of which action is to be taken by the read/write head on tape t will depend on the symbols currently being scanned on tapes other than t and not merely on the symbol currently being scanned on tape t itself.

  20. Language Acceptance Suppose that (k+2)-tape Turing Machine M is started scanning the leftmost symbol of nonempty input word w on its input tape, which is otherwise blank initially. Suppose all the other tapes are blank as well. Then if M halts with its first read-head scanning the leftmost symbol of w on its input tape, which is otherwise blank, and scanning a single 1 on its output tape, which is otherwise blank, then we shall say that M accepts word w

  21. Example {w *|na(w) = nb(w)}

  22. Example • Instructions for each tape. Often: only 1 tape is reading/writing. Other tapes: “a:a” type instructions

  23. Example • Copies occurrences of a unto worktape1 and occurrences of b unto worktape2. Then M ascertains whether the number of a’s on worktape1 is the same as the number of b’s on worktape2

  24. Example Deus Ex Machina: • Machine: SAMNUM4T.TM • Try tapes 6A4BMULT.TT and 9A9BMULT.TT

  25. Example Calculate Time complexity Single-tape: O(n2) Multi-tape: O(n)

  26. Parallel Computation? Let M be a multitape Turing Machine. Suppose that tape t is one of M’s k+2 tapes. In general, determination of which action is to be taken by the read/write head on tape t will depend on the symbols currently being scanned on tapes other than t and not merely on the symbol currently being scanned • No individual processors: no parallel computation • Single processor controlling multiple tape heads

  27. Exercise • Develop a TM that accepts L = { (an | n is prime}

  28. Time/Space trade-off timeM(n) spaceM(n) • Adding tapes increases spaceM but generally decreases timeM

  29. Equivalence Results • Theorem A language L is accepted by some multitape Turing machine if and only if L is accepted by some single-tape Turing machine. • Theorem A language L is recognized by some multitape Turing machine if and only if L is recognized by some single-tape Turing machine.

  30. Another Equivalence Result • Theorem Similarly, a function f is computed by some multitape Turing machine if and only if it is computed by some single-tape Turing machine. •  always trivial • Proof idea for : Tape alphabet of single-tape simulator M will be large; one symbol  will represent entire “section” through tapes of multitape M´

  31. Time and Space • Corollary Suppose that language L is accepted by k-tape Turing machine M. Then L is accepted by a single-tape Turing machine M1 such that timeM1(n) is O([timeM(n)]2) • Corollary Suppose that language L is accepted by k-tape Turing machine M. Then L is accepted by a single-tape Turing machine M´ such that spaceM´(n) is O(spaceM(n)).

  32. Off-line Turing Machines • Multitape machines: improved time analysis • Singletape machines: space analysis involves counting the number of tape squares visited over the course of a computation  usually visit all squares of the input  no single-tape machine will compute in less than O(n) space

  33. Encoding of Turing Machines

  34. Encoding of Turing Machines • Any Turing machine can be represented by a natural number code • ASCII-style encoding • Euler-Gödel encoding

  35. a:B q0 q1 B:R B:1 q2 s’:s q q’ s:R s:s’’ q’’ ASCII • Describes language {an|n0} • Slight changes to make it more general <q,s’,s,q’> <q’,s,R,q> <q,s,s’’,q’’>

  36. s’:s q q’ s:R s:s’’ q’’ ASCII <q,s’,s,q’> <q’,s,R,q> <q,s,s’’,q’’> • q: is always initial state • Any Turing machine: finite set S of quadruples • We want to represent S by a single symbol string

  37. ASCII • q: is always initial state • Any Turing machine: finite set S of quadruples • We want to represent S by a single symbol string 3*2 different ways: q,s’,s,q’;q’,s,R,q;q,s,s’’,q’’ q,s’,s,q’;q,s,s’’,q’’;q’,s,R,q q’,s,R,q;q,s’,s,q’;q,s,s’’,q’’ q’,s,R,q;q,s,s’’,q’’;q,s’,s,q’ q,s,s’’,q’’;q’,s,R,q;q,s’,s,q’ q,s,s’’,q’’;q,s’,s,q’;q’,s,R,q

  38. ASCII q,s’,s,q’;q’,s,R,q;q,s,s’’,q’’ q,s’,s,q’;q,s,s’’,q’’;q’,s,R,q q’,s,R,q;q,s’,s,q’;q,s,s’’,q’’ q’,s,R,q;q,s,s’’,q’’;q,s’,s,q’ q,s,s’’,q’’;q’,s,R,q;q,s’,s,q’ q,s,s’’,q’’;q,s’,s,q’;q’,s,R,q Each of these is a string over Turing Machine description alphabet , containing the seven symbols q ‘ s L R , ; Represent each of these options as a binary digit string: associate symbols of alphabet with binary-digit strings of e.g. length 3

  39. ASCII q,s’,s,q’;q’,s,R,q;q,s,s’’,q’’ 001 000 010 110 000 010 000 001 110 101 001 110 000 010 000 011 000 001 101 001 000 010 000 010 000 010 110 110 000 001 110 110 = symbol code of machine M Encode M as a natural number: ASCII code of M = natural number denoted by the 90 digit string interpreted as a binary numeral

  40. ASCII • Turing machines will not have unique ASCII codes • No natural number that encodes a Turing machine will be the ASCII code of more than one Turing machine • Most natural numbers are not ASCII codes • If n is a code, then it is the code of a unique machine (retrievability property).

  41. Euler-Gödel • Based on prime decomposition e.g. 18720 = 25.32.51.131 • Associate each member of alphabet  with a natural number :   {1,2,3,4,5,6,7}

  42. Euler-Gödel • List prime numbers for each symbol and put it to the power of the function call of that symbol 22.31.53.77.111.133.171.192.237.296.312.377.411.434.471.534.591.612.676.712.731.793.831.893.977.1017.1031.1072.1097.1137. q,s’,s,q’;q’,s,R,q;q,s,s’’,q’’

  43. Euler-Gödel • Turing machines do not have unique Gödel numbers • No natural number that is the Gödel number of a Turing Machine will be the Gödel number of more than one Turing Machine • Given a natural number, there is a simple algorithm for determining if it is the Gödel number of a Turing Machine and which one it is

  44. Decoding • 577565488500 is the alleged Gödel number of a Turing Machine • Prime decomposition • 577565488500 = 22 . 144391372125 • 577565488500 = 22 . 31 . 48130457375 • … • 577565488500 = 22 . 31 . 53 . 71 . 114 . 131 . 172

  45. Decoding • 577565488500 = 22 . 31 . 53 . 71 . 114 . 131 . 172 • q,B,R,q B:R q

  46. Universal Turing Machines

  47. Universal Turing machines • So far: machines in a peculiar sense • Single program, single set of instructions • Change 1 instruction  change the machine • Can our TM be programmed to simulate behavior of any TM whatsoever?

  48. Universal Turing machines • Usual sense of a machine: machine (hardware) that can run several programs (software) • Digital Computer: Universal Computing device that - suitably programmed (and ignoring resource limits) - can compute any function that is in principle computable

  49. Definition Turing Machine M* is universal if, for any Turing Machine M with input alphabet , when M* is started scanning the leftmost 1 in an unbroken string of n0+1 1s (n0 being the encoding of machine M) followed by a single blank followed by word w over , M* transforms w exactly as machine M would transform it

  50. UTMs as language acceptors / transducers

More Related