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

Similar documents
Notes on Pumping Lemma

Automata: a short introduction

CS 420, Spring 2018 Homework 4 Solutions. 1. Use the Pumping Lemma to show that the following languages are not regular: (a) {0 2n 10 n n 0};

Theory of Computation

Proving languages to be nonregular

CSE 105 THEORY OF COMPUTATION

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

CSE 105 THEORY OF COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Automata Theory Final Exam Solution 08:10-10:00 am Friday, June 13, 2008

Computer Sciences Department

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.

CSE 105 THEORY OF COMPUTATION

Intro to Theory of Computation

The Pumping Lemma and Closure Properties

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

CSE 105 Homework 5 Due: Monday November 13, Instructions. should be on each page of the submission.

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Finite Automata and Regular languages

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

HW6 Solutions. Micha l Dereziński. March 20, 2015

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

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

More Properties of Regular Languages

HW 3 Solutions. Tommy November 27, 2012

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

CSE 355 Test 2, Fall 2016

CpSc 421 Homework 1 Solutions

Computational Theory

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CS375 Midterm Exam Solution Set (Fall 2017)

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX

More on Regular Languages and Non-Regular Languages

Computational Models: Class 3

1 Alphabets and Languages

Theory of Computation

Computational Models - Lecture 3 1

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

CPSC 421: Tutorial #1

Name: Student ID: Instructions:

Formal Languages, Automata and Models of Computation

Author: Vivek Kulkarni ( )

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

Notes for Comp 497 (454) Week 10

Lecture 4: More on Regexps, Non-Regular Languages

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

False. They are the same language.

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Exam 1 CSU 390 Theory of Computation Fall 2007

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2017

Chapter 2 The Pumping Lemma

CS500 Homework #2 Solutions

TAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages

3515ICT: Theory of Computation. Regular languages

Chapter 3. Regular grammars

I have read and understand all of the instructions below, and I will obey the University Code on Academic Integrity.

Fundamentele Informatica II

Computational Models - Lecture 3 1

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

TDDD65 Introduction to the Theory of Computation

MATH CSE20 Homework 5 Due Monday November 4

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

CSCE 551 Final Exam, Spring 2004 Answer Key

Notes for Comp 497 (Comp 454) Week 10 4/5/05

Your Name: UVa Id:

Languages, regular languages, finite automata

Nonregular Languages

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

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

A Universal Turing Machine

CS 154 Introduction to Automata and Complexity Theory

CSE 105 Homework 3 Due: Monday October 23, Instructions. should be on each page of the submission.

CS154 Final Examination

What we have done so far

CS154 Final Examination

Pushdown Automata. Reading: Chapter 6

acs-04: Regular Languages Regular Languages Andreas Karwath & Malte Helmert Informatik Theorie II (A) WS2009/10

Homework 5 - Solution

FS Properties and FSTs

Automata and Computability. Solutions to Exercises

Homework 4. Chapter 7. CS A Term 2009: Foundations of Computer Science. By Li Feng, Shweta Srivastava, and Carolina Ruiz

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

Automata Theory. CS F-10 Non-Context-Free Langauges Closure Properties of Context-Free Languages. David Galles

Solution. S ABc Ab c Bc Ac b A ABa Ba Aa a B Bbc bc.

Automata and Computability. Solutions to Exercises

Context-Free Grammars and Languages. Reading: Chapter 5

10. The GNFA method is used to show that

Theory Bridge Exam Example Questions

Computational Models - Lecture 3

Grade 6 Math Circles October 20/21, Formalism and Languages: Beyond Regular Languages

Homework 1/Solutions. Graded Exercises

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

2. Introduction to commutative rings (continued)

Intro to Algebra Today. We will learn names for the properties of real numbers. Homework Next Week. Due Tuesday 45-47/ 15-20, 32-35, 40-41, *28,29,38

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Intro to Theory of Computation

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

Transcription:

ECS120 Fall 2006 Discussion Notes October 25, 2006 Announcements The midterm is on Thursday, November 2nd during class. (That is next week!) Homework 4 Quick Hints Problem 1 Prove that the following languages are not regular (using the pumping lemma or closure properties). You can use the fact that L = {0 n 1 n n 0} is nonregular. There are two general methods you can use to solve each of these problems. Method 1: Pumping Lemma We know that if a language is regular, the pumping lemma holds. You can use this to try and prove that the given language is non-regular with the following steps: 1. Assume for the sake of contradiction that L is regular. 2. Since L is regular, there exists a p where for any string w L with length w p, we may divide w into w = xyz such that the conditions of the pumping lemma hold. 3. Choose a string w L where w p. 4. Show that this string can not be divided into w = xyz such that the pumping lemma conditions hold. 5. This is a contradiction of the pumping lemma, therefore L is not regular. Steps 3 and 4 are where it gets tricky. First, you need to choose the string w. Not all strings will work, so you may have to try a few strings before you get one that works. Second, you have to show that with this string, the pumping lemma does not hold. You want to show that it is impossible for all three conditions to hold for your given string. See the example for ways of doing this. 1

Method 2: Closure Properties We know that certain operations are closed under the regular languages. In problem 2, we prove that certain operation(s) are closed under non-regular langauges. We also have several languages that we have already proven to be non-regular. We can use this knowledge to our advantage and build a proof by contradiction. For example, suppose we want to prove that L 1 is non-regular. We could: 1. Assume for the sake of contradiction that L 1 is regular. 2. Suppose we know that L 1 L 2 = L 3. 3. Suppose we already know that L 2 is regular, and that L 3 is non-regular. 4. Since L 1 and L 2 are regular, and intersection is closed under the regular langauges, then L 3 must be regular. 5. However, we already know that L 3 is non-regular. This is a contradiction of the closure properties, therefore L 1 must be non-regular. The difficult part is finding languages L 1, L 2, and an operation that this will work for. Therefore the bulk of the work is in determining steps 2 and 3. *** These are just general examples of how you might want to approach these problems. Problem 2 Consider languages over a fixed alphabet Σ with Σ = 2. Prove or disprove the following. Remember to disprove a statement, you just need to provide a counterexample. Choose a L 1 and L 2 which disproves the statement. Use simple langauges that we have already proven to be regular or non-regular. Otherwise, use the general proof mechanisms that we have already used in this class to prove that the statement is true. Problem 3 (Sipser, Problem 1.54) Consider F = {a i b j c k i, j, k 0 and if i = 1 then j = k}. (a) Show that F is not regular, (b) that F acts like a regular language in the pumping lemma, and (c) explain why this does not contradict the pumping lemma. We already talked about different methods for showing that F is not regular. Use method 2 (closure properties) for part (a). 2

For part (b) do exactly what you are asked. Choose a pumping length of p. Show that for all w F such that w p the pumping lemma conditions hold. For example, suppose you choose p = 2. For all strings w such that w 2, you must show that each of the pumping lemma conditions hold. (This part may be tricky!) For part (c) explain why this does not contradict the pumping lemma. Ask yourself why choosing w is so important when proving a language is non-regular with the pumping lemma. What specifically does the pumping lemma tell us? What does it not tell us? Problem 4 (Sipser, Exercise 2.4) Do examples and check your work. If you haven t already noticed, 2.4 (a) and (d) are solved for you in the book. (That is what the A a. notation means!) You can find the solutions on page 132 (just before chapter 3). Examples Example 1 Let L 1 and L 2 be non-regular languages, and let L 1 L 2 = L 3. Is L 3 non-regular (i.e. is set difference closed under non-regular langauges)? No. Consider the case when L 1 and L 2 are equivalent, i.e. when L 1 = L 2. Then L 1 L 2 = L 1 L 1 =. Since is regular, set difference is not closed under non-regular languages. Example 2 What language is represented by the following grammar? S A B AB A aa ɛ B bb ɛ What are some example derivations? S A aa aaa aa S AB aab aaab aab aab This generates the language represented by the regular expression a b. 3

Example 3 (Sipser, Exercise 2.6a) Let L be the set of strings over the alphabet {a, b} with more a s than b s. Give a context-free grammar for L. Suppose for a moment that our grammar is as follows: S T at T at b bt a a ɛ However, string aaaa L. How would we derive this? We can t, therefore we need to add one more rule: Then we get the derivation: S T at T T T at b bt a a ɛ S T at T T at at at aaat aaaa Example 4 (Sipser, Example 1.75) Prove that L = {ss s {0, 1} } is not regular using the pumping lemma. Assume for the sake of contradiction that L is regular. Let w = 0 p 10 p 1. Since w L and w = 2p + 2 p, then by the pumping lemma we can split w into w = xyz such that: 1. xy i z L (for each i 0) 2. y > 0 3. xy p Lets figure out what possible values x, y, and z may take. Notice that xy p. The first p characters of our string are all 0s: } 00 {{ 0} 1 } 00 {{ 0} 1 p p This tells us that xy must be a string of 0s, looking similar to: } 00 {{ 0} 100 01 xy Also, y > 0. Therefore y must be at least one 0. However, xy i z L for each i 0. Therefore the string xz should be in L (for i = 0). This yields in a contradiction since xz L. 4

(The book pumps up and argues that xyyz L which works as well. This gives an example of pumping down.) Is this clear? There is no way to write xz as ss therefore xz L. Lets do a specific example to convince you. Let p = 2 giving us w = 001001. There are three ways we can split this string under conditions (2) and (3) of the pumping lemma: x y z xz (i) ɛ 0 01001 01001 (ii) ɛ 00 1001 1001 (iii) 0 0 1001 01001 Notice that (i) and (iii) are odd, and can t even be split into two equal length strings. Also, for (ii) string 10 01 so this does not belong in our language either. Therefore there is no way to split this string and satisfy the three conditions of the pumping lemma. This is a contradiction. Thus L must be non-regular. 5