More on showing L non-regular

Slides:



Advertisements
Similar presentations
MA/CSSE 474 Theory of Computation
Advertisements

MA/CSSE 474 Theory of Computation More on showing L non-regular (Using Closure)
CMPS 3223 Theory of Computation Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided.
CMPS 3223 Theory of Computation
TM Design Universal TM MA/CSSE 474 Theory of Computation.
MA/CSSE 474 Theory of Computation DFSM Canonical Form Proof of NDFSM  DFSM ALGORITHM (as much as we have time for) This version includes the "answers"
MA/CSSE 474 Theory of Computation More Reduction Examples Non-SD Reductions.
MA/CSSE 474 Theory of Computation Enumerability Reduction.
Poetry The Pumping Lemma Any regular language L has a magic number p And any long-enough word in L has the following property: Amongst its first p symbols.
MA/CSSE 474 Theory of Computation Decision Problems DFSMs.
MA/CSSE 474 Theory of Computation Regular Expressions Intro.
CS 203: Introduction to Formal Languages and Automata
TM Design Macro Language D and SD MA/CSSE 474 Theory of Computation.
MA/CSSE 474 Theory of Computation Minimizing DFSMs.
Algorithms and Decision Procedures for Regular Languages Chapter 9.
MA/CSSE 474 Theory of Computation How many regular/non-regular languages are there? Closure properties of Regular Languages (if there is time) Pumping.
MA/CSSE 474 Theory of Computation Languages, prefixes, sets, cardinality, functions.
MA/CSSE 474 Theory of Computation Decision Problems, Continued DFSMs.
MA/CSSE 474 Theory of Computation Regular Expressions Intro.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Decidability and Undecidability Proofs
Standard Representations of Regular Languages
CSE 105 theory of computation
CSE 105 theory of computation
Syntax Specification and Analysis
MA/CSSE 474 Theory of Computation
More on showing L non-regular
Properties of Regular Languages
MA/CSSE 474 Decision Problems Languages, Machines, Computation
Turing Machines Chapter 17.
Languages, prefixes, sets, cardinality, functions
Poetry The Pumping Lemma
MA/CSSE 474 Decision Problems about Regular Languages
CSE 105 theory of computation
Two issues in lexical analysis
Turing Machines Acceptors; Enumerators
Hierarchy of languages
Properties of Regular Languages
Finite Automata Reading: Chapter 2.
Chapter 4 Properties of Regular Languages
Bottom-up parsing Pumping Theorem for CFLs
CS21 Decidability and Tractability
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation Minimizing DFSMs.
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation
Languages, prefixes, sets, cardinality, functions
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation Computation FSM Intro.
CSE 105 theory of computation
Poetry The Pumping Lemma
MA/CSSE 474 Theory of Computation
Instructor: Aaron Roth
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation Nondeterminism NFSMs.
MA/CSSE 474 Theory of Computation
MA/CSSE 474 DFSM to RE Theory of Computation
CSE 105 theory of computation
Instructor: Aaron Roth
Minimize # states in a DFSM
CSE 105 theory of computation
Pumping Theorem for CFLs
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation
Computation Chapter 4.
COSC 3340: Introduction to Theory of Computation
COSC 3340: Introduction to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

More on showing L non-regular MA/CSSE 474 Theory of Computation More on showing L non-regular (Using Closure) Decision Problems Slides 8-10 were hidden for 201220. I unhid for 201240, should probably hide again for 201420

This one has so many levels … Your Questions? This one has so many levels … Previous class days' material Reading Assignments 8 problems Anything else

L = {aibj: i, j  0 and i  j} Try to use the Pumping Theorem by letting w = akbk+k!. Then y = ap for some nonzero p. Let q = (k!/p) + 1 (i.e., pump in (k!/p) times). Note that (k!/p) must be an integer because p < k. The number of a’s in the new string is k + (k!/p)p = k + k!. So the new string is ak+k!bk+k!, which has equal numbers of a’s and b’s and so is not in L. This slide is animated.

L = {aibj: i, j  0 and i  j} An easier way: If L is regular then so is L. Is L regular? L = AnBn  {strings with a and b out of order} If L is regular, then so is L = L  a*b* = ___________

L = {aibjck: i, j, k ≥ 0 and (if i = 1 then j = k)} Every string in L of length at least 1 is pumpable. But is L regular?

L = {aibjck: i, j, k ≥ 0 and (if i = 1 then j = k)} Every string in L of length at least 1 is pumpable. Rewrite the final condition as: (i  1) or (j = k)

L = {aibjck: i, j, k ≥ 0 and (i  1 or j = k)} Every string in L of length at least 1 is pumpable: If w has i = 0: if j  0, let y be b; otherwise, let y be c. Let q=0 or q>1. In each case i will still be 0 and thus not equal to 1, so the resulting string is in L. If i = 1: let y be a. Let q=0 or q>1. Then i will no longer equal 1, so the resulting string is in L. If i = 2: let y be aa. Let q=0 or q>1. Then i cannot equal 1, so the resulting string is in L. If i > 2: let y = a. Let q=0 or q>1. Then i cannot equal 1, so the resulting string is in L.

L = {aibjck: i, j, k ≥ 0 and (i  1 or j = k)} But the closure theorems help. Suppose we guarantee that i = 1. If L is regular, then so is: L = L  ab*c*. L = {abjck : j, k ≥ 0 and j = k} We can easily use the Pumping Theorem to show that L is not regular:

L = {aibjck: i, j, k ≥ 0 and (i  1 or j = k)} An Alternative If L is regular, then so is LR: LR = {ckbjai : i, j, k ≥ 0 and (i  1 or j = k)} Use Pumping to show that LR is not regular:

Functions from one Language to Another Let firstchars(L) = {w : yL ( y = cx, c  L, x  L*, and w  c*)} Is the set of regular languages closed under firstchars? L firstchars(L)  a*b* ca*cb*

Functions from one Language to Another Let chop(L) = {w : xL ( x = x1cx2, x1  L*, x2  L*, c  L, |x1| = |x2|, and w = x1x2)} Is the set of regular languages closed under chop? L chop(L)  a*b* a*db* Chop(a*db*) = AnBn and also strings of the form aidbj where i+j is an odd number The intersection of this with A*B* is not regular, so it is not regular.

Functions from One Language to Another Let maxstring(L) = {w: w  L, z * (z    wz  L)} Is the set of regular languages closed under maxstring? L maxstring(L)  a*b* ab*a a*b*a

The rest of Session 16's slides (previous session) They are there as examples in case they are helpful for you as you do HW8 Next session we may or may not do some of these examples in class. Most of them are discussed in detail in the textbook.

Summary of algorithms we have so far The next few slides are here for reference. I do not expect to spend class time on them. You should know how to do all of them, but during class exercises and homework you may simply "call" any of them as part of your decision procedures. ● Operate on FSMs without altering the language that is accepted: ● ndfsmtodfsm(M: NDFSM) ● minDFSM (M:DFSM) ● buildFSMcanonicalform(M:FSM)

Summary of Algorithms ● Compute functions of languages defined as FSMs: ● Given FSMs M1 and M2, construct a FSM M3 such that L(M3) = L(M2)  L(M1). ● Given FSMs M1 and M2, construct a new FSM M3 such that L(M3) = L(M2) L(M1). ● Given FSM M, construct an FSM M* such that L(M*) = (L(M))*. ● Given a DFSM M, construct an FSM M* such that L(M*) = L(M). ● Given two FSMs M1 and M2, construct an FSM M3 such that L(M3) = L(M2)  L(M1). L(M3) = L(M2) - L(M1). ● Given an FSM M, construct an FSM M* such that L(M*) = (L(M))R. ● Given an FSM M, construct an FSM M* that accepts letsub(L(M)).

Algorithms, Continued ● Converting between FSMs and regular expressions: ● Given a regular expression , construct an FSM M such that: L() = L(M) ● Given an FSM M, construct a regular expression  ● Algorithms that implement operations on languages defined by regular expressions: any operation that can be performed on languages defined by FSMs can be implemented by converting all regular expressions to equivalent FSMs and then executing the appropriate FSM algorithm.

Algorithms, Continued ● Converting between FSMs and regular grammars: ● Given a regular grammar G, construct an FSM M such that: L(G) = L(M) ● Given an FSM M, construct a regular grammar G L(G) = L(M). We have not yet discussed regular grammars. They are in the reading assignment for tomorrow. This is here for completeness.

Decision Procedures A decision procedure is an algorithm whose result is a Boolean value (in this course's context, sometimes we will write "yes" or "no" instead of "true" or "false"). It must: ● Halt, no matter what (correctly typed) input it is given. ● Always give the correct answer Usually a decision procedure has one or more parameters Zero-parameter decision procedures are not very interesting!

Answering Specific Questions Given two regular expressions 1 and 2, is: (L(1)  L(2)) – {}  ? 1. From 1, construct an FSM M1 such that L(1) = L(M1). 2. From 2, construct an FSM M2 such that L(2) = L(M2). 3. Construct M such that L(M ) = L(M1)  L(M2). 4. Construct M such that L(M) = {}. 5. Construct M such that L(M ) = L(M ) - L(M). 6. If L(M ) is empty return False; else return True. (in tomorrow's exercises, you'll write an algorithm for step 6) For practice later: Given two regular expressions 1 and 2, are there at least 3 strings that are generated by both of them?

Decision Procedure Practice Find a group of three students. Work together to write decision procedures for as many of the problems on the following slide as you can do in the allotted time.

Decision Procedures for Regular Languages ● Given a FSM M and a string w, does M accept w? ● Given a regular expression  and a string w, does  generate w? ● Given a FSM M, is L(M) empty? ● Given a FSM M, does L(M) = M*? ● Given a FSM M, is L(M) finite? ● Given a FSM M, is L(M) infinite? ● Given two FSMs M1 and M2, are they equivalent? ● Given an DFSM M, is M minimal?