1 / 21

INHERENT LIMITATIONS OF COMPUTER PROGRAMS

CSci 4011. INHERENT LIMITATIONS OF COMPUTER PROGRAMS. UN DECIDABILITY. A language is a set of strings. It is a mathematical way of expressing a problem: given an input, is it in the set L?. If a language is decidable , there is a computer program (TM) that can always solve the problem

trent
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. UNDECIDABILITY A language is a set of strings. It is a mathematical way of expressing a problem: given an input, is it in the set L? If a language is decidable, there is a computer program (TM) that can always solve the problem correctly – it terminates and has the right answer. If a language is undecidable, then no matter how smart you are, and no matter how long you give it, you cannot program a computer to always solve the problem correctly.

  3. UNDECIDABLE PROBLEMS DTM = { 〈M〉 | M is a TM that does not accept 〈M〉 } Theorem. DTM is undecidable. Proof. Suppose machine N decides DTM. Then N accepts 〈N〉 ⇔ 〈N〉  DTM ⇔ N does not accept 〈N〉 ATM = {〈M,w〉 | M is a TM that accepts on input w } Theorem. If ATM is decidable, so is DTM. Proof. If ¬ATM is decided by the program nAccept we can decide DTM by calling nAccept(M,〈M〉). HALTTM = { 〈M,w〉 | M is a TM that halts on input w } Theorem. If HALTTM is decidable, then so is ATM.

  4. In most cases, we will show that a language is undecidable by showing that if it is decidable, then so is ATM We reduce deciding ATM to deciding the language in question

  5. MAPPING REDUCTIONS ƒ : Σ*  Σ* is a computable function if there is a TM that on input w, halts with ƒ(w) on its tape A m B if there is a computable ƒ such that w  A  ƒ(w)  B ƒ is called a reduction from A to B

  6. NET = { J | J is a java applet that opens a network connection } Theorem. ATM ≤m NET. Proof. On input 〈M,w〉, output the Java applet: import cs4011.tools.TuringMachine; import java.net.*; public class OutputApplet extends Applet { public void start() { TuringMachine TM = new TuringMachine(“M”, “w”); TM.run(); if (TM.accepted()) { // open a network connection URL url = new URL(“http://is.gd/”); Object o = url.getContent(); } } }

  7. import cs4011.tools.TuringMachine; import java.net.*; public class OutputApplet extends Applet { public void start() { TuringMachine TM = new TuringMachine(“M”, “w”); TM.run(); if (TM.accepted()) { // open a network connection URL url = new URL(“http://is.gd/”); Object o = url.getContent(); } } } If M accepts w: OutputApplet opens url. Thus OutputApplet ∈ NET. If M loops on w: OutputApplet never gets to url. If M rejects w: OutputApplet skips if {… } block. In both cases, OutputApplet ∉ NET.

  8. What’s wrong with this reduction? On input 〈M,w〉: Run M on w. if M accepts, output: public class OutputApplet extends Applet { public void start() { URL url = new URL(“http://is.gd/”); Object o = url.getContent(); } } else output: public class OutputApplet extends Applet { public void start() { return; } }

  9. PROBLEMS ABOUT TMs

  10. PMw(s): NETM = { 〈M〉 | M is a TM and L(M)  } Theorem:ATM≤mNETM. Proof: Let ƒ(〈M,w〉) = PMwdefined as: if s  w: reject if s = w: run M(w) Need to show that: • If 〈M,w〉∈ATM then PMw∈NETM.  If M accepts w then L(PMw) = {w} . 2. If 〈M,w〉  ATM then PMw NETM.  If M does not accept w then L(PMw) = .

  11. REGTM = { 〈M〉 | M is a TM and L(M) is regular} Theorem: REGTM is undecidable We show that ATM≤m REGTM. The reduction, on input 〈M,w〉 outputs the TM PMw: Proof: PMw(s): If ∃n.s= 0n1n: accept else: return M(w) If M accepts w, L(PMw) = Σ*, so PMw REGTM. If M does not accept w, then L(PMw) = { 0n1n | n ≥ 0} so PMw REGTM.

  12. EXAMPLE: REGTM ATM REGTM ƒ L(PMw) = * 〈M,w〉 ƒ L(PMw) = 0n1n 〈M,w〉 ƒ(〈M,w〉) = PMw.

  13. EXAMPLE SINGLETONTM = { 〈M〉 | M is a TM that accepts exactly one string} Show that ATM ≤mSINGLETONTM. ESTM = { 〈M〉 | M is a TM that accepts on input ε} Show that ATM≤mESTM.

  14. RICE’S THEOREM Let P be a language of Turing machine encodings. IF P satisfies the following properties: For all TMs M1 and M2, where L(M1) = L(M2), 〈M1〉  P if and only if 〈M2〉  P There exist TMs 〈MIN〉  P and 〈MOUT〉  P (i.e. P is a “nontrivialproperty of the r.e. languages.”) THEN P is undecidable EXTREMELY POWERFUL

  15. if (M(w) and MIN(s)): accept else: reject TMw(s): Theorem: Let P be anontrivialproperty of the r.e. languages.Then P is undecidable We show that either ATM ≤m P or ATM ≤m ¬P Proof: Let S be whichever of P, ¬P does not contain the TM TØ that accepts no strings, and let MIN S. On input 〈M,w〉 our reduction outputs TMw:

  16. if (M(w) and MIN(s)): accept else: reject TMw(s): 〈M,w〉  ATM iffƒ(〈M,w〉)  S: If M accepts w, then TMw accepts whenever MIN does. Then L(TMw) = L(MIN); since S is a “language property”, TMw  S If M does not accept w, then TMw doesn’t accept any strings. So L(TMw) =  and since TØ S, neither is TMw.

  17. Let 2STM = { 〈M〉 | M is a TM and |L(M)| = 2 }. Theorem: 2STM is undecidable. Proof: Apply Rice’s Theorem: 1. If L(M1) = L(M2) then |L(M1)| = |L(M2)| so 〈M1〉  2STM ⇔ 〈M2〉 in 2STM. 2. Let MIN(s) = “If s = 0 or s = 1 then accept. else reject.” Let MOUT(s) = accept. Then 〈MIN〉  2STM and 〈MOUT〉  2STM.

  18. EXAMPLES Aε = { 〈M〉 | M is a TM and L(M) = {ε} } CFTM = {〈M〉 | M is a TM and L(M) is context-free} OLTM = {〈M〉 | M is a TM and accepts only odd length strings} Use Rice’s Theorem to prove that Aε , CFTM, and OLTM are undecidable.

  19. Let EH = { 〈M〉 | M is a TM and ∃w. M(w) halts } Rice’s Theorem does not apply to EH: Let M1(s) = “reject.”, M2(s) = “loop forever.” Then L(M1) = L(M2) but 〈M1〉∈ EH and 〈M2〉  EH. EH is undecidable. Proof: HALTTM ≤m EH: ƒ(〈M,w〉) = “PMw(s): if (s  w): loop forever. else: return M(s).” WITH GREAT POWER COMES GREAT RESPONSIBILITY!

  20. GREAT RESPONSIBILITY Prove that Rice’s Theorem does not apply to: Let ULTM = { 〈M〉 | M is a TM with a useless state } WRITE-2-1s = { 〈M〉 | M is a TM that writes exactly two ones to its tape on some input} *state q is useless if for all s, M(s) is never in state q

  21. EXAMPLE EQTM = {〈M1,M2〉 | M1,M2 are TMs and L(M1) = L(M2)} Prove EQTM is undecidable Hint: reduce ETM to EQTM.

More Related