1 / 24

INHERENT LIMITATIONS OF COMPUTER PROGRAMS

CSci 4011. INHERENT LIMITATIONS OF COMPUTER PROGRAMS. FINITE STATE CONTROL. TURING MACHINE. q 0. q 1. I. N. P. U. T. A. INFINITE TAPE. A TM recognizes a language if it accepts all (and only) strings in the language.

ardith
Download Presentation

INHERENT LIMITATIONS OF COMPUTER PROGRAMS

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. CSci 4011 INHERENT LIMITATIONS OF COMPUTER PROGRAMS

  2. FINITE STATE CONTROL TURING MACHINE q0 q1 I N P U T A INFINITE TAPE

  3. A TM recognizes a language if it accepts all (and only) strings in the language. A TM decides a language if it accepts all strings in the language and rejects all strings not in the language A language is called decidable or recursive if some TM decides it

  4. Theorem: If L is decidable then so is its negation. Proof: Let M = (Q,,,,q0,qaccept,qreject) decide L. We construct M’ that decides ¬L. M’ = (Q,,,,q0,qreject,qaccept), i.e. M with qreject and qaccept swapped. Suppose that w ∈L. Then M’ rejects w, since M will go to qaccept on w. Suppose that w L. Then M’ accepts w, since M will go to qreject on w.

  5. Theorem: If L1 and L2 are decidable then so is L1 ∩ L2 = { w | w ∈L1 and w ∈L2 }. Proof: Let M1 decide L1 and M2 decide L2. We build a two-tape TM M’ to decide L1 ∩ L2.

  6. FINITE STATE CONTROL MULTITAPE TURING MACHINES  : Q Γk→ Q Γk  {L,R,S}k

  7. Theorem: If L1 and L2 are decidable then so is L1 ∩ L2 = { w | w ∈L1 and w ∈L2 }. Proof: Let M1 decide L1 and M2 decide L2. We build a two-tape TM M’ to decide L1∩L2. M’ works as follows: 1. Copy the input to tape 2 and move to left edge 2. Run M1 on tape 1 and M2 on tape 2. If either M1 or M2 reject, go to qreject If both M1 and M2 accept, go to qaccept

  8. Formally, let Mi = (Qi,,i,i,qsi,qai,qri). Then M’ = (Q,,,,q0,qa,qr), where: Q = Q1⨉Q2∪Qcp,  = 1∪2∪cp, ((q1,q2),s1,s2) = (qr,s1,s2,S,S), if q1 = q1r or q2 = q2r (qa,s1,s2,S,S), if q1= q1a and q2 = q2a ((q1,q2’),s1,s2’,S,d2), if q1=q1a ((q1’,q2),s1’,s2,d1,S), if q2=q2a ((q1’,q2’),s1’,s2’,d1,d2), else where (qi’,si’,di) = i(qi,si)

  9. FINITE STATE CONTROL FINITE STATE CONTROL Theorem: Every Multitape Turing Machine can be transformed into a single tape Turing Machine 1 0 0 # # 1 0 0 #

  10. SIMULATING MULTIPLE TAPES ● ● ● ● L#100#0#□#R L#100#0#1#R 100 L#100#□#□#R qi qi1 qjRSS qj qi1□□ qi1□ qj101RSS 1. “Format” tape. 2. For each move of the k-tape TM: Scan left-to-right, finding current symbols Scan left-to-right, writing new symbols Scan left-to-right, moving each tape head. 3. If a tape head goes off right end, insert blank. If tape head goes off left end, move back right.

  11. FINITE STATE CONTROL DOUBLE UNBOUNDED TURINGMACHINE I N P U T UNBOUNDED TAPE

  12. Theorem: Double Unbounded Turing Machines are equivalent to ordinary Turing Machines Proof: To simulate ordinary machine: Go left, write“L”, go right. On “L” in any state, go right. To simulate a double unbounded tape: Insert “L” at left edge. Write “R” at right edge. On “L” or “R” insert □.

  13. ENUMERATORS …Are TMs with “print” and “halt” states instead of “accept” and “reject” A string w is in L(E) if E eventually goes into “print” state with w on the tape.

  14. Terminology A TM decides L if it accepts all strings in L language and rejects all strings not in L A language is called decidable or recursive if some TM decides it A TM recognizes a language if it accepts all and only those strings in the language A language is called Turing-recognizable if some TM recognizes it A language L is called recursively enumerable if for some enumerator E, L(E) = L.

  15. Theorem: L is Turing-recognizable ⇔ L is recursively enumerable. ⇐:Let L be enumerated by E. We write a 2-tape TM that recognizes L. INPUT: ENUM: 10110011… 01101001… Run E on tape 2; when E goes to “print” state, Check if tape 2 = tape 1 and accept if true.

  16. Theorem: L is Turing-recognizable ⇔ L is recursively enumerable. ⇒: Let L be recognized by M. We can enumerate L as follows: Run M for 1 step on all strings of length ≤1 Run M for 2 steps on all strings of length ≤2  Run M for k steps on all strings of length ≤k  Whenever M accepts on string w, print w.

  17. r.e. languages recursive languages A language is called Turing-recognizable or recursively enumerable if some TM recognizes it A language is called decidable or recursive if some TM decides it

  18. Theorem: If A and A are r.e. then A is recursive Given TM M1 that recognizes A and TM M2 that recognizes A, we can build a new machine that decides A: Run M1 on tape 1, and M2 on tape 2. If M1 accepts, accept. If M2 accepts, reject.

  19. SO… TMs are equivalent to multitape TMs TMs are equivalent to double unbounded TMs TMs are equivalent to IDTMs. TMs are equivalent to 2-stack PDAs. TMs are equivalent to primitiverecursive functions. TMs are equivalent to cellular automata.

  20. THE CHURCH-TURING THESIS L is recognized by a program for some computer* ⇔ L is recognized by a TM * The computer must be “reasonable”

  21. The Church-Turing Thesis is consistent with all known “reasonable” computers. SCRATCH: 1111… 1101001… R1: 1011001… R2:  #1011#1101101#1011001#...# RAM: Programs for a computer have instructions like ADD R1, R2, R3; LOAD R1, R2; STORE R1,R2; MUL R1, R2, R2; BRANCH R1, X;…

  22. Programming languages like Java, Python, Scheme, C, … are equivalent to TMs We call such languages Turing complete. Corollary. If two programming languages are Turing complete, then they can recognize exactly the same set of languages.

  23. We can encode a TM as a string of 0s and 1s start state reject state n states 0n10m10k10s10t10r10u1… m tape symbols (first k are input symbols) blank symbol accept state 〈(p,a), (q,b,L)〉 = 0p10a10q10b10

  24. Since TMs and other languages are equivalent we can also express TMs as programs. Since programs are strings, we can consider languages whose elements are programs. We let 〈M〉 denote the encoding of TM M. Theorem. We can make a Universal TM, a TM that takes any 〈M〉 and any string w as input and simulates the computation of M on w.

More Related