120 likes | 332 Views
Tutorial 11 -- CSC3130 : Formal Languages and Automata Theory. Tu Shikui ( sktu@cse.cuhk.edu.hk ) SHB 905, Office hour: Thursday 2:30pm-3:30pm 2008-11-16. Outline. Examples for Decidable Undecidable but Recognizable Unrecognizable.
E N D
Tutorial 11-- CSC3130 : Formal Languages and Automata Theory Tu Shikui (sktu@cse.cuhk.edu.hk) SHB 905, Office hour: Thursday 2:30pm-3:30pm 2008-11-16
Outline • Examples for • Decidable • Undecidable but Recognizable • Unrecognizable
The difference -- between Recognizable and decidable • If L is decidable, then L is recognized by a TM M that halts on all inputs. Note that, L might be recognized by other TM M’ that does not always halt. • If L is recognizable, then there might be such TM M that recognizes L but run forever, rather than rejecting, some inputs not in L. • Simply, Decidable ---- always halt Recognizable ---- halt or loop
Example 1 -- Is it decidable? The shaded area: L(A) L(B) Proof: Decidable. Construct a TM M as follows:
Example 2 -- Is it decidable? The answer: NOT decidable. The difficulty: How to prove a language to be not decidable? The target problem is embedded. < M > A decider of target problem Construct Mw accept reject w
Example 2 -- Is it decidable? NO. Proof: (reduce it to Halting problem.) 〈M〉 Accept, if L(M) finite D Suppose we have a TM D such that Reject, if L(M) NOT finite Then, we should consider: HALTTM = {(〈M〉, w): Mis a TM that halts on input w} 〈M〉 D Construct Mw 〈Mw〉 Accept, if M halts Reject, if M does not halt w
halts on if and only if is infinite How to construct Mw ? Our Target … Construction On any input string: s Simulate M on w ; If M halts, accept s, else reject s, end
〈M〉 Accept, if L(M) finite D Reject, if L(M) NOT finite Example 2 -- Is it decidable? NO. halts on if and only if HALTTM = {(〈M〉, w): Mis a TM that halts on input w} is infinite 〈M〉 D Construct Mw reject 〈Mw〉 Accept, if M halts accept Reject, if M does not halt w
Example 3 -- Is it decidable? Proof: (reduce it to Halting problem.) 〈M〉 Accept, if … D Suppose we have a TM D such that Reject, if NOT … Then, we should consider: HALTTM = {(〈M〉, w): Mis a TM that halts on input w} 〈M〉 D Construct Mw 〈Mw〉 Accept, if M halts Reject, if M does not halt w
How to construct Mw ? Our Target … Construction halts on On any input string: s Simulate M on w ; if and only if If M halts, accept if s=a or s=b else reject s, end Contains two equal length strings
Example 4 -- Is it decidable? Proof: Suppose we have a TM D such that 〈M〉 Accept, if … D Reject, if NOT … ATM = {(〈M〉, w): Mis a TM that accepts w} 〈M〉 D Construct Mw 〈Mw〉 Accept, if M accept w Reject, if not w