CSE 105 THEORY OF COMPUTATION

Similar documents
CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CSE 105 THEORY OF COMPUTATION

CSE 105 Theory of Computation Professor Jeanne Ferrante

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Unit 6. Non Regular Languages The Pumping Lemma. Reading: Sipser, chapter 1

TDDD65 Introduction to the Theory of Computation

CSE 105 THEORY OF COMPUTATION

Proving languages to be nonregular

CSE 105 THEORY OF COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Name: Student ID: Instructions:

CSE 105 Theory of Computation

Computational Models: Class 3

Computational Models - Lecture 3 1

CSE 105 THEORY OF COMPUTATION

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

Computer Sciences Department

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

CSE 105 Theory of Computation Professor Jeanne Ferrante

Intro to Theory of Computation

Finite Automata and Regular languages

Automata: a short introduction

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

Notes for Comp 497 (Comp 454) Week 5 2/22/05. Today we will look at some of the rest of the material in Part 1 of the book.

Computational Theory

Lecture 4: More on Regexps, Non-Regular Languages

Decidability and Undecidability

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

Please give details of your calculation. A direct answer without explanation is not counted.

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages

CSE 105 THEORY OF COMPUTATION

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages

Answers to the CSCE 551 Final Exam, April 30, 2008

Formal Languages, Automata and Models of Computation

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

MA/CSSE 474 Theory of Computation. Your Questions? Previous class days' material Reading Assignments

Computational Models - Lecture 3 1

CSCE 551 Final Exam, Spring 2004 Answer Key

Chapter 2 The Pumping Lemma

Before we show how languages can be proven not regular, first, how would we show a language is regular?

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

What we have done so far

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is

The Pumping Lemma and Closure Properties

More Properties of Regular Languages

Incorrect reasoning about RL. Equivalence of NFA, DFA. Epsilon Closure. Proving equivalence. One direction is easy:

CSE 105 Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS5371 Theory of Computation. Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)

Finite Automata (contd)

ECS120 Fall Discussion Notes. October 25, The midterm is on Thursday, November 2nd during class. (That is next week!)

3515ICT: Theory of Computation. Regular languages

Chapter 6. Properties of Regular Languages

CS 154. Finite Automata, Nondeterminism, Regular Expressions

10. The GNFA method is used to show that

Closure under the Regular Operations

CSE 105 THEORY OF COMPUTATION

CS 154 Introduction to Automata and Complexity Theory

More on Regular Languages and Non-Regular Languages

1 More finite deterministic automata

Nonregular Languages

CSE 105 THEORY OF COMPUTATION

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Part 3 out of 5. Automata & languages. A primer on the Theory of Computation. Last week, we learned about closure and equivalence of regular languages

CS 154, Lecture 3: DFA NFA, Regular Expressions

Mathematics for linguists

CSE 105 THEORY OF COMPUTATION

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

COM364 Automata Theory Lecture Note 2 - Nondeterminism

FS Properties and FSTs

Lecture 3: Finite Automata

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

CS 121, Section 2. Week of September 16, 2013

2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a

Theory of Computation

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

CSE 105 THEORY OF COMPUTATION

MA/CSSE 474 Theory of Computation

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers.

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

MA/CSSE 474 Theory of Computation

1 Showing Recognizability

CPSC 421: Tutorial #1

highlights CSE 311: Foundations of Computing highlights 1 in third position from end Fall 2013 Lecture 25: Non-regularity and limits of FSMs

Sri vidya college of engineering and technology

Sample Midterm. Understanding the questions is part of the exam; you are not allowed to ask questions during the exam.

Foundations of (Theoretical) Computer Science

More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41

CSE 20 DISCRETE MATH. Winter

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Properties of Regular Languages. BBM Automata Theory and Formal Languages 1

Transcription:

CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/

Today's learning goals Sipser Ch 1.4 Give an example of a non-regular language Outline two strategies for proving that there are nonregular languages State the pumping lemma Relate the pumping lemma to states in a DFA Use the pumping lemma to prove that a set is non-regular

Reminders HW 3 due Friday Exam 1 next week Wednesday April 20 evening 8pm-9:50pm SOLIS 107 (seating chart on Ted) One (double-sided) handwritten 3" by 5" index card for notes Review session for exam 1 on Monday April 18, Peterson 108, 8-10 Practice exam on Ted

All roads lead to regular sets? Are there any languages over {0,1} that are not regular? A. Yes: a language that is recognized by an NFA but not any DFA. A. Yes: there is some infinite language of strings over {0,1} that is not described by any regular expression. B. No: all languages over {0,1} are regular because that's what it means to be a language. C. No: for each set of strings over {0,1}, some DFA recognizes that set. A. I don't know.

Counting Fact: a countable union of countable sets is countable. Fact: {0,1} * is countably infinite. X * is countably infinite when X is finite. Fact: the set of subsets of a countably infinite sets is uncountable. Fact: there are countably many DFA with Σ={0,1} Fact: there are countably many regular languages over {0,1}

Counting Fact: a countable union of countable sets is countable. Fact: {0,1} * is countably infinite. X * is countably infinite when X is finite. Uncountably many languages over {0,1} Fact: the set of subsets of a countably infinite sets is uncountable. Fact: there are countably many DFA with Σ={0,1} Countably many regular languages Fact: there are countably over many {0,1} regular languages over {0,1}

Proving nonregularity How can we prove that a set is non-regular? A. Try to design a DFA that recognizes it and, if the first few attempts don't work, conclude there is none that does. B. Prove that it's a strict subset of some regular set. C. Prove that it's the union of two regular sets. D. Prove that its complement is not regular. E. I don't know.

Where we stand There exist non-regular sets. If we know that some sets are not regular, we can conclude others are also not regular judiciously reasoning using closure properties of class of regular languages. No example of a specific regular set... yet.

Bounds on DFA in DFA, memory = states Automata can only "remember" finitely far in the past finitely much information If a computation path visits the same state more than once, the machine can't tell the difference between the first time and future times it visited that state.

Example! { 0 n 1 n n 0} What are some strings in this set? What are some strings not in this set? Compare to L(0 * 1 * ) Design a DFA? NFA?

Example! { 0 n 1 n n 0} What are some strings in this set? What are some strings not in this set? Compare to L(0 * 1 * ) Design a DFA? NFA?

# of states and lengths of words What is the length of the shortest word accepted by this DFA? What is the length of the longest word accepted by this DFA? What is the language of this DFA?

# of states and lengths of words What is the length of the longest word accepted by this DFA without visiting any state more than once? A. 0 B. 1 C. 2 D. 3 E. 4

# of states and lengths of words What feature do computation paths of longer words that are accepted by the DFA have? A. They must visit q3 at least once. B. They must visit q1 more than once. C. They must start at q0. D. More than one of the above. E. I don't know.

Pumping Focus on computation path through DFA

Pumping Focus on computation path through DFA

Pumping Focus on computation path through DFA Idea: if one long string is accepted, then many other strings have to be accepted too

Pumping Lemma Sipser p. 78 Theorem 1.70

Pumping Lemma Sipser p. 78 Theorem 1.70 # states in DFA recognizing A Transition labels along loop

Using the Pumping Lemma Claim: The set L = {0 n 1 n n 0} is not regular.

Using the Pumping Lemma Claim: The set L = {0 n 1 n n 0} is not regular. Proof: Assume, towards a contradiction, that L is regular. Pumping Lemma gives property of all regular sets. Can we get a contradiction by assuming that the Pumping Lemma applies to this set?

Using the Pumping Lemma Claim: The set L = {0 n 1 n n 0} is not regular. Proof: Assume, towards a contradiction, that L is regular. Therefore, the Pumping Lemma applies to L and gives us some number p, the pumping length of L. In particular, this means that every string in L that is of length p or more can be "pumped". Idea: can we find some long string in L that can't be?

Using the Pumping Lemma Claim: The set L = {0 n 1 n n 0} is not regular. Proof: In particular, this means that every string in L that is of length p or more can be "pumped". Goal: pick a string s in L of length greater than or equal to p such that any division of s as s =xyz with y >0 and xy p gives some value i 0 with xy i z not in L So we have a contradiction, and L is not regular.

Using the Pumping Lemma Claim: The set L = {0 n 1 n n 0} is not regular. Proof: Goal: pick a string s in L of length greater than or equal to p such that any division of s as s =xyz with y >0 and xy p gives some value i 0 with xy i z not in L Choose s = 0 p 1 p. Consider any s = xyz with y >0, xy p.

Using the Pumping Lemma Claim: The set L = {0 n 1 n n 0} is not regular. Proof: Goal: pick a string s in L of length greater than or equal to p such that any division of s as s =xyz with y >0 and xy p gives some value i 0 with xy i z not in L Choose s = 0 p 1 p. Consider any s = xyz with y >0, xy p. Since xy p, x=0 m, y = 0 n, z = 0 r 1 p with m+n+r =p, j>0.

Using the Pumping Lemma Claim: The set L = {0 n 1 n n 0} is not regular. Proof: Goal: pick a string s in L of length greater than or equal to p such that any division of s as s =xyz with y >0 and xy p gives some value i 0 with xy i z not in L Choose s = 0 p 1 p. Consider any s = xyz with y >0, xy p. Since xy p, x=0 m, y = 0 n, z = 0 r 1 p with m+n+r =p, j>0. Picking i=0: xy i z = xz = 0 m 0 r 1 p = 0 m+r 1 p, not in L!

Using the Pumping Lemma Claim: The set L = {0 n 1 n n 0} is not regular. Proof: Goal: pick a string s in L of length greater than or equal to p such that any division of s as s =xyz with y >0 and xy p gives some value i 0 with xy i z not in L Choose s = 0 p 1 p. Consider any s = xyz with y >0, xy p. Since xy p, x=0 m, y = 0 n, z = 0 r 1 p with m+n+r =p, j>0. Picking i=0: xy i z = xz = 0 m 0 r 1 p = 0 m+r 1 p, not in L! This is a contradiction with the Pumping Lemma applied to L, so L must not be regular.

Key ingredients in proof Claim: Language L is not regular. Proof: Assume, towards a contradiction, that L is regular. By the Pumping Lemma, there is a pumping length p for L. Consider the string s = You must pick s carefully: we want s p and s in L. *Confirm these facts as part of your proof* Now we will prove a contradiction with the statement "s can be pumped" Consider an arbitrary choice of x,y,z such that s = xyz, y >0, xy p. This means that...what properties are guaranteed about x,y,z? Consider i= In this case, xy i z =, which is not in L, a contradiction with the Pumping Lemma applying to L and so L is not regular.

Another example Claim: The set {a n b m a n m,n 0} is not regular. Proof: Consider the string s = You must pick s carefully: we want s p and s in L. Now we will prove a contradiction with the statement "s can be pumped" Which choices of s cannot be used to complete the proof? A. s = a p b p B. s = ab p a C. s = a p b p a p D. s = a p ba p E. None of the above (all of these choices work).

Another example Claim: The set {a n b m a n m,n 0} is not regular. Proof: Consider the string s = You must pick s carefully: we want s p and s in L. Now we will prove a contradiction with the statement "s can be pumped" Consider an arbitrary choice of x,y,z such that s = xyz, y >0, xy p. This means that...what properties are guaranteed about x,y,z? Consider i= In this case, xy i z =, which is not in L, a contradiction with the Pumping Lemma applying to L and so L is not regular.

And another Claim: The set {w w R w is a string over {0,1} } is not regular. Proof: Consider the string s = You must pick s carefully: we want s p and s in L. Now we will prove a contradiction with the statement "s can be pumped" Consider i= Which s and i let us complete the proof? A. s = 0 p 0 p, i=2 B. s = 0110, i=0 C. s = 0 p 110 p, i=1 D. s = 1 p 001 p, i=3 E. I don't know

Reminders HW 3 due Friday Exam 1 next week Wednesday April 20 evening 8pm-9:50pm SOLIS 107 (seating chart will be released shortly) One (double-sided) handwritten 3" by 5" index card for notes Review session for exam 1 on Monday April 18, Peterson 108, 8-10