1 / 20

Decidability and Universal Turing Machines

This tutorial explores the concepts of decidability and universal Turing machines. It covers the design of a universal TM and discusses the decidability of the Acceptance Turing Machine (ATM) and the Halting Turing Machine (HALTTM).

dsamons
Download Presentation

Decidability and Universal Turing Machines

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 3130: Formal languagesand automata theoryTutorial 8 Chin

  2. Reminder • Homework 5 is due at next Thursday!

  3. Decidability • A language L is decidable if there exists a TM M such that • If x is in L then M accepts. • If x is not in L then M rejects x • A language L is recognizable if there exists a TM M such that • If x in L then M accepts x • If x is not in L then M rejects x / M loops • If L is decidable then L is recognizable

  4. Decidability • Universal Turing Machine U • It takes a TM M and a string x and simulate M on x • Think of • M as a function which takes a string as input string M(string w) { … return accept/reject; } • U as another function which takes a function description and a string as inputs, then it can invoke thefunction on the string string U(string <F>, string x) { // you can do anything with <F, x> here convert <F> to F // think of “gcc <F>.c –o F” return F(x) // just an example } • What happens if I do U(<M>, w)?

  5. Decidability • ATM = {<M, w>: M is a TM that accepts w} • ATM is recognizable • How to design your universal TM U ? string U(string <F>, string x) { convert <F> to F; return F(x); } • Given <M, w>, we runU(M, w) • What happens to U if M accepts w? string M(string w) { return “accept”; } • What happens to U if M rejects w? string M(string w) { return “reject”; } • What happens to U if M loops on w? string M(string w) {while (1); return “accept”; } If x is accepted by M, then Maccepts If x is NOT accepted by M, then Mrejects / loops

  6. Decidability • ATM = {<M, w>: M is a TM that accepts w} • ATM is UNdecidable • Suppose not, then there exists a universal TM H string H(string <F>, string x) { convert <F> to a function F; if F accepts x, return “accept”; if F does not accept x, return “reject”; //does not accept = reject / loop } • Now we try to do something ridiculous using H

  7. Decidability • ATM = {<M, w>: M is a TM that accepts w} • ATM is UNdecidable • Suppose it is decidable, then there exists a universal TM H string H(string <F>, string x) { convert <F> to a function F; if F accepts x, return “accept”; if F does not accept x, return “reject”; //does not accept = reject / loop } • Design another universal TM H’ string H’(string <F>, string x) { convert <F> to a function F; if H(F, x) == “accept”, return “reject”; if H(F, x) == “reject”, return “accept”; // think of H as a global function }

  8. Decidability • Suppose ATM is decidable, we have H string H(string <F>, string x) { convert <F> to a function F; if F accepts x, return “accept”; if F does not accept x, return “reject”; } string H’(string <F>, string x) { convert <F> to a function F; if H(F, x) == “accept”, return “reject”; if H(F, x) == “reject”, return “accept”; } • Design yet another universal TM D string D(string <F>) { convert <F> to become a function F // think of x is the source code, we compile x return H’(F, <F>); }

  9. Decidability • Suppose ATM is decidable, we have H string H(string F, string x) { convert <F> to a function F; if F accepts x, return “accept”; if F does not accept x, return “reject”; } string H’(string F, string x) { if H(F, x) == “accept”, return “reject”; if H(F, x) == “reject”, return “accept”; } string D(string <F>) { convert <F> to become a function F return H’(F, <F>); } • run D(<D>), where <D> is the source of D

  10. Decidability • Suppose ATM is decidable, we have H • run D(<D>), <D> is the source of D D { H’(D, <D>) { H(D, <D>) { If D accepts <D> return “accept” } return “reject” } return “reject” } If D accepts <D>, D rejects <D>. Contradiction! string H(string F, string x) { convert <F> to a function F; if F accepts x, return “accept”; if F does not accept x, return “reject”; } string H’(string F, string x) { if H(F, x) == “accept”, return “reject”; if H(F, x) == “reject”, return “accept”; } string D(string <F>) { convert <F> to become a function F return H’(F, <F>); }

  11. Reducibility • HALTTM = {<M, w>: M is a TM that halts on input w} • Known: • ATM = {<M, w>: M is a TM that accepts w} is undecidable • If HALTTM is decidable, exists H string H(string <F>, string x) { convert <F> to a function F; if F halts on x, return “accept”; if F loops on x, return “reject”; //does not accept = reject / loop } • construct a universal TM U using H to decide ATM

  12. Reducibility • HALTTM = {<M, w>: M is a TM that halts on input w} • If HALTTM is decidable, exists H string H(string <F>, string x) { convert <F> to a function F; if F halts on x, return “accept”; if F loops on x, return “reject”; //does not accept = reject / loop } • Construct a universal TM U using H to decide ATM string U(string <F>, string x) { convert <F> to a function F; if H(F, x) == “accept”, return F(x) if H(F, x) == “reject”, return “reject”; }

  13. Reducibility • HALTTM = {<M, w>: M is a TM that halts on input w} string H(string <F>, string x) { convert <F> to a function F; if F halts on x, return “accept”; if F loops on x, return “reject”; } string U(string <F>, string x) { convert <F> to a function F; if H(F, x) == “accept”, return F(x) if H(F, x) == “reject”, return “reject”; } • Given <M, w>, • If M accepts w, U accepts w • If M rejects w, U rejects w • If M loops on w, U rejects w • U is a TM that decidesATM, contradition!

  14. Reducibility AEPSTM = {<M>: M is a TM that accepts input e} • Want to show if AEPSTM is decidable, so is ATM. • If AEPSTM is decidable, exists H string H(string <F>) { convert <F> to a function F; if F accepts e, return “accept”; if F loops on/rejects e, return “reject”; } • If e becomes w, then we are happy. • Consider the following TM M’ string M’(string z) { return M(w); // we ignore z } • Want to simulate H(<M’>) • M accepts w if and only if M’ accepts any input, in particular e. • First we need to construct <M’>

  15. Reducibility • AEPSTM = {<M>: M is a TM that accepts input e} string H(string <F>) { convert <F> to a function F; if F accepts e, return “accept”; if F loops on/rejects e, return “reject”; } string M’(string z) { return M(w); // we ignore z } • Given <M, w>, we can construct a TM U to construct M’ string U(string <F>, string x) { <M’> = “string M’(string z) { convert <F> to a function F; return F(x); }”; return <M’>; } • U(M,w)constructs M’

  16. Reducibility • AEPSTM = {<M>: M is a TM that accepts input e} string H(string <F>) { convert <F> to a function F; if F accepts e, return “accept”; if F loops on/rejects e, return “reject”; } string M’(string z) { return M(w); // we ignore z } • We make a small change to U string U(string <F>, string x) { <M’> = “string M’(string z) { convert <F> to a function F; return F(x); }”; return H(<M’>); } • Given <M, w>, run U(M,w)

  17. Reducibility • AEPSTM = {<M>: M is a TM that accepts input e} • U is a TM that decides ATM U(<M>, w) { construct M’; H(<M’>) { For all inputs z (inc. e) if M accepts w, accept if M rejects w, reject if M loops on w, reject } } • If M loops on w, M’ loops on everything (in particular, e) • If M’ loops on e thenH<M’> rejects, then U rejects. string H(string <F>) { convert <F> to a function F; if F accepts e, return “accept”; if F loops on/rejects e, return “reject”; } string M’(string z) { return M(w); // we ignore z } string U(string <F>, string x) { <M’> = “string M’(string z) { convert <F> to a function F; return F(x); }”; return H(<M’>); }

  18. Reducibility SOMETM = {<M>: M is a TM that accepts some input} • Want to show if SOMETM is decidable, so is ATM. • If SOMETM is decidable, exists H string H(string <F>) { convert <F> to a function F; if F accepts some inputs, return “accept”; if F does not accept any inputs, return “reject”; } • Consider the following TM H’ string M’(string z) { return M(w); // we ignore z } • Want to simulate H(<M’>) • M accepts w if and only if M’ accepts any input, in particular e. • Same reduction as AEPSTM to ATM!

  19. Reducibility • ETM = {<M>: M is a TM that accepts no input} • Known: SOMETM = {<M>: M is a TM that accepts some input} is undecidable • If ETM is decidable, exists H string H(string <F>) { convert <F> to a function F; if F accepts no inputs, return “accept”; if F accepts some inputs, return “reject”; } • Just flip the answer. Construct U as follows string U(string <F>) { if H(<F>) accepts, reject; if H(<F>) rejects, accept; }

  20. End • Questions?

More Related