cse 105
play

CSE 105 THEORY OF COMPUTATION Fall 2016 - PowerPoint PPT Presentation

CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ Language of a TM L(M) = {w | M accepts w} M may reject or loop on strings not in L(M) A language X is recognizable if X=L(M) for some TM M A


  1. CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/

  2. Language of a TM ● L(M) = {w | M accepts w} ● M may reject or loop on strings not in L(M) ● A language X is recognizable if X=L(M) for some TM M ● A TM M is a decider if M(w) halts on every input w ● A language X is decidable is X=L(M) for some decider M

  3. Summary ● Theorem: A language L is decidable if and only if it is both recognizable and co-recognizable: D = RE ∩ coRE Decidable Context-free RE co-RE Regular

  4. Closure properties (D) ● Decidable languages are closed under Union – Intersection – Set Complement – Set Difference – …. – ● Proof: similar to the proof for union

  5. Closure properties (D) ● Theorem: If A and B are decidable, then AUB is decidable ● Proof: Let M, M’ be deciders such that L(M)=A, L(M’)=B – We build a decider for AUB, – M’’(w) = 1) Run M(w). If M(w) accepts, then accept 2) Run M’(w). If M’(w) accepts, then accept 3) Otherwise, reject

  6. Closure properties for RE ● Theorem: If A and B are in RE, then AUB is also in RE ● Proof: Let M, M’ be TMs such that L(M)=A, L(M’)=B – We need to build a TM such that L(M’’)=AUB. – M’’(w) = 1) Run M(w). If M(w) accepts, then accept 2) Run M’(w). If M’(w) accepts, then accept 3) Otherwise, reject

  7. Closure properties Question: Is M’’ a decider? A) Yes, because it always terminate ● Theorem: If A and B are recognizable, then AUB is B) No, beause it may loop in step 1 recognizable C) No, because it may loop in step 2 D) I can’t decide, I am not a decider ● Proof: Let M, M’ be TMs such that L(M)=A, L(M’)=B – We build a TM for AUB, – M’’(w) = 1) Run M(w). If M(w) accepts, then accept 2) Run M’(w). If M’(w) accepts, then accept 3) Otherwise, reject

  8. Closure properties Question: What property best describes the language of M’’? A) L(M’’) = A U B ● Theorem: If A and B are recognizable, then AUB is B) A ⊆ L(M’’) ⊆ AUB recognizable C) A∩B ⊆ L(M’’) ⊆ A U B D) L(M’’) = A – B ● Proof: E) None of the above Let M, M’ be TMs such that L(M)=A, L(M’)=B – We build a TM for AUB, – M’’(w) = 1) Run M(w). If M(w) accepts, then accept 2) Run M’(w). If M’(w) accepts, then accept 3) Otherwise, reject

  9. Closure Properties (RE) ● Can we fix the proof, and show that RE is closed under union? ● Is RE closed under Union? – Intersection? – Complement? – Set Difference? –

  10. Closure of RE under union ● Theorem: If A and B are recognizable, then AUB is recognizable ● Proof: Let M, M’ be TMs such that L(M)=A, L(M’)=B – We build a TM for AUB, M’’(w) = – 1. For t=1,2,3,…. 1) Run M(w) for t steps. If M(w) accepts, then accept 2) Run M’(w) for t steps. If M’(w) accepts, then accept 3) Otherwise, continue to next t

  11. Closure of RE under union Question: Is M’’ a decider? A) Yes, it always terminate ● Theorem: If A and B are recognizable, then AUB is B) No, beause it may loop in step 1 C) No, because it may loop in step 2 recognizable D) No, because of infinite loop “for t=1,2,3 ...” ● Proof: E) I don’t know Let M, M’ be TMs such that L(M)=A, L(M’)=B – We build a TM for AUB, M’’(w) = – 1. For t=1,2,3,…. 1) Run M(w) for t steps. If M(w) accepts, then accept 2) Run M’(w) for t steps. If M’(w) accepts, then accept 3) Otherwise, continue to next t

  12. Summary Are there languages outside of RE U coRE Are there languages ● Theorem: A language L is decidable if and only if it is in RE - Dec? both recognizable and co-recognizable: D = RE ∩ coRE ??? Decidable ??? ??? Context-free RE co-RE Regular Are there languages in coRE - Dec?

  13. Undecidable languages ● Are there languages that are not decidable? E.g., HALT = {<M,w> | M is a TM such that M(w) terminates} – ● Claim: HALT is recognizable because it is the language of the following TM M HALT (<M,w>) = 1. Run M on input w. 2. Accepts.

  14. Undecidable languages ● Are there languages that are not decidable? E.g., HALT = {<M,w> | M is a TM such that M(w) terminates} – ● Claim: HALT is recognizable because it is the language of the following TM Question: Is the claim correct? M HALT (<M,w>) = A) Yes, because L(M HALT )=HALT B) No, because M HALT may loop in step 1 1. Run M on input w. C) No, because M HALT never rejects 2. Accepts. D) It depends on the input w

  15. Undecidable languages ● Are there languages that are not decidable? E.g., HALT = {<M,w> | M is a TM such that M(w) terminates} – ● Claim: HALT is recognizable because it is the language of the following TM Question: does M HALT decide HALT? M HALT (<M,w>) = A) Yes, because L(M HALT )=HALT B) No, because M HALT may loop in step 1 1. Run M on input w. C) No, because M HALT never rejects 2. Accepts. D) It depends on the input w

  16. Summary Are there languages outside of RE U coRE Is HALT ● Theorem: A language L is decidable if and only if it is in RE - Dec? both recognizable and co-recognizable: D = RE ∩ coRE ??? Decidable ??? ??? Context-free RE co-RE Regular

  17. Countable Sets ● You can make an infjnite list of all natural numbers N: 0,1,2,3,4,…. ● You can make an infjnite list containing all integers Z: 0,1,-1,2,-2,3,-3,4,-4,… ● Defjnition: a set S is countable if there is a bijection f: N → S Informally: you can list the elements of S: f(0),f(1),f(2),…. – N and Z are countable –

  18. Countable Sets Question: Is any of these sets countable? Q (rational numbers), R (real numbers), C (complex numbers) ● You can make an infjnite list of all natural numbers A) None of them is countable N: 0,1,2,3,4,…. B) Q is countable, but R and C are not ● You can make an infjnite list containing all integers C) Q and R are countable, but C is not because Z: 0,1,-1,2,-2,3,-3,4,-4,… D) They are all countable ● Defjnition: a set S is countable if there is a bijection f: N → S Informally: you can list the elements of S: f(0),f(1),f(2),…. – N and Z are countable –

  19. Diagonalization ● Theorem: R is not countable. ● Proof: assume for contradiction it is countable ● List its element [0,1) (1)0.0100010… (2)0.1101000… (3)0.0110001… (4)0.1010101… (5)0.1111000… ● Flip the diagonal: r=0.10011… ● The real number r is not on the list: Contradiction!

  20. There are non-recognizable languages ● The set of all strings {0,1}* is countable Just list them in lexicographic order: [w[i]] i = ε ,0,1,00,01,10,11,000,… – ● The set of all Turing machines is countable because TM can be represented by strings. ● Languages can be represented by real numbers: r=0.10010101011100…. ↔ {w[i] | the i th digit of r is 1} – ● The set of all languages P({0,1}*) is not countable ● RE is strictly contained in P({0,1}*) because RE is countable and P({0,1}*) is not.

  21. Next Time ● Can we find specific (and possibly interesting) non- recognizable languages? ● Reading: Sipser Chapters 3 and 4 ● Friday Nov 11: Veterans’ day – No class ● HW6 due on Nov 15 ● Haskell 4 due Nov 21 ● Exam 3 : Nov 18

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