CSE 105
THEORY OF COMPUTATION
Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/
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
Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/
both recognizable and co-recognizable: D = RE ∩ coRE
RE co-RE Context-free Regular Decidable
–
Union
–
Intersection
–
Set Complement
–
Set Difference
–
….
–
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
–
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
recognizable
–
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
Question: Is M’’ a decider? A) Yes, because it always terminate B) No, beause it may loop in step 1 C) No, because it may loop in step 2 D) I can’t decide, I am not a decider
recognizable
–
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
Question: What property best describes the language of M’’? A) L(M’’) = A U B B) A ⊆ L(M’’) ⊆ AUB C) A∩B ⊆ L(M’’) ⊆ A U B D) L(M’’) = A – B E) None of the above
union?
–
Union?
–
Intersection?
–
Complement?
–
Set Difference?
recognizable
–
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) 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
recognizable
–
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) 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
Question: Is M’’ a decider? A) Yes, it always terminate B) No, beause it may loop in step 1 C) No, because it may loop in step 2 D) No, because of infinite loop “for t=1,2,3 ...” E) I don’t know
both recognizable and co-recognizable: D = RE ∩ coRE
RE co-RE Context-free Regular Decidable ??? ??? ??? Are there languages
Are there languages in RE - Dec? Are there languages in coRE - Dec?
–
E.g., HALT = {<M,w> | M is a TM such that M(w) terminates}
the following TM MHALT(<M,w>) =
–
E.g., HALT = {<M,w> | M is a TM such that M(w) terminates}
the following TM MHALT(<M,w>) =
Question: Is the claim correct? A) Yes, because L(MHALT)=HALT B) No, because MHALT may loop in step 1 C) No, because MHALT never rejects D) It depends on the input w
–
E.g., HALT = {<M,w> | M is a TM such that M(w) terminates}
the following TM MHALT(<M,w>) =
Question: does MHALT decide HALT? A) Yes, because L(MHALT)=HALT B) No, because MHALT may loop in step 1 C) No, because MHALT never rejects D) It depends on the input w
both recognizable and co-recognizable: D = RE ∩ coRE
RE co-RE Context-free Regular Decidable ??? ??? ??? Are there languages
Is HALT in RE - Dec?
N: 0,1,2,3,4,….
Z: 0,1,-1,2,-2,3,-3,4,-4,…
bijection f: N → S
–
Informally: you can list the elements of S: f(0),f(1),f(2),….
–
N and Z are countable
N: 0,1,2,3,4,….
Z: 0,1,-1,2,-2,3,-3,4,-4,…
bijection f: N → S
–
Informally: you can list the elements of S: f(0),f(1),f(2),….
–
N and Z are countable Question: Is any of these sets countable? Q (rational numbers), R (real numbers), C (complex numbers) A) None of them is countable B) Q is countable, but R and C are not C) Q and R are countable, but C is not because D) They are all countable
(1)0.0100010… (2)0.1101000… (3)0.0110001… (4)0.1010101… (5)0.1111000…
–
Just list them in lexicographic order: [w[i]]i = ε,0,1,00,01,10,11,000,…
represented by strings.
–
r=0.10010101011100…. ↔ {w[i] | the ith digit of r is 1}
P({0,1}*) is not.
recognizable languages?