Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Lecture 5 Topics –Closure Properties for REC Proofs –2 examples Applications.

Similar presentations


Presentation on theme: "1 Lecture 5 Topics –Closure Properties for REC Proofs –2 examples Applications."— Presentation transcript:

1 1 Lecture 5 Topics –Closure Properties for REC Proofs –2 examples Applications

2 2 Closure Properties of REC We now prove REC is closed under two set operations –Set Complement –Set Intersection We then show how to apply closure properties to prove a target language is or is not recursive

3 3 Quick Questions What does the following statement mean? –REC is closed under set complement How do you prove a language L is in REC?

4 4 Why study closure properties? 1: It tests how well we really understand the concepts we encounter –language classes, REC, decidability, subroutine 2: It highlights the subroutine concept and how we can build on previous algorithms to construct new algorithms –we don’t have to build our algorithms from scratch every time

5 5 Set Complement Example Even: the set of even length strings over {0,1} Complement of Even? –Odd: the set of odd length strings over {0,1} Is Odd recursive? How is the program P’ which decides Odd related to the program P which decides Even?

6 6 Set Complement Lemma If L is a recursive language, then L complement is a recursive language –Rewrite this in first-order logic Proof –Let L be an arbitrary recursive language First line comes from For all L in REC –Let P be the C ++ program which decides L P exists by definition of REC

7 7 –Modify P to form P’ as follows Identical except at very end Complement answer –Yes -> No –No -> Yes –Program P’ decides L complement Halts on all inputs Answers correctly –Thus L complement is recursive Definition of recursive proof continued

8 8 P’ Illustration P Input x YES No P’ YES No

9 9 Set Intersection Example Even: the set of even length strings over {0,1} Mod-5: the set of strings of length a multiple of 5 over {0,1} What is Even intersection Mod-5? –Mod-10: the set of strings of length a multiple of 10 over {0,1} How is the program P 3 (Mod-10) related to programs P 1 (Even) and P 2 (Mod-5)

10 10 Set Intersection Lemma If L 1 and L 2 are recursive languages, then L 1 intersection L 2 is a recursive language –Rewrite this in first-order logic –Note we have two languages because intersection is a binary operation Proof –Let L 1 and L 2 be arbitrary recursive languages –Let P 1 and P 2 be programs which decide L 1 and L 2, respectively

11 11 –Construct program P 3 from P 1 and P 2 as follows P 3 runs both P 1 and P 2 on the input string If both say yes, P 3 says yes Otherwise, P 3 says no –P 3 decides L 1 intersection L 2 Halts on all inputs Answers correctly –L 1 intersection L 2 is a recursive language proof continued

12 12 P 3 Illustration P1P1 P2P2 Yes/No AND Yes/No P3P3

13 13 Other Closure Properties Unary Operations –Language Reversal –Kleene Star Binary Operations –Set Union –Set Difference –Symmetric Difference –Concatenation

14 14 Closure Property Applications How can we use closure properties to prove a language L T is recursive? Unary operator op (e.g. complement) –1) Find a known recursive language L –2) Show L T = L op Binary operator op (e.g. intersection) –1) Find 2 known recursive languages L 1 and L 2 –2) Show L T = L 1 op L 2

15 15 Closure Property Applications How can we use closure properties to prove a language L T is not recursive? Unary operator op (e.g. complement) –1) Find a known non-recursive language L –2) Show L T op = L Binary operator op (e.g. intersection) –1) Find a known recursive language L 1 –2) Find a known non-recursive language L 2 –2) Show L 2 = L 1 op L T

16 16 Summary Closure Properties –proof methods –Applications Proving new languages are recursive Proving new languages are NOT recursive –Need a specific non-recursive language


Download ppt "1 Lecture 5 Topics –Closure Properties for REC Proofs –2 examples Applications."

Similar presentations


Ads by Google