Decidability Decidable/Undecidable problems. Jaruloj Chongstitvatana 2301379Decidability2 Accepting: Definition Let T = (Q, , , , s) be a TM. T accepts.

Slides:



Advertisements
Similar presentations
Lecture 3 Universal TM. Code of a DTM Consider a one-tape DTM M = (Q, Σ, Γ, δ, s). It can be encoded as follows: First, encode each state, each direction,
Advertisements

Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but.
Turing -Recognizable vs. -Decidable
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Computability and Complexity 5-1 Classifying Problems Computability and Complexity Andrei Bulatov.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Mapping Reducibility Sipser 5.3 (pages ).
1 Introduction to Computability Theory Lecture13: Mapping Reductions Prof. Amos Israeli.
Mapping Reducibility Sipser 5.3 (pages ). CS 311 Fall Computable functions Definition 5.17: A function f:Σ*→Σ* is a computable function.
Fall 2004COMP 3351 Undecidable problems for Recursively enumerable languages continued…
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Reducibility A reduction is a way of converting one problem into another problem in such a way that a solution to the second problem can be used to solve.
Lecture 9 Recursive and r.e. language classes
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
1 Module 9 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.
Lecture 8 Recursively enumerable (r.e.) languages
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
Recursively Enumerable and Recursive Languages
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Rules have form String of variables and terminals String of variables and terminals.
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
Fall 2004COMP 3351 The Chomsky Hierarchy. Fall 2004COMP 3352 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free.
Fall 2004COMP 3351 Reducibility. Fall 2004COMP 3352 Problem is reduced to problem If we can solve problem then we can solve problem.
Linear Bounded Automata LBAs
Homework #9 Solutions.
1 Decidability continued. 2 Undecidable Problems Halting Problem: Does machine halt on input ? State-entry Problem: Does machine enter state halt on input.
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
Courtesy Costas Busch - RPI1 Reducibility. Courtesy Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.
Theory of Computing Lecture 20 MAS 714 Hartmut Klauck.
CS21 Decidability and Tractability
Fall 2006Costas Busch - RPI1 Undecidable Problems (unsolvable problems)
Prof. Busch - LSU1 Undecidable Problems (unsolvable problems)
Prof. Busch - LSU1 Reductions. Prof. Busch - LSU2 Problem is reduced to problem If we can solve problem then we can solve problem.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
Ding-Zhu Du Office: ECSS 3-611, M 3:15-4:30 Lecture: ECSS 2.311, MW 12:30-1:45.
1 Undecidability Reading: Chapter 8 & 9. 2 Decidability vs. Undecidability There are two types of TMs (based on halting): (Recursive) TMs that always.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
1 The Halting Problem and Decidability How powerful is a TM? Any program in a high level language can be simulated by a TM. Any algorithmic procedure carried.
MA/CSSE 474 Theory of Computation Enumerability Reduction.
A Universal Turing Machine
CS 3813: Introduction to Formal Languages and Automata Chapter 12 Limits of Algorithmic Computation These class notes are based on material from our textbook,
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
NP-completeness Class of hard problems. Jaruloj ChongstitvatanaNP-complete Problems2 Outline  Introduction  Problems and Languages Turing machines and.
CS 461 – Nov. 7 Decidability concepts –Countable = can number the elements  –Uncountable = numbering scheme impossible  –A TM undecidable –Language classes.
Turing -Recognizable vs. -Decidable
Lecture 21 Reducibility. Many-one reducibility For two sets A c Σ* and B c Γ*, A ≤ m B if there exists a Turing-computable function f: Σ* → Γ* such that.
Recursively Enumerable and Recursive Languages
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata (LBAs) are the same as Turing Machines with one difference: The input string tape space is the.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 4 Decidability Some slides are in courtesy.
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Productions String of variables and terminals String of variables and terminals.
Undecidability and The Halting Problem
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Decidability.
Chapters 11 and 12 Decision Problems and Undecidability.
Recursively Enumerable and Recursive Languages
Busch Complexity Lectures: Reductions
Reductions Costas Busch - LSU.
MCC 2093 Advanced Theoretical Computer Science
Turing Machines Acceptors; Enumerators
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
Decidable Languages Costas Busch - LSU.
Decidable/Undecidable problems
Proposed in Turing’s 1936 paper
Formal Languages, Automata and Models of Computation
Cpt S 317: Spring 2009 Reading: Chapter 8 & 9
More Undecidable Problems
Presentation transcript:

Decidability Decidable/Undecidable problems

Jaruloj Chongstitvatana Decidability2 Accepting: Definition Let T = (Q, , , , s) be a TM. T accepts a string w in  * if (s,  w) |- T * (h,  1). T accepts a language L  * if, for any string w in L, T accepts w.

Jaruloj Chongstitvatana Decidability3 Characteristic function For any language L  *, the characteristic function of L is the function  L (x) such that –  L (x) = 1 if x  L –  L (x) = 0otherwise Example Let L = {   {0,1}* | n 1 (  ) <n 0 (  ) <2n 1 (  ) }, where n x (  ) is the number of x ’s in  }. –  L (  ) = 1 if n 1 (  ) <n 0 (  ) <2n 1 (  ) –  L (  ) = 0otherwise

Jaruloj Chongstitvatana Decidability4 Deciding: Definition Let T = (Q, , , , s) be a TM. T decides a language L  * if T computes the characteristic function of L. T decides a language L  * if – for any string w in L, T halts on w with output 1, – for any string w in  L, T halts on w with output 0.

Jaruloj Chongstitvatana Decidability5 Accepting/Deciding: Example 1/ ,R q2 h q1  ,R  / ,L S p1 p4 p2 p3  0/ ,R 0/0,R 1/1,R  / ,L 0/ ,L 0/0,L 1/1,L  / ,R TM accepting L={0 n 10 n |n  0} If the input x is in L, T halts with output 1. If the input x is not in L, T hangs. r1  / ,L 1/ ,L  / ,L r2 ,R  /0,L  / ,L 0/ ,L 1/ ,L TM decidinging L={0 n 10 n |n  0} Hang when input = 0 2n Hang when input = 0 n+m …0 n Hang when input = 0 n 1 … 0 n+m

Jaruloj Chongstitvatana Decidability6 Recursively enumerable languages A language L is recursively enumerable if there is a Turing machine T accepting L. A language L is Turing-acceptable if there is a Turing machine T accepting L. Example: {0 n 10 n |n  0} is a recursively-enumerable language.

Jaruloj Chongstitvatana Decidability7 Recursive languages A language L is recursive if there is a Turing machine T deciding L. A language L is Turing-decidable if there is a Turing machine T deciding L. Example: {0 n 10 n |n  0} is a recursive language.

Closure Properties of the Class of Recursive Languages

Jaruloj Chongstitvatana Decidability9 Closure Property Under Complementation Theorem: Let L be a recursive language over . Then,  L is recursive. Proof: Let L be a recursive language over . Then, there exists a TM T computing  L. Construct a tape TM M computing   L. as follows:  T  T moveRight 0  T write1 1 T write0 Then,  L is recursive.

Jaruloj Chongstitvatana Decidability10 Closure Property Under Union Theorem: Let L 1 and L 2 be recursive languages over . Then, L 1  L 2 is recursive. Proof: Let L 1 and L 2 be recursive languages over . Then, there exist TM’s T 1 and T 2 computing  L1 and  L2, respectively. Construct a 2-tape TM M as follows:  T copyTape1ToTape2  T 1  T moveRight 0  T copyTape2ToTape1  T 2 1

Jaruloj Chongstitvatana Decidability11 Closure Property Under Union  T copyTape1ToTape2  T 1  T moveRight 0  T copyTape2ToTape1  T 2 If the input w is not in L 1 and L 2,  L1 (w) and  L2 (w)=0. Thus, both T 1 and T 2 must run, and M halts with output 0. If the input w is in L 1,  L1 (w)=1. Thus, M halts with output 1. If the input w is not in L 1 but is in L 2,  L1 (w)=0 and  L2 (w)=1. Thus, M halts with output 1. That is, M computes characteristic function of  L. Then, L 1  L 2 is recursive. 1

Jaruloj Chongstitvatana Decidability12 Closure Property Under Intersection Theorem: Let L 1 and L 2 be recursive languages over . Then, L 1  L 2 is recursive. Proof: Let L 1 and L 2 be recursive languages over . Then, there exist TM’s T 1 and T 2 computing  L1 and  L2, respectively. Construct a 2-tape TM M as follows:  T copyTape1ToTape2  T 1  T moveRight 1  T copyTape2ToTape1  T 2 0

Jaruloj Chongstitvatana Decidability13 Closure Property Under Intersection  T copyTape1ToTape2  T 1  T moveRight 1  T copyTape2ToTape1  T 2 If the input w is in L 1  L 2,  L1 (w) and  L2 (w)=1. Thus, M halts with output 1. If the input w is not in L 1,  L1 (w)=0. Thus, M halts with output 0. If the input w is in L 1 but is not in L 2,  L1 (w)=1 and  L2 (w)=0. Thus, M halts with output 0. That is, M computes characteristic function of  L1  L2. Then, L 1  L 2 is recursive. 0

Closure Properties of the Class of Recursively Enumerable Languages

Jaruloj Chongstitvatana Decidability15 Closure Property Under Union Theorem: Let L 1 and L 2 be recursively enumerable languages over . Then, L 1  L 2 is also recursively enumerable. Proof: Let L 1 and L 2 be recursively enumerable languages over . Then, there exist TM’s T 1 and T 2 accepting L 1 and L 2, respectively. Construct an NTM M as follows. S T1T1 T2T2

Jaruloj Chongstitvatana Decidability16 Closure Property Under Union If w is in L 1, but not in L 2, then T 1 in M runs and halts. If w is in not L 1, but in L 2, then T 2 in M runs and halts. If w is in both L 1 and L 2, then either T 1 or T 2 runs and halts. For these 3 cases, M halts. If w is neither in L 1 nor in L 2, then either T 1 or T 2 runs but both never halt. Then, M does not halt. Thus, M accepts L 1  L 2. That is, L 1  L 2 is recursively enumerable. S T1T1 T2T2

Jaruloj Chongstitvatana Decidability17 Closure Property Under Intersection Theorem: Let L 1 and L 2 be recursively enumerable languages over . Then, L 1  L 2 is also recursively enumerable. Proof: Let L 1 and L 2 be recursively enumerable languages over . Then, there exist TM’s T 1 and T 2 accepting L 1 and L 2, respectively. Construct an NTM M as follows.  T copyTape1ToTape2  T 1  T moveRight 1  T copyTape2ToTape1  T 2

Jaruloj Chongstitvatana Decidability18 Closure Property Under Intersection  T copyTape1ToTape2  T 1  T moveRight 1  T copyTape2ToTape1  T 2 If w is in not L 1, then T 1 in M does not halt. Then, M does not halt. If w is in L 1, but not in L 2, then T 1 in M halts and T 2 can finally start, but does not halt. Then, M does not halt. If w is in both L 1 and L 2, then T 1 in M halts and T 2 can finally start, and finally halt. Then, M halts. Thus, M accepts L 1  L 2. That is, L 1  L 2 is recursively enumerable.

Jaruloj Chongstitvatana Decidability19 Closure Property Under Union (II) Theorem: Let L 1 and L 2 be recursively enumerable languages over . Then, L 1  L 2 is also recursively enumerable. Proof: Let L 1 and L 2 be recursively enumerable languages over . Then, there exist DTM’s T 1 =(Q 1, , ,  1, s 1 ) and T 2 =(Q 2, , ,  2, s 2 ) accepting L 1 and L 2, respectively. Construct a 2-tape TM M which simulates T 1 and T 2 simultaneously. Tape 1 represents T 1 ’s tape and Tape 2 represents T 2 ’s tape.

Jaruloj Chongstitvatana Decidability20 Closure Property Under Union (II) Let M = (Q 1  Q 2, , , , (s 1,s 2 )) where –  ((p 1,p 2 ),a 1,a 2 ) = ((q 1,q 2 ),b 1,b 2,d 1,d 2 ) for  1 (p 1,a 1 )=(q 1,b 1,d 1 ) and  2 (p 2,a 2 )=(q 2,b 2,d 2 ) –  ((p 1,p 2 ),a 1,a 2 ) = (h,b 1,b 2,d 1,d 2 ) for  1 (p 1,a 1 )=(h,b 1,d 1 ) or  2 (p 2,a 2 )=(h,b 2,d 2 ) If either T 1 or T 2 halt, M finally gets to the state h. If neither T 1 nor T 2 halt, M never gets to the state h.

Jaruloj Chongstitvatana Decidability21 Closure Property Under Intersection (II) Theorem: Let L 1 and L 2 be recursively enumerable languages over . Then, L 1  L 2 is also recursively enumerable. Proof: Let L 1 and L 2 be recursively enumerable languages over . Then, there exist DTM’s T 1 =(Q 1, , ,  1, s 1 ) and T 2 =(Q 2, , ,  2, s 2 ) accepting L 1 and L 2, respectively. Construct a 2-tape TM M which simulates T 1 and T 2 simultaneously. Tape 1 represents T 1 ’s tape and Tape 2 represents T 2 ’s tape.

Jaruloj Chongstitvatana Decidability22 Closure Property Under Intersection (II) Let M = ((Q 1  {h})  (Q 2  {h}), , , , (s 1,s 2 )) where –  ((p 1,p 2 ),a 1,a 2 ) = ((q 1,q 2 ),b 1,b 2,d 1,d 2 ) for  1 (p 1,a 1 )=(q 1,b 1,d 1 ) and  2 (p 2,a 2 )=(q 2,b 2,d 2 ) –  ((h,p 2 ),a 1,a 2 ) = ((h,q 2 ),a 1,b 2,S,d 2 ) for all p 2,a 1,a 2 and  2 (p 2,a 2 )=(q 2,b 2,d 2 ) –  ((p 1,h),a 1,a 2 ) = ((q 1,h),b 1,a 2,d 1,S) for all p 1,a 1,a 2 and  1 (p 1,a 1 )=(q 1,b 1,d 1 ) –  ((h,h),a 1,a 2 ) = (h,a 1,a 2,S,S) for all a 1,a 2 If neither T1 nor T2 halt, M never gets to the state h. If T 1 halts and T 2 does not halt, M gets to the state (h,p). If T 2 halts and T 1 does not halt, M gets to the state (p,h). If both T 1 and T 2 halt, M finally gets to the state h.

Relationship Between the Classes of Recursively Enumerable and Recursive Languages

Jaruloj Chongstitvatana Decidability24 Relationship between RE and Recursive Languages Theorem: If L is a recursive language, then L is recursively enumerable. Proof: Let L be a recursive language over . Then, there is a TM T deciding L. Then, T also accepts L. Thus, L is recursively enumerable.

Jaruloj Chongstitvatana Decidability25 Relationship between RE and Recursive Languages Theorem: Let L be a language. If L and  L are recursively enumerable, then L is recursive. Proof: Let L and  L be recursively-enumerable languages over . Then, there are a TM T accepting L, and a TM  T accepting  L. For any string w in  *, w is either in L or in  L. That is, either T or  T must halt on w, for any w in  *. We construct an NTM M as follows: If w is in L, T halts on w and thus, M accepts w. If w is not in L,  T halts on w and thus, M rejects w. Then, M computes the characteristic function of L. Then, L is recursive. S T TT accept reject

Jaruloj Chongstitvatana Decidability26 Decision Problems A decision problem is a prob. whose ans. is either yes or no A yes-instance (or no-instance) of a problem P is the instance of P whose answer is yes (or no, respectively) A decision problem P can be encoded by f e over  as a language {f e (X)| X is a yes-instance of P}.

Jaruloj Chongstitvatana Decidability27 Encoding of decision problems Is X a prime ? {1 X | X is a prime} Does TM T accept string e(T)? {e(T) | T is a TM accepting string e(T)} Does TM T accept string w? {e(T)e(w) | T is a TM accepting string w} or { | T is a TM accepting string w}

Jaruloj Chongstitvatana Decidability28 Decidable (or solvable) problems Definition: If f e is a reasonable encoding of a decision problem P over , we say P is decidable (or solvable) if the associated language {f e (X)| X is a yes-instance of P} is recursive. A problem P is undecidable (or unsolvable) if P is not decidable.

Jaruloj Chongstitvatana Decidability29 Self-Accepting SA (Self-accepting) = {w  {0,1,#,,} * | w=e(T) for some TM T and w  L(T)} NSA (Non-self-accepting) = {w  {0,1,#,,} * | w=e(T) for some TM T and w  L(T)} E (Encoded-TM) = {w  {0,1,#,,} * | w=e(T) for some TM T}

Jaruloj Chongstitvatana Decidability30 NSA is not recursively enumerable We prove by contradiction. Assume NSA is recursively enumerable. Then, there is TM T 0 such that L(T 0 )=NSA. Is e(T 0 ) in NSA? –If e(T 0 )  NSA, then e(T 0 )  L(T 0 ) by the definition of NSA But L(T 0 )=NSA. Thus, contradiction. –If e(T 0 )  NSA, then e(T 0 )  SA and e(T 0 )  L(T 0 ) by the definition of SA. But L(T 0 )=NSA. Thus, contradiction. Then, the assumption is false. That is, NSA is not recursively enumerable.

Jaruloj Chongstitvatana Decidability31 E is recursive Theorem: E is recursive. Proof: We can construct a regular expression for E according to the definition of the encoding function as follows: R = S 1 (M #) + S = 0 M = Q, A, Q, A, D Q = 0 + A = 0 + D = Then, E is regular, and thus recursive.

Jaruloj Chongstitvatana Decidability32 SA is recursively enumerable Construct a TM S accepting SA If w is not e(T) for some TM T, S rejects w. If w is e(T) for some TM T, S accepts e(T) iff T accepts e(T). L(S) = {w| w=e(T) for some TM T accepting e(T) = SA. Then, SA is recursively enumerable. EUTM Reject Encode

Jaruloj Chongstitvatana Decidability33 SA is not recursive NSA = E – SA NSA is not recursively enumerable (from previous theorem), and thus not recursive. But E is recursive. From the closure property, if L1 and L2 are recursive, then L1 - L2 is recursive. Using its contrapositive, if L1 - L2 is not recursive, then L1 or L2 are not recursive. Since NSA is not recursive and E is recursive, SA is not recursive.

Jaruloj Chongstitvatana Decidability34 Co-R.E. Definition A language L is co-R.E. if its complement  L is R.E. It does not mean L is not R.E. Examples: SA is R.E.  SA=  E  NSA is not R.E. –  SA is co-R.E., but not R.E. NSA is not R.E.  NSA=  E  SA is R.E. –NSA is co-R.E., but not R.E. E is recursive, R.E., and co-R.E.

Jaruloj Chongstitvatana Decidability35 Relationship between R.E., co-R.E. and Recursive Languages Theorem: Let L be any language. L is R.E. and co- R.E. iff L is recursive. Proof: (  ) Let L be R.E. and co-R.E. Then,  L is R.E. Thus, L is recursive. (  ) Let L be recursive. Then, L is R.E. From the closure under complementation of the class of recursive languages,  L is also recursive. Then,  L is also R.E. Thus, L is co-R.E.

Jaruloj Chongstitvatana Decidability36 recursive co-R.E. R.E. Neither R.E. nor co-R.E. Observation A language L is either –recursive –R.E., bot not recursive –co-R.E., but not recursive –Neither R.E. nor co-R.E.

Jaruloj Chongstitvatana Decidability37 Reduction Definition: Let L 1 and L 2 be languages over  1 and  2, respectively. L 1 is (many-one) reducible to L 2, denoted by L 1  L 2, if there is a TM M computing a function f:  1 *  2 * such that w  L 1  f(w)  L 2. Definition: Let P 1 and P 2 be problems. P 1 is (many-one) reducible to P 2 if there is a TM M computing a function f:  1 *  2 * such that w is a yes-instance of P 1  f(w) is a yes-instance of P 2.

Jaruloj Chongstitvatana Decidability38 Reduction Definition: A function f:  1 *  2 * is a Turing-computable function if there is a Turing machine computing f. Definition: Let L 1 and L 2 be languages over  1 and  2, respectively. L 1 is (many-one) reducible to L 2, denoted by L 1  L 2, if there is a Turing-computable function f:  1 *  2 * such that w  L 1  f(w)  L 2.

Jaruloj Chongstitvatana Decidability39 Meaning of Reduction P 1 is reducible to P 2 if  TM M computing a function f:  1 *  2 * such that w is a yes- instance of P 1  f(w) is a yes-instance of P 2. If you can map yes-instances of problem A to yes-instances of problem B, then –we can solve A if we can solve B –it doesn’t mean we can solve B if we can solve A –the decidability of B implies the decidability of A

Jaruloj Chongstitvatana Decidability40 Properties of reduction Theorem:Let L be a language over . L  L. Proof: Let L be a language over . Let f be an identity function from  *  *. Then, there is a TM computing f. Because f is an identity function, w  L  f(w)=w  L. By the definition, L  L.

Jaruloj Chongstitvatana Decidability41 Properties of reduction Theorem: Let L 1 and L 2 be languages over . If L 1  L 2, then  L 1  L 2. Proof: Let L 1 and L 2 be languages over . B ecause L 1  L 2, t here is a function f such that w  L 1  f(w)  L 2, and a TM T computing f. w  L 1  f(w)  L 2. By the definition,  L 1  L 2.

Jaruloj Chongstitvatana Decidability42 Properties of reduction Theorem:Let L 1, L 2 and L 3 be languages over . If L 1  L 2 and L 2  L 3, then L 1  L 3. Proof: Let L 1, L 2 and L 3 be languages over . T here is a function f such that w  L 1  f(w)  L 2, and a TM T1 computing f because L 1  L 2. T here is a function g such that w  L 2  g(w)  L 3, and a TM T2 computing g because L 2  L 3. w  L 1  f(w)  L 2  g(f(w))  L 3, and T1  T2 computes g(f(w)). By the definition, L 1  L 3.

Jaruloj Chongstitvatana Decidability43 Using reduction to prove decidability Theorem: If L 2 is recursive, and L 1  L 2, then L 1 is also recursive. Proof: Let L 1 and L 2 be languages over , L 1  L 2, and L 2 be recursive. Because L 2 is recursive, there is a TM T 2 computing  L2. Because L 1  L 2, there is a TM T 1 computing a function f such that w  L 1  f(w)  L 2.

Jaruloj Chongstitvatana Decidability44 Using reduction to prove decidability Construct a TM T= T 1  T 2. We show that T computes  L 1. –If w  L 1, T 1 in T computes f(w)  L 2 and T 2 in T computes  L2 (f(w)), which is 1. –If w  L 1, T 1 in T computes f(w)  L 2 and T 2 in T computes  L2 (f(w)), which is 0. Thus, L 1 is also recursive.

Jaruloj Chongstitvatana Decidability45 Using Reduction to Prove Undecidability Collorary: If L 1 is not recursive, and L 1  L 2, then L 2 is not recursive.

Jaruloj Chongstitvatana Decidability46 Using reduction to prove R.E. Theorem: If L 2 is R.E., and L 1  L 2, then L 1 is also R.E. Proof: Let L 1 and L 2 be languages over , L 1  L 2, and L 2 be R.E. Because L 2 is R.E, there is a TM T 2 accepting L 2. Because L 1  L 2, there is a TM T 1 computing a function f such that w  L 1  f(w)  L 2.

Jaruloj Chongstitvatana Decidability47 Using reduction to prove R.E. Construct a TM T= T 1  T 2. We show that T accepts L 1. –If w  L 1, T 1 in T computes f(w)  L 2 and T 2 in T accepts f(w). Thus, T accepts w. –If w  L 1, T 1 in T computes f(w)  L 2 and T 2 in T does not accept (f(w)). Thus, T does not accept w. Thus, L 1 is also R.E.

Jaruloj Chongstitvatana Decidability48 Using reduction to prove non-R.E. Collorary: If L 1 is not recursively enumerable, and L 1  L 2, then L 2 is not recursively enumerable.

Jaruloj Chongstitvatana Decidability49 Using reduction to prove co-R.E. Theorem: If L 2 is co-R.E., and L 1  L 2, then L 1 is also co-R.E. Proof: Let L 1 and L 2 be languages over , L 1  L 2, and L 2 be co-R.E. Because L 2 is co-R.E,  L 2 is R.E. Because L 1  L 2,  L 1  L 2. Then,  L 1 is R.E. Thus, L 1 is co-R.E.

Jaruloj Chongstitvatana Decidability50 Using reduction to prove non-co-R.E. Collorary: If L 1 is not co-R.E., and L 1  L 2, then L 2 is not co-R.E.

Jaruloj Chongstitvatana Decidability51 Let L1  L2. If L1 is not recursive / R.E. / co-R.E., then L2 is not recursive / R.E. / co-R.E. Another way to prove undecidability To prove a language L is not recursive: 1.Guess where L is (not R.E. or not co-R.E.) 2.Choose another non-recursive language R which is of the same type 3.Show R  L. recursiveco-R.E.R.E. Neither R.E. nor co-R.E.

Jaruloj Chongstitvatana Decidability52 Another way to prove undecidability To prove a language L is not recursive: 1.Guess where L is (not R.E. or not co-R.E.) 2.If L is not R.E., then show NSA  L. 3.If L is not co-R.E., then show SA  L. recursive co-R.E.R.E. Neither R.E. nor co-R.E. NSASA

Jaruloj Chongstitvatana Decidability53 Guess if it’s rec., R.E., co-R.E., or neither Given a TM T, does T get to state q on blank tape? does T accept  ? does T output 1? does T accept everything? is L(T) finite? R.E., not co-R.E. R.E., not co-R.E. Neither

Jaruloj Chongstitvatana Decidability54 Problem of accepting an empty string We will prove that the problem if a TM accepts an empty string is undecidable. This problem is corresponding to the following language. –Accept  = {e(M)| M is a TM accepting  } Thus, we will prove that Accept  is not recursive.

Jaruloj Chongstitvatana Decidability55 Accept  is not recursive. Proof: (Guess Accept  is in R.E., but not co-R.E.) Show SA  Accept  (We want a Turing-computable f n f( )= such that –T accepts e(T)  M accepts  –T does not accept e(T)  M does not accept  Let f(T)=M is a TM that first writes e(T) after its input and then runs T. M writes e(T) after its input. If its input is , T has e(T) as input. Write T M

Jaruloj Chongstitvatana Decidability56 Accept  is not co–R.E. Verify that T accepts e(T)  M accepts  M writes e(T) and lets T run. If the input of M is  : when T accepts e(T), M accepts . when T doesn’t accept e(T), then M doesn’t accept .

Jaruloj Chongstitvatana Decidability57 Accept  is not co–R.E. Next, we show that there is a TM TF computing f. TF works as follows: changes the start state of T in e(T) to a new state add e(Write ), make its start state the start state of TF, and make the transition from its halt state to T’s start state. Then, SA  Accept . Then,Accept  is not co-R.E, and is not recursive.

Jaruloj Chongstitvatana Decidability58 Halting problem Problem –Given a Turing machine T and string z, does T halt on z? –Given a program P and input z, does P halt on z? Language –Halt = {w  * | w=e(T)e(z) for a Turing machine T halting on z}. –Halt = { | T is a Turing machine halting on z}.

Jaruloj Chongstitvatana Decidability59 Halting problem is undecidable Proof: Let Halt = { | T is a Turing machine halting on z}. (Guess Halt is in R.E., but not co-R.E.) Show SA  Halt (We want a Turing-computable f n f( )= such that –T 1 accepts e(T 1 )  T 2 halts on z –T 1 does not accept e(T 1 )  T 2 does not halt on z Then, a possible function is f( ) = because T accepts e(T)  T halts on e(T).)

Jaruloj Chongstitvatana Decidability60 Halting problem is undecidable Let f(X) = X  e(X). f is Turing-computable because there is a TM that can write an encoding of an input string after the string itself. If f( )=  e( ), then T accepts e(T)  T halts on e(T). Then, SA  Halt, and Halt is not co-R.E. Thus, Halting problem is undecidable.

Jaruloj Chongstitvatana Decidability61 Some other undecidable problems FINITE Given a TM T, is L(T) finite? Guess FINITE is neither R.E. nor co-R.E. To assure L(T) is finite, we need to run T on all possible input and count if T accepts a finite number of strings. To assure L(T) is infinite, we need to run T on all possible input and count if T accepts an infinite number of strings.

Jaruloj Chongstitvatana Decidability62 FINITE is not recursive Let FINITE={ | T is a TM such that L(T) is finite.} Guess FINITE is neither R.E. nor co-R.E. Choose NSA which is not co-R.E. to show that NSA  FINITE. We want to find a Turing-computable function f such that  NSA  f( )=M  FINITE  NSA  M accepts , and thus L(M) is finite.  NSA  M accepts  , and thus L(M) is infinite. Then, let M=f( ) be a TM that runs T on its input, and accepts everything if T halts. T AccAll M

Jaruloj Chongstitvatana Decidability63 FINITE is not recursive Now, we will show that  NSA   FINITE If  NSA, then T does not accept. Then, M does not get to start AccAll. Thus, M accepts nothing and L(M) is finite. If  NSA, then T accepts. Then, M gets pass T, and accept everything. Thus, M accepts everything and L(M) is infinite. T AccAll M f is Turing-computable. Thus, NSA  FINITE. Since NSA is not Recursive, neither is FINITE.

Jaruloj Chongstitvatana Decidability64 Checklist  Prove a language is recursive, R.E., or co-R.E.  Prove closure properties of these classes of languages  Prove properties of reduction  Prove a language is not recursive, not R.E., or not co-R.E.  Prove a problem is decidable  Prove a problem is undecidable