TDDD65 Introduction to the Theory of Computation

Size: px
Start display at page:

Download "TDDD65 Introduction to the Theory of Computation"

Transcription

1 TDDD65 Introduction to the Theory of Computation Lecture 2 Gustav Nordh, IDA gustav.nordh@liu.se

2 Outline - Lecture 2 Closure properties of regular languages Regular expressions Equivalence of regular expressions and finite automata Pumping lemma for regular languages

3 Closure properties of regular languages The natural numbers N = {0, 1, 2, 3,...} are closed under multiplication in the sense that for any natural numbers x and y, x y is again a natural number The natural numbers are not closed under subtraction (3 5 = 2 which is not a natural number) Definition We say that a class of languagesc is closed under an operation op if applying op to any languages from C results in a language in C

4 Closure properties of regular languages Understanding under which operations a class of languagesc is closed is important!

5 Closure properties of regular languages Theorem The class of regular languages is closed under union (if L 1 and L 2 are regular languages, then so is L 1 L 2 ) Proof.

6 Closure properties of regular languages Theorem The class of regular languages is closed under concatenation (if L 1 and L 2 are regular languages, then so is L 1 L 2 ) Proof.

7 Closure properties of regular languages Theorem The class of regular languages is closed under star (if L 1 is a regular language, then so is L 1 ) Proof.

8 Regular expressions

9 Regular expressions

10 Regular expressions

11 Definition of regular expressions Definition L(R) denotes the language described by the regular expression R. R is a regular expression if R is 1 a for a Σ, L(a) = {a} 2, L() = {} 3, L( ) = 4 R 1 + R 2 where R 1 and R 2 are regular expressions, L(R 1 + R 2 ) = L(R 1 ) L(R 2 ) 5 R 1 R 2 where R 1 and R 2 are regular expressions, L(R 1 R 2 ) = L(R 1 )L(R 2 ) 6 R 1 where R 1 is a regular expression, L(R 1 ) = L(R 1) has higher precedence than concatenation and +, concatenation has higher precedence than +

12 Examples of regular expressions Example (0+1) 0 binary strings ending with 0 (0+1) 00(0+1) binary strings with at least two consecutive 0 s ( ) 1234( )

13 Equivalence with finite automata Theorem A language is regular if and only if some regular expression describes it

14 Equivalence with finite automata If a language is described by a regular expression then it is recognized by a NFA

15 Equivalence with finite automata If a language is described by a regular expression then it is recognized by a NFA Proof. R = a for a Σ, L(R) = {a} R =, L(R) = {} a R =, L(R) =

16 Equivalence with finite automata If a language is described by a regular expression then it is recognized by a NFA Proof. R = R 1 + R 2, L(R) = L(R 1 ) L(R 2 )

17 Equivalence with finite automata If a language is described by a regular expression then it is recognized by a NFA Proof. R = R 1 R 2, L(R) = L(R 1 )L(R 2 )

18 Equivalence with finite automata If a language is described by a regular expression then it is recognized by a NFA Proof. R = R 1, L(R) = L(R 1)

19 Equivalence with finite automata: Example Example (0+1) to NFA (0+1) 0 1

20 Equivalence with finite automata RegExp Closure Properties NFA Subset Construction DFA

21 Equivalence with finite automata RegExp Closure Properties GNFA Construction NFA Subset Construction DFA

22 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Idea: Use a generalized NFA (GNFA) where the transition arrows can be labeled by regular expressions (aa) a ab q 1 q 2 ab+ba

23 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Idea: Use a generalized NFA (GNFA) where the transition arrows can be labeled by regular expressions Given a DFA Add a new start state with an transition to the old start state Add a new accept state with transitions from all old accept states Replace transitions of the form a, b, c by a+b + c

24 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Add a new start state with an transition to the old start state Add a new accept state with transitions from all old accept states Replace transitions of the form a, b, c by a+b + c q 1 q 2 0

25 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Add a new start state with an transition to the old start state Add a new accept state with transitions from all old accept states Replace transitions of the form a, b, c by a+b + c 0 1 q s 1 q 1 q 2 q F 0

26 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Add a new start state with an transition to the old start state Add a new accept state with transitions from all old accept states Replace transitions of the form a, b, c by a+b + c Eliminate a state different from the start and accept state (reducing the number of states by 1)

27 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Eliminate a state different from the start and accept state (reducing the number of states by 1) R 2 R 1 R 3 q 1 q e q 2 R 4

28 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Eliminate a state different from the start and accept state (reducing the number of states by 1) R 2 R 1 R 3 q 1 q e q 2 R 4 q 1 R 1 R 2 R 3 + R 4 q 2

29 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Eliminate a state different from the start and accept state (reducing the number of states by 1) 0 1 q s 1 q 1 q 2 q F 0

30 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Eliminate q q s 1 q 1 q 2 q F 0

31 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Eliminate q q s 1 q 1 q 2 q F 0 Using the rule R 1 R 2 R 3 + R 4 the new transition from q 1 to q F is labeled 11 +

32 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Eliminate q q s 1 q 1 q 2 q F 0 Using the rule R 1 R 2 R 3 + R 4 the new transition from q 1 to q F is labeled 11 + Using the rule R 1 R 2 R 3 + R 4 the new transition from q 1 to q 1 is labeled

33 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Eliminate q q s 1 q 1 q 2 q F q s q q F

34 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Eliminate q q s q q F

35 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Eliminate q q s q q F Using the rule R 1 R 2 R 3 + R 4 the new transition from q s to q F is labeled (11 0+0) (11 + )+

36 Equivalence with finite automata If a language is recognized by a DFA then it is described by a regular expression Eliminate q q s q q F q s (11 0+0) (11 + )+ q F

37 Equivalence with finite automata RegExp Closure Properties GNFA Construction NFA Subset Construction DFA

38 Nonregular languages

39 Nonregular languages Example L = {a n b n n 0} is not a regular language Why?

40 Nonregular languages Example L = {a n b n n 0} is not a regular language Why? Imagine a DFA that recognize L When reading a string the DFA needs to keep track of the number of a s seen so far so that it can check that the same number of b s follow The number of a s is unbounded so the DFA needs to remember an unbounded number This is not possible since the memory of the DFA is bounded (finite number of states)

41 Nonregular languages, pumping Given a sufficiently long string s in a regular language L Then the DFA that recognizes L will be in the same state q t several times s = s 1 s j 1 s j s k 1 s k s n L }{{}}{{}}{{} q t q t q accept

42 Nonregular languages, pumping Given a sufficiently long string s in a regular language L Then the DFA that recognizes L will be in the same state q t several times So for any i 0 s = s 1 s j 1 s j s k 1 s k s n L }{{}}{{}}{{} q t q t q accept s = s 1 s j 1 (s j s k 1 ) i s k s n L }{{}}{{}}{{} q t q t q accept

43 The Pumping for Regular Languages If L is a regular language, then there exists a positive integer p (the pumping length) such that every string s L, s p, can be partitioned into three pieces, s = xyz, such that the following conditions hold: y > 0, xy p, and for each i 0, xy i z L

44 Proof of the Pumping If L is a regular language, then there exists a positive integer p (the pumping length) such that every string s L, s p, can be partitioned into three pieces, s = xyz, such that the following conditions hold: y > 0, xy p, and for each i 0, xy i z L Proof. If L is regular, let M be a DFA recognizing L. Let p be the number of states of M and let s = s 1 s 2 s n L with n p. Let r 1 r n+1 be the sequence of states that M enters while reading s. Among the first p+1 states in this sequence, two must be the same. Let r j = r k (j < k) be such two. Let x = s 1 s j 1, y = s j s k 1, and z = s k s n.

45 Proof of the Pumping If L is a regular language, then there exists a positive integer p (the pumping length) such that every string s L, s p, can be partitioned into three pieces, s = xyz, such that the following conditions hold: y > 0, xy p, and for each i 0, xy i z L Proof. If L is regular, let M be a DFA recognizing L. Let p be the number of states of M and let s = s 1 s 2 s n L with n p. Let r 1 r n+1 be the sequence of states that M enters while reading s. Among the first p+1 states in this sequence, two must be the same. Let r j = r k (j < k) be such two. Let x = s 1 s j 1, y = s j s k 1, and z = s k s n. y = s j s k 1 x = s 1 s j 1 z = sk s n r 1 r j = r k r n+1

46 Proof of the Pumping If L is a regular language, then there exists a positive integer p (the pumping length) such that every string s L, s p, can be partitioned into three pieces, s = xyz, such that the following conditions hold: y > 0, xy p, and for each i 0, xy i z L Proof. If L is regular, let M be a DFA recognizing L. Let p be the number of states of M and let s = s 1 s 2 s n L with n p. Let r 1 r n+1 be the sequence of states that M enters while reading s. Among the first p+1 states in this sequence, two must be the same. Let r j = r k (j < k) be such two. Let x = s 1 s j 1, y = s j s k 1, and z = s k s n. y i, i 0 x = s 1 s j 1 z = sk s n r 1 r j = r k r n+1

47 Proof of the Pumping If L is a regular language, then there exists a positive integer p (the pumping length) such that every string s L, s p, can be partitioned into three pieces, s = xyz, such that the following conditions hold: y > 0, xy p, and for each i 0, xy i z L Proof. If L is regular, let M be a DFA recognizing L. Let p be the number of states of M and let s = s 1 s 2 s n L with n p. Let r 1 r n+1 be the sequence of states that M enters while reading s. Among the first p+1 states in this sequence, two must be the same. Let r j = r k (j < k) be such two. Let x = s 1 s j 1, y = s j s k 1, and z = s k s n. We have xy i z L for each i 0.

48 Proof of the Pumping If L is a regular language, then there exists a positive integer p (the pumping length) such that every string s L, s p, can be partitioned into three pieces, s = xyz, such that the following conditions hold: y > 0, xy p, and for each i 0, xy i z L Proof. If L is regular, let M be a DFA recognizing L. Let p be the number of states of M and let s = s 1 s 2 s n L with n p. Let r 1 r n+1 be the sequence of states that M enters while reading s. Among the first p+1 states in this sequence, two must be the same. Let r j = r k (j < k) be such two. Let x = s 1 s j 1, y = s j s k 1, and z = s k s n. We have y > 0 (since j k). We have xy = s 1 s k 1 p since r k occurs among the first p + 1 places in the sequence of states (so k p+1).

49 Strategy for showing that a language L is not regular 1 Assume that L is regular (with the aim of reaching a contradiction). 2 Choose a string s L, such that s p where p is the pumping length given by the Pumping. The Pumping then says that s can be partitioned into three pieces s = xyz where y > 0 and xy p, such that xy i z L for all i 0. 3 Show that for ALL POSSIBLE partitions of s = xyz satisfying y > 0 and xy p there exists an i such that xy i z / L. If we succeed to show this, then we have a contradiction with the Pumping and our assumption that L is regular is wrong.

50 The standard example Example L = {a n b n n 0} is not regular. Proof. 1 Assume that L is regular 2 Choose s = a p b p where p is the pumping length given by the Pumping. s L and s p, so the Pumping says that s can be partitioned into three pieces s = xyz where y > 0 and xy p, such that xy i z L for all i 0. 3 s = a p b p = xyz where y > 0 and xy p. For all such partitions of s, y is a string of a s of length at least 1. Choose i = 2, xy 2 z contains more a s than b s, thus, xy 2 z / L. This contradicts the Pumping, hence, our assumption that L is regular is wrong.

51 Regular languages: Summary Regular languages are the languages recognized by DFAs For every NFA there is an equivalent DFA The subset construction A language can be described by a regular expression if and only if it can be recognized by a DFA GNFA construction, closure properties There are simple non-regular languages Pumping lemma

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THE PUMPING LEMMA FOR REGULAR LANGUAGES and REGULAR EXPRESSIONS TUESDAY Jan 21 WHICH OF THESE ARE REGULAR? B = {0 n 1 n n 0} C = { w w has equal number

More information

CS 154, Lecture 3: DFA NFA, Regular Expressions

CS 154, Lecture 3: DFA NFA, Regular Expressions CS 154, Lecture 3: DFA NFA, Regular Expressions Homework 1 is coming out Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and

More information

Theory of Computation (II) Yijia Chen Fudan University

Theory of Computation (II) Yijia Chen Fudan University Theory of Computation (II) Yijia Chen Fudan University Review A language L is a subset of strings over an alphabet Σ. Our goal is to identify those languages that can be recognized by one of the simplest

More information

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

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages CS 154 Finite Automata vs Regular Expressions, Non-Regular Languages Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and guessing

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Section 1.4 Explain the limits of the class of regular languages Justify why the

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION FORMAL LANGUAGES, AUTOMATA AND COMPUTATION IDENTIFYING NONREGULAR LANGUAGES PUMPING LEMMA Carnegie Mellon University in Qatar (CARNEGIE MELLON UNIVERSITY IN QATAR) SLIDES FOR 15-453 LECTURE 5 SPRING 2011

More information

September 11, Second Part of Regular Expressions Equivalence with Finite Aut

September 11, Second Part of Regular Expressions Equivalence with Finite Aut Second Part of Regular Expressions Equivalence with Finite Automata September 11, 2013 Lemma 1.60 If a language is regular then it is specified by a regular expression Proof idea: For a given regular language

More information

Computer Sciences Department

Computer Sciences Department 1 Reference Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER 3 objectives Finite automaton Infinite automaton Formal definition State diagram Regular and Non-regular

More information

Outline. CS21 Decidability and Tractability. Regular expressions and FA. Regular expressions and FA. Regular expressions and FA

Outline. CS21 Decidability and Tractability. Regular expressions and FA. Regular expressions and FA. Regular expressions and FA Outline CS21 Decidability and Tractability Lecture 4 January 14, 2019 FA and Regular Exressions Non-regular languages: Puming Lemma Pushdown Automata Context-Free Grammars and Languages January 14, 2019

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Today's learning goals Sipser Ch 1.4 Explain the limits of the class of regular languages Justify why the Pumping

More information

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

Unit 6. Non Regular Languages The Pumping Lemma. Reading: Sipser, chapter 1 Unit 6 Non Regular Languages The Pumping Lemma Reading: Sipser, chapter 1 1 Are all languages regular? No! Most of the languages are not regular! Why? A finite automaton has limited memory. How can we

More information

Formal Languages, Automata and Models of Computation

Formal Languages, Automata and Models of Computation CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2011 1 Content - More Properties of Regular Languages (RL)

More information

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

CS5371 Theory of Computation. Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression) CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression) Objectives Prove the Pumping Lemma, and use it to show that there are non-regular languages

More information

Finite Automata and Regular languages

Finite Automata and Regular languages Finite Automata and Regular languages Huan Long Shanghai Jiao Tong University Acknowledgements Part of the slides comes from a similar course in Fudan University given by Prof. Yijia Chen. http://basics.sjtu.edu.cn/

More information

Lecture 4: More on Regexps, Non-Regular Languages

Lecture 4: More on Regexps, Non-Regular Languages 6.045 Lecture 4: More on Regexps, Non-Regular Languages 6.045 Announcements: - Pset 1 is on piazza (as of last night) - If you don t have piazza access but are registered for 6.045, send email to TAs with

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION 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

More information

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

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) Definition 1 (Alphabet) A alphabet is a finite set of objects called symbols. Definition 2 (String)

More information

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

Incorrect reasoning about RL. Equivalence of NFA, DFA. Epsilon Closure. Proving equivalence. One direction is easy: Incorrect reasoning about RL Since L 1 = {w w=a n, n N}, L 2 = {w w = b n, n N} are regular, therefore L 1 L 2 = {w w=a n b n, n N} is regular If L 1 is a regular language, then L 2 = {w R w L 1 } is regular,

More information

More Properties of Regular Languages

More Properties of Regular Languages 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

More information

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

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is Abstraction of Problems Data: abstracted as a word in a given alphabet. Σ: alphabet, a finite, non-empty set of symbols. Σ : all the words of finite length built up using Σ: Conditions: abstracted as a

More information

UNIT-III REGULAR LANGUAGES

UNIT-III REGULAR LANGUAGES Syllabus R9 Regulation REGULAR EXPRESSIONS UNIT-III REGULAR LANGUAGES Regular expressions are useful for representing certain sets of strings in an algebraic fashion. In arithmetic we can use the operations

More information

1.3 Regular Expressions

1.3 Regular Expressions 51 1.3 Regular Expressions These have an important role in descriing patterns in searching for strings in many applications (e.g. awk, grep, Perl,...) All regular expressions of alphaet are 1.Øand are

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation 1/26/2016 LECTURE 5 Last time: Closure properties. Equivalence of NFAs, DFAs and regular expressions Today: Conversion from NFAs to regular expressions Proving that a language

More information

Computational Theory

Computational Theory Computational Theory Finite Automata and Regular Languages Curtis Larsen Dixie State University Computing and Design Fall 2018 Adapted from notes by Russ Ross Adapted from notes by Harry Lewis Curtis Larsen

More information

Proving languages to be nonregular

Proving languages to be nonregular Proving languages to be nonregular We already know that there exist languages A Σ that are nonregular, for any choice of an alphabet Σ. This is because there are uncountably many languages in total and

More information

Theory of Computation (I) Yijia Chen Fudan University

Theory of Computation (I) Yijia Chen Fudan University Theory of Computation (I) Yijia Chen Fudan University Instructor Yijia Chen Homepage: http://basics.sjtu.edu.cn/~chen Email: yijiachen@fudan.edu.cn Textbook Introduction to the Theory of Computation Michael

More information

Chapter 2 The Pumping Lemma

Chapter 2 The Pumping Lemma Chapter 2 The Pumping Lemma Fourth Academic Year/ Elective Course-General Electrical Engineering Department College of Engineering University of Salahaddin April 2015 Nonregular Languages Consider the

More information

What we have done so far

What we have done so far What we have done so far DFAs and regular languages NFAs and their equivalence to DFAs Regular expressions. Regular expressions capture exactly regular languages: Construct a NFA from a regular expression.

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

CS 154. Finite Automata, Nondeterminism, Regular Expressions

CS 154. Finite Automata, Nondeterminism, Regular Expressions CS 54 Finite Automata, Nondeterminism, Regular Expressions Read string left to right The DFA accepts a string if the process ends in a double circle A DFA is a 5-tuple M = (Q, Σ, δ, q, F) Q is the set

More information

Closure under the Regular Operations

Closure under the Regular Operations September 7, 2013 Application of NFA Now we use the NFA to show that collection of regular languages is closed under regular operations union, concatenation, and star Earlier we have shown this closure

More information

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

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties Recall a closure property is a statement

More information

Applied Computer Science II Chapter 1 : Regular Languages

Applied Computer Science II Chapter 1 : Regular Languages Applied Computer Science II Chapter 1 : Regular Languages Prof. Dr. Luc De Raedt Institut für Informatik Albert-Ludwigs Universität Freiburg Germany Overview Deterministic finite automata Regular languages

More information

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

acs-04: Regular Languages Regular Languages Andreas Karwath & Malte Helmert Informatik Theorie II (A) WS2009/10 Regular Languages Andreas Karwath & Malte Helmert 1 Overview Deterministic finite automata Regular languages Nondeterministic finite automata Closure operations Regular expressions Nonregular languages

More information

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

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata CISC 4090: Theory of Computation Chapter Regular Languages Xiaolan Zhang, adapted from slides by Prof. Werschulz Section.: Finite Automata Fordham University Department of Computer and Information Sciences

More information

Theory of Languages and Automata

Theory of Languages and Automata Theory of Languages and Automata Chapter 1- Regular Languages & Finite State Automaton Sharif University of Technology Finite State Automaton We begin with the simplest model of Computation, called finite

More information

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

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages CSci 311, Models of Computation Chapter 4 Properties of Regular Languages H. Conrad Cunningham 29 December 2015 Contents Introduction................................. 1 4.1 Closure Properties of Regular

More information

Exam 1 CSU 390 Theory of Computation Fall 2007

Exam 1 CSU 390 Theory of Computation Fall 2007 Exam 1 CSU 390 Theory of Computation Fall 2007 Solutions Problem 1 [10 points] Construct a state transition diagram for a DFA that recognizes the following language over the alphabet Σ = {a, b}: L 1 =

More information

Computational Models - Lecture 3

Computational Models - Lecture 3 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover

More information

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

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 BIJU PATNAIK UNIVERSITY OF TECHNOLOGY, ODISHA Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 Prepared by, Dr. Subhendu Kumar Rath, BPUT, Odisha. UNIT 2 Structure NON-DETERMINISTIC FINITE AUTOMATA

More information

The Pumping Lemma and Closure Properties

The Pumping Lemma and Closure Properties The Pumping Lemma and Closure Properties Mridul Aanjaneya Stanford University July 5, 2012 Mridul Aanjaneya Automata Theory 1/ 27 Tentative Schedule HW #1: Out (07/03), Due (07/11) HW #2: Out (07/10),

More information

Name: Student ID: Instructions:

Name: Student ID: Instructions: Instructions: Name: CSE 322 Autumn 2001: Midterm Exam (closed book, closed notes except for 1-page summary) Total: 100 points, 5 questions, 20 points each. Time: 50 minutes 1. Write your name and student

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 2 January 5, 2018 January 5, 2018 CS21 Lecture 2 1 Outline Finite Automata Nondeterministic Finite Automata Closure under regular operations NFA, FA equivalence

More information

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

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS Automata Theory Lecture on Discussion Course of CS2 This Lecture is about Mathematical Models of Computation. Why Should I Care? - Ways of thinking. - Theory can drive practice. - Don t be an Instrumentalist.

More information

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class CSE 105 THEORY OF COMPUTATION Spring 2018 review class Today's learning goals Summarize key concepts, ideas, themes from CSE 105. Approach your final exam studying with confidence. Identify areas to focus

More information

Automata: a short introduction

Automata: a short introduction ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible

More information

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

Properties of Regular Languages. BBM Automata Theory and Formal Languages 1 Properties of Regular Languages BBM 401 - Automata Theory and Formal Languages 1 Properties of Regular Languages Pumping Lemma: Every regular language satisfies the pumping lemma. A non-regular language

More information

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

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

More information

Properties of Regular Languages (2015/10/15)

Properties of Regular Languages (2015/10/15) Chapter 4 Properties of Regular Languages (25//5) Pasbag, Turkey Outline 4. Proving Languages Not to e Regular 4.2 Closure Properties of Regular Languages 4.3 Decision Properties of Regular Languages 4.4

More information

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs CSE : Foundations of Computing Lecture : Finite State Machine Minimization & NFAs State Minimization Many different FSMs (DFAs) for the same problem Take a given FSM and try to reduce its state set by

More information

COMP4141 Theory of Computation

COMP4141 Theory of Computation COMP4141 Theory of Computation Lecture 4 Regular Languages cont. Ron van der Meyden CSE, UNSW Revision: 2013/03/14 (Credits: David Dill, Thomas Wilke, Kai Engelhardt, Peter Höfner, Rob van Glabbeek) Regular

More information

10. The GNFA method is used to show that

10. The GNFA method is used to show that CSE 355 Midterm Examination 27 February 27 Last Name Sample ASU ID First Name(s) Ima Exam # Sample Regrading of Midterms If you believe that your grade has not been recorded correctly, return the entire

More information

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

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010 University of Virginia - cs3102: Theory of Computation Spring 2010 PS2 - Comments Average: 77.4 (full credit for each question is 100 points) Distribution (of 54 submissions): 90, 12; 80 89, 11; 70-79,

More information

CS 455/555: Finite automata

CS 455/555: Finite automata CS 455/555: Finite automata Stefan D. Bruda Winter 2019 AUTOMATA (FINITE OR NOT) Generally any automaton Has a finite-state control Scans the input one symbol at a time Takes an action based on the currently

More information

Context-Free Languages (Pre Lecture)

Context-Free Languages (Pre Lecture) Context-Free Languages (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Context-Free Languages (Pre Lecture) Fall 2017 1 / 34 Outline Pumping Lemma

More information

CSCE 551 Final Exam, Spring 2004 Answer Key

CSCE 551 Final Exam, Spring 2004 Answer Key CSCE 551 Final Exam, Spring 2004 Answer Key 1. (10 points) Using any method you like (including intuition), give the unique minimal DFA equivalent to the following NFA: 0 1 2 0 5 1 3 4 If your answer is

More information

Examples of Regular Expressions. Finite Automata vs. Regular Expressions. Example of Using flex. Application

Examples of Regular Expressions. Finite Automata vs. Regular Expressions. Example of Using flex. Application Examples of Regular Expressions 1. 0 10, L(0 10 ) = {w w contains exactly a single 1} 2. Σ 1Σ, L(Σ 1Σ ) = {w w contains at least one 1} 3. Σ 001Σ, L(Σ 001Σ ) = {w w contains the string 001 as a substring}

More information

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

Sample Midterm. Understanding the questions is part of the exam; you are not allowed to ask questions during the exam. Sample Midterm Name: This exam consists of five questions. Each question is worth 10 points. The exam is worth 40 points. Your exam score is the sum of your four highest question scores. Calculators, cell

More information

CSE 105 Theory of Computation Professor Jeanne Ferrante

CSE 105 Theory of Computation   Professor Jeanne Ferrante CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Announcement & Reminders HW 2: Grades not available yet, will be soon Solutions posted, read even if you did well

More information

3515ICT: Theory of Computation. Regular languages

3515ICT: Theory of Computation. Regular languages 3515ICT: Theory of Computation Regular languages Notation and concepts concerning alphabets, strings and languages, and identification of languages with problems (H, 1.5). Regular expressions (H, 3.1,

More information

Introduction to Languages and Computation

Introduction to Languages and Computation Introduction to Languages and Computation George Voutsadakis 1 1 Mathematics and Computer Science Lake Superior State University LSSU Math 400 George Voutsadakis (LSSU) Languages and Computation July 2014

More information

Uses of finite automata

Uses of finite automata Chapter 2 :Finite Automata 2.1 Finite Automata Automata are computational devices to solve language recognition problems. Language recognition problem is to determine whether a word belongs to a language.

More information

Computational Models: Class 3

Computational Models: Class 3 Computational Models: Class 3 Benny Chor School of Computer Science Tel Aviv University November 2, 2015 Based on slides by Maurice Herlihy, Brown University, and modifications by Iftach Haitner and Yishay

More information

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

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism, CS 54, Lecture 2: Finite Automata, Closure Properties Nondeterminism, Why so Many Models? Streaming Algorithms 0 42 Deterministic Finite Automata Anatomy of Deterministic Finite Automata transition: for

More information

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2 5-25 Great Theoretical Ideas in Computer Science Lecture 4: Deterministic Finite Automaton (DFA), Part 2 January 26th, 27 Formal definition: DFA A deterministic finite automaton (DFA) M =(Q,,,q,F) M is

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 3 January 9, 2017 January 9, 2017 CS21 Lecture 3 1 Outline NFA, FA equivalence Regular Expressions FA and Regular Expressions January 9, 2017 CS21 Lecture 3 2

More information

COM364 Automata Theory Lecture Note 2 - Nondeterminism

COM364 Automata Theory Lecture Note 2 - Nondeterminism COM364 Automata Theory Lecture Note 2 - Nondeterminism Kurtuluş Küllü March 2018 The FA we saw until now were deterministic FA (DFA) in the sense that for each state and input symbol there was exactly

More information

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

Before we show how languages can be proven not regular, first, how would we show a language is regular? CS35 Proving Languages not to be Regular Before we show how languages can be proven not regular, first, how would we show a language is regular? Although regular languages and automata are quite powerful

More information

V Honors Theory of Computation

V Honors Theory of Computation V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Today's learning goals Summarize key concepts, ideas, themes from CSE 105. Approach your final exam studying with

More information

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

CS 121, Section 2. Week of September 16, 2013 CS 121, Section 2 Week of September 16, 2013 1 Concept Review 1.1 Overview In the past weeks, we have examined the finite automaton, a simple computational model with limited memory. We proved that DFAs,

More information

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

Please give details of your calculation. A direct answer without explanation is not counted. Please give details of your calculation. A direct answer without explanation is not counted. Your answers must be in English. Please carefully read problem statements. During the exam you are not allowed

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) - Spring L. Blum

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) - Spring L. Blum 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THE PUMPING LEMMA FOR REGULAR LANGUAGES nd REGULAR EXPRESSIONS TUESDAY Jn 21 WHICH OF THESE ARE REGULAR? B = {0 n 1 n n 0} C = { w w hs equl numer of

More information

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Spring 27 Alexis Maciel Department of Computer Science Clarkson University Copyright c 27 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

More information

Lecture 3: Nondeterministic Finite Automata

Lecture 3: Nondeterministic Finite Automata Lecture 3: Nondeterministic Finite Automata September 5, 206 CS 00 Theory of Computation As a recap of last lecture, recall that a deterministic finite automaton (DFA) consists of (Q, Σ, δ, q 0, F ) where

More information

Finite Automata and Regular Languages

Finite Automata and Regular Languages Finite Automata and Regular Languages Topics to be covered in Chapters 1-4 include: deterministic vs. nondeterministic FA, regular expressions, one-way vs. two-way FA, minimization, pumping lemma for regular

More information

CS 133 : Automata Theory and Computability

CS 133 : Automata Theory and Computability CS 133 : Automata Theory and Computability Lecture Slides 1 Regular Languages and Finite Automata Nestine Hope S. Hernandez Algorithms and Complexity Laboratory Department of Computer Science University

More information

Johns Hopkins Math Tournament Proof Round: Automata

Johns Hopkins Math Tournament Proof Round: Automata Johns Hopkins Math Tournament 2018 Proof Round: Automata February 9, 2019 Problem Points Score 1 10 2 5 3 10 4 20 5 20 6 15 7 20 Total 100 Instructions The exam is worth 100 points; each part s point value

More information

Lecture 17: Language Recognition

Lecture 17: Language Recognition Lecture 17: Language Recognition Finite State Automata Deterministic and Non-Deterministic Finite Automata Regular Expressions Push-Down Automata Turing Machines Modeling Computation When attempting to

More information

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Fall 28 Alexis Maciel Department of Computer Science Clarkson University Copyright c 28 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

More information

Automata and Formal Languages - CM0081 Finite Automata and Regular Expressions

Automata and Formal Languages - CM0081 Finite Automata and Regular Expressions Automata and Formal Languages - CM0081 Finite Automata and Regular Expressions Andrés Sicard-Ramírez Universidad EAFIT Semester 2018-2 Introduction Equivalences DFA NFA -NFA RE Finite Automata and Regular

More information

Regular languages, regular expressions, & finite automata (intro) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/

Regular languages, regular expressions, & finite automata (intro) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/ Regular languages, regular expressions, & finite automata (intro) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/ 1 L = {hello, bonjour, konnichiwa, } Σ = {a, b, c,, y, z}!2 Σ = {a, b, c,, y, z} Σ*

More information

Introduction: Computer Science is a cluster of related scientific and engineering disciplines concerned with the study and application of computations. These disciplines range from the pure and basic scientific

More information

CS375 Midterm Exam Solution Set (Fall 2017)

CS375 Midterm Exam Solution Set (Fall 2017) CS375 Midterm Exam Solution Set (Fall 2017) Closed book & closed notes October 17, 2017 Name sample 1. (10 points) (a) Put in the following blank the number of strings of length 5 over A={a, b, c} that

More information

Computational Models Lecture 2 1

Computational Models Lecture 2 1 Computational Models Lecture 2 1 Handout Mode Iftach Haitner. Tel Aviv University. October 30, 2017 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Computational Models Lecture 2 1

Computational Models Lecture 2 1 Computational Models Lecture 2 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. March 16/18, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Regular Expressions. Definitions Equivalence to Finite Automata

Regular Expressions. Definitions Equivalence to Finite Automata Regular Expressions Definitions Equivalence to Finite Automata 1 RE s: Introduction Regular expressions are an algebraic way to describe languages. They describe exactly the regular languages. If E is

More information

Regular Expressions (Pre Lecture)

Regular Expressions (Pre Lecture) Regular Expressions (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall 2017 1 / 39 Regular Expressions Outline

More information

Computational Models - Lecture 3 1

Computational Models - Lecture 3 1 Computational Models - Lecture 3 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. March 13/18, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata. CMSC 330: Organization of Programming Languages Last Lecture Languages Sets of strings Operations on languages Finite Automata Regular expressions Constants Operators Precedence CMSC 330 2 Clarifications

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Not A DFA Does not have exactly one transition from every state on every symbol: Two transitions from q 0 on a No transition from q 1 (on either a or b) Though not a DFA,

More information

2017/08/31 Chapter 1.2 & 1.3 in Sipser Ø Announcement:

2017/08/31 Chapter 1.2 & 1.3 in Sipser Ø Announcement: Regular Expressions Human-aware and Robo.cs Operations 2017/08/31 Chapter 1.2 & 1.3 in Sipser Ø Announcement: q q q q Many thanks to students who have responded so far! There is still time to respond to

More information

Theory of Computation

Theory of Computation Fall 2002 (YEN) Theory of Computation Midterm Exam. Name:... I.D.#:... 1. (30 pts) True or false (mark O for true ; X for false ). (Score=Max{0, Right- 1 2 Wrong}.) (1) X... If L 1 is regular and L 2 L

More information

Non-deterministic Finite Automata (NFAs)

Non-deterministic Finite Automata (NFAs) Algorithms & Models of Computation CS/ECE 374, Fall 27 Non-deterministic Finite Automata (NFAs) Part I NFA Introduction Lecture 4 Thursday, September 7, 27 Sariel Har-Peled (UIUC) CS374 Fall 27 / 39 Sariel

More information

Chapter Five: Nondeterministic Finite Automata

Chapter Five: Nondeterministic Finite Automata Chapter Five: Nondeterministic Finite Automata From DFA to NFA A DFA has exactly one transition from every state on every symbol in the alphabet. By relaxing this requirement we get a related but more

More information

CS 322 D: Formal languages and automata theory

CS 322 D: Formal languages and automata theory CS 322 D: Formal languages and automata theory Tutorial NFA DFA Regular Expression T. Najla Arfawi 2 nd Term - 26 Finite Automata Finite Automata. Q - States 2. S - Alphabets 3. d - Transitions 4. q -

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY NON-DETERMINISM and REGULAR OPERATIONS THURSDAY JAN 6 UNION THEOREM The union of two regular languages is also a regular language Regular Languages Are

More information

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 9 : Myhill-Nerode Theorem and applications

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 9 : Myhill-Nerode Theorem and applications COMP-33 Theory of Computation Fall 217 -- Prof. Claude Crépeau Lec. 9 : Myhill-Nerode Theorem and applications COMP 33 Fall 212: Lectures Schedule 1-2. Introduction 1.5. Some basic mathematics 2-3. Deterministic

More information

Nondeterminism and Epsilon Transitions

Nondeterminism and Epsilon Transitions Nondeterminism and Epsilon Transitions Mridul Aanjaneya Stanford University June 28, 22 Mridul Aanjaneya Automata Theory / 3 Challenge Problem Question Prove that any square with side length a power of

More information

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

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever.  ETH Zürich (D-ITET) September, Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) September, 28 2017 Part 2 out of 5 Last week was all about Deterministic Finite Automaton

More information