1 Module 10 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.

Slides:



Advertisements
Similar presentations
Chapter Three: Closure Properties for Regular Languages
Advertisements

1 Lecture 32 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union,
More Set Definitions and Proofs 1.6, 1.7. Ordered n-tuple The ordered n-tuple (a1,a2,…an) is the ordered collection that has a1 as its first element,
1 Section 14.1 Computability Some problems cannot be solved by any machine/algorithm. To prove such statements we need to effectively describe all possible.
Computability and Complexity 5-1 Classifying Problems Computability and Complexity Andrei Bulatov.
1 Introduction to Computability Theory Lecture13: Mapping Reductions Prof. Amos Israeli.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
1 Lecture 4: Formal Definition of Solvability Analysis of decision problems –Two types of inputs:yes inputs and no inputs –Language recognition problem.
1 Module 2: Fundamental Concepts Problems Programs –Programming languages.
1 Module 15 FSA’s –Defining FSA’s –Computing with FSA’s Defining L(M) –Defining language class LFSA –Comparing LFSA to set of solvable languages (REC)
Lecture 9 Recursive and r.e. language classes
1 Module 8 Closure Properties –Definition –Language class definition set of languages –Closure properties and first-order logic statements For all, there.
1 Lecture 14 Language class LFSA –Study limits of what can be done with FSA’s –Closure Properties –Comparing to other language classes.
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)
1 Module 21 Closure Properties for LFSA using NFA’s –From now on, when I say NFA, I mean any NFA including an NFA- unless I add a specific restriction.
1 Module 7 Halting Problem –Fundamental program behavior problem –A specific unsolvable problem –Diagonalization technique revisited Proof more complex.
1 Lecture 26 Decision problems about regular languages –Basic problems are solvable halting, accepting, and emptiness problems –Solvability of other problems.
1 Module 11 Proving more specific problems are not solvable Input transformation technique –Use subroutine theme to show that if one problem is unsolvable,
Decidable and undecidable problems deciding regular languages and CFL’s Undecidable problems.
Fall 2004COMP 3351 The Chomsky Hierarchy. Fall 2004COMP 3352 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free.
1 Lecture 10 Proving more specific problems are not recursive Reduction technique –Use subroutine theme to show that if one problem is unsolvable, so is.
1 Lecture 7 Halting Problem –Fundamental program behavior problem –A specific unsolvable problem –Diagonalization technique revisited Proof more complex.
1 Lecture 16 FSA’s –Defining FSA’s –Computing with FSA’s Defining L(M) –Defining language class LFSA –Comparing LFSA to set of solvable languages (REC)
1 Lecture 7 Halting Problem –Fundamental program behavior problem –A specific unsolvable problem –Diagonalization technique revisited Proof more complex.
1 Lecture 16 FSA’s –Defining FSA’s –Computing with FSA’s Defining L(M) –Defining language class LFSA –Comparing LFSA to set of solvable languages (REC)
1 Lecture 5 Topics –Closure Properties for REC Proofs –2 examples Applications.
1 Lecture 18 Closure Properties of Language class LFSA –Remember ideas used in solvable languages unit –Set complement –Set intersection, union, difference,
1 Strings and Languages Operations Concatenation Exponentiation Kleene Star Regular Expressions.
1 Lecture 11 Proving more specific problems are not solvable Input transformation technique –Use subroutine theme to show that if one problem is unsolvable,
1 Module 11 Proving more specific problems are not solvable Input transformation technique –Use subroutine theme to show that if one problem is unsolvable,
1 Lecture 7 Topics –Problems about program behavior At least problem input is a program/algorithm –Halting Problem Fundamental problem about program behavior.
1 Module 31 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union, concatenation.
1 Lecture 23 Decision problems about regular languages –Programs can be inputs to other programs FSA’s, NFA’s, regular expressions –Basic problems are.
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
1 Module 25 Decision problems about regular languages –Basic problems are solvable halting, accepting, and emptiness problems –Solvability of other problems.
1 Lecture 19 Closure Properties for LFSA using NFA’s –union second proof –concatenation –Kleene closure.
1 Module 4: Formal Definition of Solvability Analysis of decision problems –Two types of inputs:yes inputs and no inputs –Language recognition problem.
CS21 Decidability and Tractability
1 Lecture 11 Proving more specific problems are not solvable Input transformation technique –Use subroutine theme to show that if one problem is unsolvable,
1 Strings and Languages Operations Concatenation Exponentiation Kleene Star Regular Expressions.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
1 Module 9 Closure Properties –Definition –Language class definition set of languages –Closure properties and first-order logic statements For all, there.
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.
MA/CSSE 474 Theory of Computation Enumerability Reduction.
1 Module 31 Closure Properties for CFL’s –Kleene Closure –Union –Concatenation CFL’s versus regular languages –regular languages subset of CFL.
TK PrasadPumping Lemma1 Nonregularity Proofs. TK PrasadPumping Lemma2 Grand Unification Regular Languages: Grand Unification (Parallel Simulation) (Rabin.
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.
Chapter 8 Properties of Context-free Languages These class notes are based on material from our textbook, An Introduction to Formal Languages and Automata,
1 Module 17 Closure Properties of Language class LFSA –Remember ideas used in solvable languages unit –Set complement –Set intersection, union, difference,
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
Decidability Decidable/Undecidable problems. Jaruloj Chongstitvatana Decidability2 Accepting: Definition Let T = (Q, , , , s) be a TM. T accepts.
1 Strings and Languages Operations Concatenation Exponentiation Kleene Star Regular Expressions.
1 Chapter 9 Undecidability  Turing Machines Coded as Binary Strings  Universal Turing machine  Diagonalizing over Turing Machines  Problems as Languages.
1 Closure E.g., we understand number systems partly by understanding closure properties: Naturals are closed under +, , but not -, . Integers are closed.
MA/CSSE 474 Theory of Computation How many regular/non-regular languages are there? Closure properties of Regular Languages (if there is time) Pumping.
Module 7 Halting Problem –Fundamental program behavior problem –A specific unsolvable problem –Diagonalization technique revisited Proof more complex 1.
CSE322 PROPERTIES OF REGULAR LANGUAGES
Decidable Languages Costas Busch - LSU.
Closure Properties of Regular Languages
Chapter 4 Properties of Regular Languages
Instructor: Aaron Roth
CS21 Decidability and Tractability
Cpt S 317: Spring 2009 Reading: Chapter 8 & 9
Instructor: Aaron Roth
More Undecidable Problems
Languages Fall 2018.
Presentation transcript:

1 Module 10 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive (solvable) languages –for the set of r.e. (half-solvable) languages Generic Element proof technique

2 RE and REC language classes REC –A solvable language is commonly referred to as a recursive language for historical reasons –REC is defined to be the set of solvable or recursive languages RE –A half-solvable language is commonly referred to as a recursively enumerable or r.e. language –RE is defined to be the set of r.e. or half- solvable languages

3 Closure Properties of REC * We now prove REC is closed under two set operations –Set Complement –Set Intersection In these proofs, we try to highlight intuition and common sense

4 REC and Set Complement REC EVEN All Languages ODD Even: set of even length strings Is Even solvable (recursive)? Give a program P that solves it. Complement of Even? –Odd: set of odd length strings Is Odd recursive (solvable)? Does this prove REC is closed under set complement? How is the program P’ that solves Odd related to the program P that solves Even?

5 P’ Illustration P Input x Yes/No P’ No/Yes

6 Code for P’ bool main(string y) { if (P (y)) return no; else return yes; } bool P (string y) /* details deleted; key fact is P is guaranteed to halt on all inputs */

7 Set Complement Lemma If L is a solvable language, then L complement is a solvable language Proof –Let L be an arbitrary solvable language First line comes from For all L in REC –Let P be the C++ program which solves L P exists by definition of REC

8 –Modify P to form P’ as follows Identical except at very end Complement answer –Yes → No –No → Yes –Program P’ solves L complement Halts on all inputs Answers correctly –Thus L complement is solvable Definition of solvable proof continued

9 REC Closed Under Set Union All Languages L1L1 L2L2 L 1 U L 2 REC If L 1 and L 2 are solvable languages, then L 1 U L 2 is a solvable language Proof –Let L 1 and L 2 be arbitrary solvable languages –Let P 1 and P 2 be programs which solve L 1 and L 2, respectively

10 REC Closed Under Set Union All Languages L1L1 L2L2 L 1 U L 2 REC –Construct program P 3 from P 1 and P 2 as follows –P 3 solves L 1 U L 2 Halts on all inputs Answers correctly –L 1 U L 2 is solvable

11 Yes/No P 3 Illustration P1P1 P2P2 OR Yes/No P3P3

12 Code for P 3 bool main(string y) { if (P 1 (y)) return yes; else if (P 2 (y)) return yes; else return no; } bool P 1 (string y) /* details deleted; key fact is P 1 always halts. */ bool P 2 (string y) /* details deleted; key fact is P 2 always halts. */

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

14 Closure Properties of RE * We now try to prove RE is closed under the same two set operations –Set Union –Set Complement In these proofs –We define a more formal proof methodology –We gain more intuition about the differences between solvable and half-solvable problems

15 RE Closed Under Set Union Expressing this closure property as an infinite set of facts –Let L i denote the ith r.e. language L 1 intersect L 1 is in RE L 1 intersect L 2 is in RE... L 2 intersect L 1 is in RE...

16 Generic Element or Template Proofs Since there are an infinite number of facts to prove, we cannot prove them all individually Instead, we create a single proof that proves each fact simultaneously I like to call these proofs generic element or template proofs

17 Basic Proof Ideas Name your generic objects –For example, L or L 1 or L 2 Only use facts which apply to any relevant objects –For example, there must exist a program P 1 that half-solves L 1 Work from both ends of the proof –The first and last lines are often obvious, and we can often work our way in

18 RE Closed Under Set Union L1L1 L2L2 L 1 U L 2 Let L 1 and L 2 be arbitrary r.e. languages L 1 U L 2 is an r.e. language There exist P 1 and P 2 s.t. Y(P 1 )=L 1 and Y(P 2 )=L 2 There exists a program P that half-solves L 1 U L 2 Construct program P 3 from P 1 and P 2 Prove Program P 3 half-solves L 1 U L 2

19 What code did we use for P 3 when we worked with solvable languages? Constructing Program P 3 L1L1 L2L2 L 1 U L 2 bool main(string y) { if (P 1 (y)) return yes; else if (P 2 (y)) return yes; else return no;} bool P 1 (string y) /* details deleted; key fact is P 1 always halts. */ bool P 2 (string y) /* details deleted; key fact is P 2 always halts. */ Will this code work for half-solvable languages?

20 Proving P 3 Is Correct 2 steps to showing P 3 half-solves L 1 U L 2 –For all x in L 1 U L 2, must show P 3 –For all x not in L 1 U L 2, must show P 3

21 P 3 works correctly? –Let x be an arbitrary string in L 1 U L 2 Note, this subproof is a generic element proof –What are the two possibilities for x? x is in L 1 x is in L 2 –What does P 3 do if x is in L 1 ? Does it matter if x is in or not in L 2 ? –What does P 3 do if x is in L 2 ? Does it matter if x is in or not in L 1 ? –Does P 3 work correctly on such x? If not, what strings cause P 3 a problem? bool main(string y) { if (P 1 (y)) return yes; else if (P 2 (y)) return yes; else return no; }

22 P 3 works correctly? –Let x be an arbitrary string NOT in L 1 U L 2 Note, this subproof is a generic element proof –x is not in L 1 AND x is not in L 2 –What does P 3 do on x in this case? What does P 1 do on x? What does P 2 do on x? –Does P 3 work correctly on such x? bool main(string y) { if (P 1 (y)) return yes; else if (P 2 (y)) return yes; else return no; }

23 Code for Correct P 3 bool main(string y){ if ((P 1 (y) || P 2 (y)) return yes; /* P 1 and P 2 run in parallel (alternating execution) */ else return no; } bool P 1 (string y) /* key fact is P 1 only guaranteed to halt on yes input instances */ bool P 2 (string y) /* key fact is P 2 only guaranteed to halt on yes input instances */

24 P 3 works correctly? –Let x be an arbitrary string in L 1 U L 2 Note, this subproof is a generic element proof –What are the two possibilities for x? x is in L 1 x is in L 2 –What does P 3 do if x is in L 1 ? Does it matter if x is in or not in L 2 ? –What does P 3 do if x is in L 2 ? Does it matter if x is in or not in L 1 ? –Does P 3 work correctly on such x? If not, what strings cause P 3 a problem? bool main(string y){ if ((P 1 (y) || P 2 (y)) return yes; else return no; } /* P 1 and P 2 run in parallel */

25 First-order logic formulation for statement –RE is closed under set complement What this really means –Let L i denote the ith r.e. language L 1 complement is in RE L 2 complement is in RE... RE and Set complement L LcLc RE

26 RE and Set complement Let L be an arbitrary r.e. language L complement is an r.e. language There exists P s.t. Y(P)=L There exists a program P’ which half-solves L complement Construct program P’ from P Prove Program P’ half-solves L complement L LcLc RE

27 Constructing P’ What did we do in recursive case? –Run P and then just complement answer at end Accept → Reject Reject → Accept Does this work in this case? –No. Why not? Does this prove that RE is not closed under set complement?

28 Other closure properties Unary Operations –Language reversal –Kleene Closure Binary operations –set intersection –concatenation Not closed –Set difference (on practice hw)

29 Pseudo Closure Property Lemma: If L and L c are half-solvable, then L is solvable. Question: What about L c ?

30 High Level Proof –Let L be an arbitrary language where L and L c are both half-solvable –Let P 1 and P 2 be the programs which half-solve L and L c, respectively –Construct program P 3 from P 1 and P 2 –Argue P 3 solves L –L is solvable

31 Constructing P 3 Problem –Both P 1 and P 2 may loop on some input strings, and we need P 3 to halt on all input strings Key Observation –On all input strings, one of P 1 and P 2 is guaranteed to halt. Why?

32 Illustration ** L P 1 halts LcLc P 2 halts

33 Construction and Proof P 3 ’s Operation –Run P 1 and P 2 in parallel on the input string x until one accepts x Guaranteed to occur given previous argument Also, only one program will accept any string x –IF P 1 is the accepting machine THEN yes ELSE no

34 P 3 Illustration P1P1 P2P2 Yes P3P3 Input Yes No

35 Code for P 3 * bool main(string y) { parallel-execute(P 1 (y), P 2 (y)) until one returns yes; if (P 1 (y)) return yes; if (P 2 (Y)) return no; } bool P 1 (string y) /* guaranteed to halt on strings in L*/ bool P 2 (string y) /* guaranteed to halt on strings in L c */

36 RE and REC REC RE All Languages L LcLc

37 RE and REC REC RE All Languages L LcLc LcLc LcLc Are there any languages L in RE - REC?

38 RE and REC REC RE All Languages H So where does H c belong? HcHc

39 Closure Property Questions Which of the following imply L is solvable given REC is closed under set union? –L 1 U L 2 = L –L 1 U L = L 2 –L U L 2 = L 1 In all cases, L 1 and L 2 are known to be solvable

40 Closure Property Questions Which of the following imply L is NOT solvable given REC is closed under set union? –L 1 U L 2 = L –L 1 U L = L 2 –L U L 2 = L 1 In all cases, L 1 is solvable and L 2 is NOT solvable

41 Summary Definition of REC and RE Proofs of some closure properties for both language classes –RE more complex Pseudo-closure Property RE is not closed under set complement Proving a language is or is not in a language class using closure properties