CS 154, Lecture 4: Limitations on DFAs (I), Pumping Lemma, Minimizing DFAs

Size: px
Start display at page:

Download "CS 154, Lecture 4: Limitations on DFAs (I), Pumping Lemma, Minimizing DFAs"

Transcription

1 CS 154, Lecture 4: Limitations on FAs (I), Pumping Lemma, Minimizing FAs

2 Regular or Not? Non-Regular Languages = { w w has equal number of occurrences of 01 and 10 } REGULAR! C = { w w has equal number of 1s and 0s} NOT REGULAR! How can we prove that there is no FA for a particular language? Surprising Algorithms (even in restricted models) are routinely being discovered

3 The Pumping Lemma: Structure in Regular Languages Let L be a regular language Then there is a positive integer P s.t. for all strings w L with w P there is a way to write w = xyz, where: 1. y > 0 (that is, y ε) 2. xy P 3. For all i 0, xy i z L Why is it called the pumping lemma? The word w gets pumped into longer and longer strings

4 Proof: Let M be a FA that recognizes L Let P be the number of states in M Let w be a string where w L and w P We show: w = xyz y x w 1. y > 0 2. xy P 3. xy i z L for all i 0 z q 0 q j q k q w Claim: There must exist j and k such that 0 j < k P, and q j = q k

5 Applying the Pumping Lemma Let s prove that EQ={ w #1s = #0s} is not regular. By contradiction. Assume EQ is regular. Let P be as in pumping lemma. Let w = 0 P 1 P EQ. Can write w = xyz, with y > 0, xy P, such that for all i 0, xy i z is also in EQ Claim: The string y must be all zeroes. Why? Because xy P and w = xyz = 0 P 1 P But then xyyz has more 0s than 1s Contradiction!

6 Applying the Pumping Lemma Prove: SQ = {0 n2 n 0} is not regular Assume SQ is regular. Let w = 0 P2 Can write w = xyz, with y > 0, xy P, such that for all i 0, xy i z is also in EQ So xyyz SQ. Note that xyyz = 0 P2 + y Note that 0 < y P So xyyz = P 2 + y P 2 + P < P 2 + 2P + 1 = (P+1) 2 and P 2 < xyyz < (P+1) 2 Therefore xyyz is not a perfect square! Hence 0 P2 + y = xyyz SQ, so our assumption must be false. SQ is not regular!

7 oes this FA have a minimal number of states?

8

9 Is this minimal? How can we tell in general?

10 Theorem: For every regular language L, there is a unique (up to re-labeling of the states) minimal-state FA M* such that L = L(M*). Furthermore, there is an efficient algorithm which, given any FA M, will output this unique M*. If these were true for more general models of computation, that would be an engineering breakthrough

11 Note: There isn t a uniquely minimal NFA

12 Extending transition function to strings Given FA M = (Q, Σ,, q 0, F), we extend to a function : Q Σ* Q as follows: (q, ε) = (q, ) = q (q, ) (q, 1 k+1 ) = ( (q, 1 k ), k+1 ) (q, w) = the state of M reached after reading in w, starting from state q Note: (q 0, w) F M accepts w ef. w Σ* distinguishes states q 1 and q 2 if (q exactly 1, w) one F of (q (q 1, w), 2, w) (q 2 F, w) is a final state

13 istinguishing two states ef. w Σ* distinguishes states q 1 and q 2 if exactly one of (q 1, w), (q 2, w) is a final state Here read this I m in q 1 or q 2, but which? How can I tell? Ok, I m accepting! Must have been q 1 W

14 Fix M = (Q, Σ,, q 0, F) and let p, q Q efinitions: State p is distinguishable from state q if there is w Σ* that distinguishes p and q ( there is w Σ* so that exactly one of (p, w), (q, w) is a final state) State p is indistinguishable from state q if p is not distinguishable from q ( for all w Σ*, (p, w) F (q, w) F) Pairs of indistinguishable states are redundant

15 Which pairs of states are distinguishable here? ε distinguishes all final states from non-final states

16 Which pairs of states are distinguishable here? The string 10 distinguishes q 0 and q 3

17 Which pairs of states are distinguishable here? The string 0 distinguishes q 1 and q 2

18 Fix M = (Q, Σ,, q 0, F) and let p, q, r Q efine a binary relation on the states of M: p q iff p is indistinguishable from q p q iff p is distinguishable from q Proposition: is an equivalence relation p p (reflexive) p q q p (symmetric) p q and q r p r (transitive) Proof?

19 Fix M = (Q, Σ,, q 0, F) and let p, q, r Q Therefore, the relation partitions Q into disjoint equivalence classes Proposition: is an equivalence relation [q] := { p p q }

20

21 Algorithm: MINIMIZE-FA Input: FA M Output: FA M MIN such that: L(M) = L(M MIN ) M MIN has no inaccessible states M MIN is irreducible For all states p q of M MIN, p and q are distinguishable Theorem: M MIN is the unique minimal FA that is equivalent to M

22 Intuition: The states of M MIN will be the equivalence classes of states of M We ll uncover these equivalent states with a dynamic programming algorithm

23 Input: FA M = (Q, Σ,, q 0, F) The Table-Filling Algorithm Output: (1) M = { (p, q) p, q Q and p q } (2) EQUIV M = { [q] q Q } High-Level Idea: We know how to find those pairs of states that the string ε distinguishes Use this and iteration to find those pairs distinguishable with longer strings The pairs of states left over will be indistinguishable

24 The Table-Filling Algorithm Input: FA M = (Q, Σ,, q 0, F) Output: (1) M = { (p, q) p, q Q and p q } (2) EQUIV M = { [q] q Q } Base Case: For all (p, q) such that p accepts and q rejects p q

25 The Table-Filling Algorithm Input: FA M = (Q, Σ,, q 0, F) Output: (1) M = { (p, q) p, q Q and p q } (2) EQUIV M = { [q] q Q } Base Case: For all (p, q) such that p accepts and q rejects p q Iterate: If there are states p, q and symbol σ Σ satisfying: (p, ) = (q, ) = p mark p q q Repeat until no more s can be added

26

27

28 Claim: If (p, q) is marked by the Table-Filling algorithm, then p q Proof: By induction on the number of steps in the algorithm before (p,q) is marked If (p, q) is marked at the start, then one state s in F and the other isn t, so ε distinguishes p and q Suppose (p, q) is marked at a later point. Then there are states p, q such that: 1. (p, q ) are marked p q (by induction) So there s a string w s.t. (p, w) F (q, w) F 2. p = (p, ) and q = (q, ), where Σ The string w distinguishes p and q!

29 Claim: If (p, q) is not marked by the Table-Filling algorithm, then p q Proof (by contradiction): Suppose the pair (p, q) is not marked by the algorithm, yet p q (call this a bad pair ) Then there is a string w such that w > 0 and: (p, w) F and (q, w) F (Why is w > 0?) Of We all have such w bad = w, pairs, for let some p, q string be a pair w and with some the shortest Σ distinguishing string w Let p = (p, ) and q = (q, ) Then (p, q ) is also a bad pair, but with a SHORTER distinguishing string, w!

30 Algorithm MINIMIZE Input: FA M Output: Equivalent minimal-state FA M MIN 1. Remove all inaccessible states from M 2. Run Table-Filling algorithm on M to get: EQUIV M = { [q] q is an accessible state of M } 3. efine: M MIN = (Q MIN, Σ, MIN, q 0 MIN, F MIN ) Q MIN = EQUIV M, q 0 MIN = [q 0 ], F MIN = { [q] q F } MIN ( [q], ) = [ ( q, ) ] Claim: L(M MIN ) = L(M)

31

32

33 Thm: M MIN is the unique minimal FA equivalent to M Claim: If L(M )=L(M MIN ) and M has no inaccessible states and M is irreducible there is an isomorphism between M and M MIN Suppose for now the Claim is true. If M is a minimal FA, then M has no inaccessible states and is irreducible (why?) So the Claim implies: Let M be a minimal FA for M. there is an isomorphism between M and the FA M MIN that is output by MINIMIZE(M). The Thm holds!

34 Thm: M MIN is the unique minimal FA equivalent to M Claim: If L(M )=L(M MIN ) and M has no inaccessible states and M is irreducible there is an isomorphism between M and M MIN Proof: We recursively construct a map from the states of M MIN to the states of M Base Case: q 0 MIN q 0 Recursive Step: If p p q q Then q q

35 Base Case: q 0 MIN q 0 Recursive Step: If p p Then q q q q

36 Base Case: q 0 MIN q 0 Recursive Step: We need to prove: If p p The map is defined everywhere The map is well defined The map is a bijection q Then q q q The map preserves all transitions: If p p then MIN (p, ) (p, ) (this follows from the definition of the map!)

37 Base Case: q 0 MIN q 0 Recursive Step: If p p The map is defined everywhere That is, for all states q of M MIN there is a state q of M such that q q q Then q q q If q M MIN, there is a string w such that MIN (q 0 MIN,w) = q Let q = (q 0,w). Then q q

38 Base Case: q 0 MIN q 0 Recursive Step: If p p Then q q q q The map is well defined Proof by contradiction. Suppose there are states q and q such that q q and q q We show that q and q are indistinguishable, so it must be that q = q

39 Suppose there are states q and q such that q q and q q Suppose q and q are distinguishable M MIN M q 0 MIN u q w Accept q 0 u q w Accept q 0 MIN v Contradiction! w q Reject q 0 v q w Reject

40 Base Case: q 0 MIN q 0 Recursive Step: The map is onto If p p q Then q q q Want to show: For all states q of M there is a state q of M MIN such that q q For every q there is a string w such that M reaches state q after reading in w Let q be the state of M MIN after reading in w Claim: q q

41 The map is one-to-one Proof by contradiction. Suppose there are states p q such that p q and q q If p q, then p and q are distinguishable M MIN M q 0 MIN u p w Accept q 0 u q w Accept q 0 MIN v q w Reject q 0 v Contradiction! w q Reject

42 How can we prove that two regular expressions are equivalent?

43 Parting thoughts: Pumping for contradictions FAs can t count FAs can be optimized Later: Can FAs be learned? Questions?

CS154. Non-Regular Languages, Minimizing DFAs

CS154. Non-Regular Languages, Minimizing DFAs CS54 Non-Regular Languages, Minimizing FAs CS54 Homework is due! Homework 2 will appear this afternoon 2 The Pumping Lemma: Structure in Regular Languages Let L be a regular language Then there is a positive

More information

Lecture 5: Minimizing DFAs

Lecture 5: Minimizing DFAs 6.45 Lecture 5: Minimizing DFAs 6.45 Announcements: - Pset 2 is up (as of last night) - Dylan says: It s fire. - How was Pset? 2 DFAs NFAs DEFINITION Regular Languages Regular Expressions 3 4 Some Languages

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 5-453 FORMAL LANGUAGES, AUTOMATA AN COMPUTABILITY FA NFA EFINITION Regular Language Regular Expression How can we prove that two regular expressions are equivalent? How can we prove that two FAs (or two

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

Minimization of DFAs

Minimization of DFAs CS 72: Computability and Complexity Minimization of DFAs Sanjit A. Seshia EECS, UC Berkeley Acknowledgments: L.von Ahn, L. Blum, M. Blum, A. Sinclair What is Minimization? Minimized DFA for language L

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

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

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

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

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

More on Regular Languages and Non-Regular Languages

More on Regular Languages and Non-Regular Languages More on Regular Languages and Non-Regular Languages CSCE A35 Decision Properties of Regular Languages Given a (representation, e.g., RE, FA, of a) regular language L, what can we tell about L? Since there

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

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

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

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

Formal Language and Automata Theory (CS21004)

Formal Language and Automata Theory (CS21004) Theory (CS21004) Announcements The slide is just a short summary Follow the discussion and the boardwork Solve problems (apart from those we dish out in class) Table of Contents 1 2 3 Languages that are

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

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

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

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

Chapter 2: Finite Automata

Chapter 2: Finite Automata Chapter 2: Finite Automata Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu Please read the corresponding chapter before

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

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

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

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

TDDD65 Introduction to the Theory of Computation

TDDD65 Introduction to the Theory of Computation TDDD65 Introduction to the Theory of Computation Lecture 2 Gustav Nordh, IDA gustav.nordh@liu.se 2012-08-31 Outline - Lecture 2 Closure properties of regular languages Regular expressions Equivalence of

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

CPSC 421: Tutorial #1

CPSC 421: Tutorial #1 CPSC 421: Tutorial #1 October 14, 2016 Set Theory. 1. Let A be an arbitrary set, and let B = {x A : x / x}. That is, B contains all sets in A that do not contain themselves: For all y, ( ) y B if and only

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

Lecture 4 Nondeterministic Finite Accepters

Lecture 4 Nondeterministic Finite Accepters Lecture 4 Nondeterministic Finite Accepters COT 4420 Theory of Computation Section 2.2, 2.3 Nondeterminism A nondeterministic finite automaton can go to several states at once. Transitions from one state

More information

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages

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

Computability and Complexity

Computability and Complexity Computability and Complexity Lecture 5 Reductions Undecidable problems from language theory Linear bounded automata given by Jiri Srba Lecture 5 Computability and Complexity 1/14 Reduction Informal Definition

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

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

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018 CS 301 Lecture 18 Decidable languages Stephen Checkoway April 2, 2018 1 / 26 Decidable language Recall, a language A is decidable if there is some TM M that 1 recognizes A (i.e., L(M) = A), and 2 halts

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

CS 154 Introduction to Automata and Complexity Theory

CS 154 Introduction to Automata and Complexity Theory CS 154 Introduction to Automata and Complexity Theory cs154.stanford.edu 1 INSTRUCTORS & TAs Ryan Williams Cody Murray Lera Nikolaenko Sunny Rajan 2 Textbook 3 Homework / Problem Sets Homework will be

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

Fooling Sets and. Lecture 5

Fooling Sets and. Lecture 5 Fooling Sets and Introduction to Nondeterministic Finite Automata Lecture 5 Proving that a language is not regular Given a language, we saw how to prove it is regular (union, intersection, concatenation,

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

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

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,

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, Recall A deterministic finite automaton is a five-tuple where S is a finite set of states, M = (S, Σ, T, s 0, F ) Σ is an alphabet the input alphabet, T : S Σ S is the transition function, s 0 S is the

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

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

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

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

CSE 311: Foundations of Computing I Autumn 2014 Practice Final: Section X. Closed book, closed notes, no cell phones, no calculators.

CSE 311: Foundations of Computing I Autumn 2014 Practice Final: Section X. Closed book, closed notes, no cell phones, no calculators. CSE 311: Foundations of Computing I Autumn 014 Practice Final: Section X YY ZZ Name: UW ID: Instructions: Closed book, closed notes, no cell phones, no calculators. You have 110 minutes to complete the

More information

CS481F01 Solutions 6 PDAS

CS481F01 Solutions 6 PDAS CS481F01 Solutions 6 PDAS A. Demers 2 November 2001 1. Give a NPDAs that recognize the following languages: (a) The set of all strings in {0, 1} that contain twice as many 1s as 0s. (answer a) We build

More information

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 5 : DFA minimization

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 5 : DFA minimization COMP-33 Theory of Computation Fall 27 -- Prof. Claude Crépeau Lec. 5 : DFA minimization COMP 33 Fall 27: Lectures Schedule 4. Context-free languages 5. Pushdown automata 6. Parsing 7. The pumping lemma

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Mahesh Viswanathan Introducing Nondeterminism Consider the machine shown in Figure. Like a DFA it has finitely many states and transitions labeled by symbols from an input

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

CS 154 NOTES CONTENTS

CS 154 NOTES CONTENTS CS 154 NOTES ARUN DEBRAY MARCH 13, 2014 These notes were taken in Stanford s CS 154 class in Winter 2014, taught by Ryan Williams, by Arun Debray. They were updated in 2016. Error and typo notices can

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

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

Equivalence of DFAs and NFAs

Equivalence of DFAs and NFAs CS 172: Computability and Complexity Equivalence of DFAs and NFAs It s a tie! DFA NFA Sanjit A. Seshia EECS, UC Berkeley Acknowledgments: L.von Ahn, L. Blum, M. Blum What we ll do today Prove that DFAs

More information

We define the multi-step transition function T : S Σ S as follows. 1. For any s S, T (s,λ) = s. 2. For any s S, x Σ and a Σ,

We define the multi-step transition function T : S Σ S as follows. 1. For any s S, T (s,λ) = s. 2. For any s S, x Σ and a Σ, Distinguishability Recall A deterministic finite automaton is a five-tuple M = (S,Σ,T,s 0,F) where S is a finite set of states, Σ is an alphabet the input alphabet, T : S Σ S is the transition function,

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

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

More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41 More on Finite Automata and Regular Languages (NTU EE) Regular Languages Fall 2016 1 / 41 Pumping Lemma is not a Sufficient Condition Example 1 We know L = {b m c m m > 0} is not regular. Let us consider

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

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

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

Nondeterministic finite automata

Nondeterministic finite automata Lecture 3 Nondeterministic finite automata This lecture is focused on the nondeterministic finite automata (NFA) model and its relationship to the DFA model. Nondeterminism is an important concept in the

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

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS. 4 Functions Before studying functions we will first quickly define a more general idea, namely the notion of a relation. A function turns out to be a special type of relation. Definition: Let S and T be

More information

Chapter 5. Finite Automata

Chapter 5. Finite Automata Chapter 5 Finite Automata 5.1 Finite State Automata Capable of recognizing numerous symbol patterns, the class of regular languages Suitable for pattern-recognition type applications, such as the lexical

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

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

Extended RE's. UNIX pioneered the use of additional operators. and notation for RE's: æ E? = 0 or 1 occurrences of E = æ + E.

Extended RE's. UNIX pioneered the use of additional operators. and notation for RE's: æ E? = 0 or 1 occurrences of E = æ + E. Extended RE's UNIX pioneered the use of additional operators and notation for RE's: E? = 0 or 1 occurrences of E = + E. E + = 1 or more occurrences of E = EE. Character classes ëa, zgxë = the union of

More information

Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability

Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability Salil Vadhan September 20, 2012 Reading: Sipser, 1.3 and The Diagonalization Method, pages 174 178 (from just before Definition

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 Ch 4.2 Trace high-level descriptions of algorithms for computational problems. Use

More information

CSE 105 Theory of Computation

CSE 105 Theory of Computation CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Undecidability Today s Agenda Review and More Problems A Non-TR Language Reminders and announcements: HW 7 (Last!!)

More information

CSE 135: Introduction to Theory of Computation Optimal DFA

CSE 135: Introduction to Theory of Computation Optimal DFA CSE 35: Introduction to Theory of Computation Optimal DFA Sungjin Im University of California, Merced 2-9-25 Optimal Algorithms for Regular Languages Myhill-Nerode Theorem There is a unique optimal algorithm

More information

Fall 1999 Formal Language Theory Dr. R. Boyer. 1. There are other methods of nding a regular expression equivalent to a nite automaton in

Fall 1999 Formal Language Theory Dr. R. Boyer. 1. There are other methods of nding a regular expression equivalent to a nite automaton in Fall 1999 Formal Language Theory Dr. R. Boyer Week Four: Regular Languages; Pumping Lemma 1. There are other methods of nding a regular expression equivalent to a nite automaton in addition to the ones

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

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

Properties of the Integers

Properties of the Integers Properties of the Integers The set of all integers is the set and the subset of Z given by Z = {, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, }, N = {0, 1, 2, 3, 4, }, is the set of nonnegative integers (also called

More information

a + b = b + a and a b = b a. (a + b) + c = a + (b + c) and (a b) c = a (b c). a (b + c) = a b + a c and (a + b) c = a c + b c.

a + b = b + a and a b = b a. (a + b) + c = a + (b + c) and (a b) c = a (b c). a (b + c) = a b + a c and (a + b) c = a c + b c. Properties of the Integers The set of all integers is the set and the subset of Z given by Z = {, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, }, N = {0, 1, 2, 3, 4, }, is the set of nonnegative integers (also called

More information

1 More finite deterministic automata

1 More finite deterministic automata CS 125 Section #6 Finite automata October 18, 2016 1 More finite deterministic automata Exercise. Consider the following game with two players: Repeatedly flip a coin. On heads, player 1 gets a point.

More information

Languages, regular languages, finite automata

Languages, regular languages, finite automata Notes on Computer Theory Last updated: January, 2018 Languages, regular languages, finite automata Content largely taken from Richards [1] and Sipser [2] 1 Languages An alphabet is a finite set of characters,

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

Lecture 13: Foundations of Math and Kolmogorov Complexity

Lecture 13: Foundations of Math and Kolmogorov Complexity 6.045 Lecture 13: Foundations of Math and Kolmogorov Complexity 1 Self-Reference and the Recursion Theorem 2 Lemma: There is a computable function q : Σ* Σ* such that for every string w, q(w) is the description

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

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

Decidability (What, stuff is unsolvable?)

Decidability (What, stuff is unsolvable?) University of Georgia Fall 2014 Outline Decidability Decidable Problems for Regular Languages Decidable Problems for Context Free Languages The Halting Problem Countable and Uncountable Sets Diagonalization

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

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

CS243, Logic and Computation Nondeterministic finite automata

CS243, Logic and Computation Nondeterministic finite automata CS243, Prof. Alvarez NONDETERMINISTIC FINITE AUTOMATA (NFA) Prof. Sergio A. Alvarez http://www.cs.bc.edu/ alvarez/ Maloney Hall, room 569 alvarez@cs.bc.edu Computer Science Department voice: (67) 552-4333

More information

CpSc 421 Final Exam December 6, 2008

CpSc 421 Final Exam December 6, 2008 CpSc 421 Final Exam December 6, 2008 Do any five of problems 1-10. If you attempt more than five of problems 1-10, please indicate which ones you want graded otherwise, I ll make an arbitrary choice. Graded

More information

The Pumping Lemma: limitations of regular languages

The Pumping Lemma: limitations of regular languages The Pumping Lemma: limitations of regular languages Informatics 2A: Lecture 8 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 6 October, 2016 1 / 16 Recap of Lecture 7 Showing

More information

CS 154 NOTES MOOR XU NOTES FROM A COURSE BY LUCA TREVISAN AND RYAN WILLIAMS

CS 154 NOTES MOOR XU NOTES FROM A COURSE BY LUCA TREVISAN AND RYAN WILLIAMS CS 154 NOTES MOOR XU NOTES FROM A COURSE BY LUCA TREVISAN AND RYAN WILLIAMS Abstract. These notes were taken during CS 154 (Automata and Complexity Theory) taught by Luca Trevisan and Ryan Williams in

More information

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete CS125 Lecture 15 Fall 2016 15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete Already know SAT NP, so only need to show SAT is NP-hard. Let L be any language in NP. Let M be a NTM that decides L

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

More information

Notes on State Minimization

Notes on State Minimization U.C. Berkeley CS172: Automata, Computability and Complexity Handout 1 Professor Luca Trevisan 2/3/2015 Notes on State Minimization These notes present a technique to prove a lower bound on the number of

More information

1 The Local-to-Global Lemma

1 The Local-to-Global Lemma Point-Set Topology Connectedness: Lecture 2 1 The Local-to-Global Lemma In the world of advanced mathematics, we are often interested in comparing the local properties of a space to its global properties.

More information

4.2 The Halting Problem

4.2 The Halting Problem 172 4.2 The Halting Problem The technique of diagonalization was discovered in 1873 by Georg Cantor who was concerned with the problem of measuring the sizes of infinite sets For finite sets we can simply

More information

CS154, Lecture 12: Kolmogorov Complexity: A Universal Theory of Data Compression

CS154, Lecture 12: Kolmogorov Complexity: A Universal Theory of Data Compression CS154, Lecture 12: Kolmogorov Complexity: A Universal Theory of Data Compression Rosencrantz & Guildenstern Are Dead (Tom Stoppard) Rigged Lottery? And the winning numbers are: 1, 2, 3, 4, 5, 6 But is

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