More Properties of Regular Languages

Similar documents
Formal Languages, Automata and Models of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

The Pumping Lemma and Closure Properties

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

Non-regular languages

Properties of Regular Languages. Wen-Guey Tzeng Department of Computer Science National Chiao Tung University

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

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

TDDD65 Introduction to the Theory of Computation

Theory of Computation

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

Closure under the Regular Operations

CS 455/555: Finite automata

Finite Automata and Regular languages

Closure Properties of Context-Free Languages. Foundations of Computer Science Theory

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

Properties of Context-Free Languages. Closure Properties Decision Properties

More on Regular Languages and Non-Regular Languages

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

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

Properties of Regular Languages (2015/10/15)

CSE 105 THEORY OF COMPUTATION

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

CSE 105 THEORY OF COMPUTATION

Context-Free Languages (Pre Lecture)

V Honors Theory of Computation

Nondeterministic Finite Automata

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

Name: Student ID: Instructions:

Lecture 7 Properties of regular languages

Chapter 6. Properties of Regular Languages

Properties of Context-Free Languages

Computational Theory

Computational Models - Lecture 3 1

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

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

Theory of Computation (II) Yijia Chen Fudan University

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

Proving languages to be nonregular

Exam 1 CSU 390 Theory of Computation Fall 2007

Computational Models - Lecture 3

MA/CSSE 474 Theory of Computation

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

Computational Models: Class 3

CSE 105 Theory of Computation Professor Jeanne Ferrante

Ogden s Lemma for CFLs

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

CSE 105 THEORY OF COMPUTATION

Sri vidya college of engineering and technology

10. The GNFA method is used to show that

CSE 105 THEORY OF COMPUTATION

Regular Expressions and Language Properties

CSE 105 THEORY OF COMPUTATION

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Computer Sciences Department

Fooling Sets and. Lecture 5

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Finite Automata and Regular Languages

Languages. A language is a set of strings. String: A sequence of letters. Examples: cat, dog, house, Defined over an alphabet:

Automata: a short introduction

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

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

Uses of finite automata

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

What we have done so far

3515ICT: Theory of Computation. Regular languages

Regular Languages. Problem Characterize those Languages recognized by Finite Automata.

CS375 Midterm Exam Solution Set (Fall 2017)

Theory of Computation (Classroom Practice Booklet Solutions)

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

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.

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

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

Homework 5 - Solution

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

CS 154 Introduction to Automata and Complexity Theory

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

Any Wizard of Oz fans? Discrete Math Basics. Outline. Sets. Set Operations. Sets. Dorothy: How does one get to the Emerald City?

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)

Theory Bridge Exam Example Questions

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

NPDA, CFG equivalence

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Decidability (intro.)

FS Properties and FSTs

False. They are the same language.

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

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

Computability Theory

CPS 220 Theory of Computation REGULAR LANGUAGES

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

CPSC 421: Tutorial #1

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

CS 455/555: Mathematical preliminaries

Transcription:

More Properties of Regular anguages 1

We have proven Regular languages are closed under: Union Concatenation Star operation Reverse 2

Namely, for regular languages 1 and 2 : Union 1 2 Concatenation Star operation Reverse 1 2 1 R 1 Regular anguages 3

We will prove Regular languages are closed under: Complement Intersection 4

Namely, for regular languages 1 and 2 : Complement Intersection 1 1 2 Regular anguages 5

Complement Theorem: For regular language the complement is regular Proof: Take DFA that accepts and make nonfinal states final final states nonfinal Resulting DFA accepts 6

Example: a ( a* b) a,b b a, b q0 q1 q2 ( a * a * b( a b)( a b)*) a a,b b a, b q0 q1 q2 7

Intersection Theorem: For regular languages the intersection 1 1 2 and 2 is regular Proof: Apply DeMorgan s aw: 1 2 1 2 8

1, 2 regular 1, 2 regular 1 2 regular 1 2 regular 1 2 regular 9

Standard Representations of Regular anguages 10

Standard Representations of Regular anguages Regular anguages DFAs Regular Grammars NFAs Regular Expressions 11

When we say: We are given a Regular anguage We mean: anguage representation is in a standard We may assume a regular language can be represented as a DFA, an NFA, a regular expression, or a regular grammar, whatever we find convenient. 12

Elementary Questions about Regular anguages 13

Membership Question Question: Given regular language and string w how can we check if? w Answer: Take the DFA that accepts and check if w is accepted 14

DFA w w DFA w w 15

Question: Given regular language how can we check if is empty:? ( ) Answer: Take the DFA that accepts Check if there is a path from the initial state to a final state 16

DFA DFA 17

Question: Given regular language how can we check if is finite? Answer: Take the DFA that accepts Check if there is a walk with cycle from the initial state to a final state 18

DFA is infinite DFA is finite 19

Question: Given regular languages 1 and 2 how can we check if 1 2? Answer: Find if ( 2 1 2 ) ( 1 ) 20

( 2 1 2 ) ( 1 ) 1 2 and 1 2 1 2 2 2 1 1 1 2 2 1 1 2 21

( 2 1 2 ) ( 1 ) 1 2 or 1 2 1 2 2 1 1 2 2 1 1 2 22

Non-regular languages 23

Non-regular languages { a n b n : n 0} { ww R : w { a, b}*} Regular languages a *b b* c a b c( a b)* etc... 24

How can we prove that a language is not regular? Prove that there is no DFA that accepts Problem: this is not easy to prove Solution: the Pumping emma!!! 25

The Pigeonhole Principle 26

4 pigeons 3 pigeonholes 27

A pigeonhole must contain at least two pigeons 28

n pigeons... m pigeonholes n m... 29

The Pigeonhole Principle n m pigeons pigeonholes n m There is a pigeonhole with at least 2 pigeons... 30

The Pigeonhole Principle and DFAs 31

DFA with 4 states b b b a q1 q b 2 q3 a b a q 4 32

In walks of strings: a aa aab no state is repeated b b b a a q1 q2 q3 b q 4 a a 33

In walks of strings: aabb bbaa abbabb a state is repeated abbbabbabb... b b b a a q1 q2 q3 b q 4 a a 34

In walks of strings: aabb bbaa abbabb a state is repeated abbbabbabb... b b b a a q1 q2 q3 b q 4 a a 35

w w 4 If string has length : Then the transitions of string Thus, a state must be repeated w are more than the states of the DFA b b b a a q1 q2 q3 b q 4 a a 36

In general, for any DFA: String has length number of states w A state q must be repeated in the walk of w walk of w... q... Repeated state 37

w In other words for a string : a transitions are pigeons q states are pigeonholes walk of w... q... Repeated state 38

The Pumping emma 39

Take an infinite regular language DFA that accepts m states 40

Take string w with w There is a walk with label w :... walk w 41

If string w has length w m number of states of DFA then, from the pigeonhole principle: a state q is repeated in the walk w... q... walk w 42

et q be the first state repeated... q... walk w 43

Write w x y z y... q... x z 44

Observations: length x y m number of states length y 1 of DFA y... q... x z 45

Observation: The string x z is accepted y... q... x z 46

Observation: The string x y y z is accepted y... q... x z 47

Observation: The string x y y y z is accepted y... q... x z 48

In General: The string x y i z is accepted i 0,1, 2,... y... q... x z 49

In General: x y i z i 0,1, 2,... The original language y... q... x z 50

In other words, we described: The Pumping emma!!! 51

The Pumping emma: Given a infinite regular language there exists an integer m for any string w with length w m we can write w x y z with x y m y 1 and such that: x y i z i 0,1, 2,... 52

Applications of the Pumping emma 53

Theorem: The language { a b : n 0} n n is not regular Proof: Use the Pumping emma 54

n n { a b : n 0} Assume for contradiction that is a regular language Since is infinite we can apply the Pumping emma 55

n n { a b : n 0} et m be the integer in the Pumping emma Pick a string w such that: w length w m We pick m b m w a 56

Write: a m b m x y z From the Pumping emma it must be that length x y m, y 1 m m xyz a m b m a... aa... aa... ab... b x y z Thus: y a k, k 1 57

x y z m b m a y a k, k 1 From the Pumping emma: x y i z i 0,1, 2,... Thus: x y 2 z 58

m m x y z a b y a, k 1 k From the Pumping emma: x y 2 z m k m xy 2 z a... aa... aa... aa... ab... b x y y z Thus: a m k b m 59

a m k b m k 1 BUT: n n { a b : n 0} a m k b m CONTRADICTION!!! 60

Therefore: Our assumption that is a regular language is not true Conclusion: is not a regular language 61

Non-regular language { a b : n 0} n n Regular languages 62