FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Size: px
Start display at page:

Download "FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY"

Transcription

1 5-453 FORMAL LANGUAGES, AUTOMATA AN COMPUTABILITY

2 FA NFA EFINITION Regular Language Regular Expression

3 How can we prove that two regular expressions are equivalent? How can we prove that two FAs (or two NFAs) are equivalent? How can we prove that two regular languages are equivalent? (oes this question make sense?)

4 How can we prove that two FAs (or two NFAs) are equivalent?

5 MINIMIZING FAs THURSAY Jan 23

6 IS THIS MINIMAL?

7 IS THIS MINIMAL?

8 THEOREM For every regular language L, there exists a UNIQUE (up to re-labeling of the states) minimal FA M such that L = L(M)

9 THEOREM For every regular language L, there exists a UNIQUE (up to re-labeling of the states) minimal FA M such that L = L(M) Minimal means wrt number of states Given a specification for L, via FA, NFA or regex,this theorem is constructive.

10 NOT TRUE FOR NFAs

11 NOT TRUE FOR RegExp

12 EXTENING δ Given FA M = (Q, Σ, δ, q, F) extend δ to δ ^ : Q Σ* Q as follows: δ(q, ^ ε) = q δ(q, ^ σ) = δ(q, σ) δ(q, ^ ^ σ σ k+ ) = δ( δ(q, σ σ k ), σ k+ ) ^ Note: δ(q, w) F M accepts w String w Σ* distinguishes states p and q iff δ(p, ^ w) F δ(q, ^ w) F

13 EXTENING δ Given FA M = (Q, Σ, δ, q, F) extend δ to δ ^ : Q Σ* Q as follows: δ(q, ^ ε) = q δ(q, ^ σ) = δ(q, σ) δ(q, ^ ^ σ σ k+ ) = δ( δ(q, σ σ k ), σ k+ ) ^ Note: δ(q, w) F M accepts w String w Σ* distinguishes states p and q iff exactly ONE of δ(p ^, w), δ(q, ^ w) is a final state

14 Fix M = (Q, Σ, δ, q, F) and let p, q Q EFINITION: p is distinguishable from q iff there is a w Σ* that distinguishes p and q p is indistinguishable from q iff p is not distinguishable from q iff for all w Σ*, ^ δ(p, w) F δ(q, ^ w) F

15 Fix M = (Q, Σ, δ, q, F) and let p, q Q EFINITION: p is distinguishable from q iff there is a w Σ* that distinguishes p and q p is indistinguishable from q iff p is not distinguishable from q iff for all w Σ*, ^ δ(p, w) F ^ δ(q, w) F

16 q, q q 2 q 3 ε distinguishes accept from non-accept states

17 Fix M = (Q, Σ, δ, q, F) and let p, q, r Q efine relation ~ : p ~ q iff p is indistinguishable from q p ~ q iff p is distinguishable from q / Proposition: ~ is an equivalence relation

18 Fix M = (Q, Σ, δ, q, F) and let p, q, r Q efine relation ~ : 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 (of transitivity): for all w, we have: δ(p, ^ w) F δ(q, ^ w) F δ(r, ^ w) F

19 Fix M = (Q, Σ, δ, q, F) and let p, q, r Q so ~ partitions the set of states of M into disjoint equivalence classes Proposition: ~ is an equivalence relation p ~ p (reflexive) p ~ q q ~ p (symmetric) p ~ q and q ~ r p ~ r (transitive) Proof (of transitivity): for all w, we have: δ(p, ^ w) F δ(q, ^ w) F δ(r, ^ w) F

20 Fix M = (Q, Σ, δ, q, F) and let p, q, r Q so ~ partitions the set of states of M into disjoint equivalence classes Proposition: ~ is an equivalence relation [q] = { p p ~ q } Q q q

21

22 Input: FA M Algorithm MINIMIZE Output: FA M MIN such that: M M MIN (that is, L(M) = L(M MIN )) M MIN has no inaccessible states M MIN is irreducible all states of M MIN are pairwise distinguishable

23 Input: FA M Algorithm MINIMIZE Output: FA M MIN such that: M M MIN (that is, L(M) = L(M MIN )) M MIN has no inaccessible states M MIN is irreducible all states of M MIN are pairwise distinguishable Theorem: M MIN is the unique minimum FA equivalent to M

24 NOTE: Theorem not true for NFAs What does this say about Regexs?

25 Intuition: States of M MIN will be blocks of equivalent states of M We ll find these equivalent states with a Table-Filling Algorithm

26 TABLE-FILLING ALGORITHM Input: FA M = (Q, Σ, δ, q, F) Output: () M = { (p,q) p,q Q and p ~ q } / (2) E M = { [q] q Q }

27 TABLE-FILLING ALGORITHM Input: FA M = (Q, Σ, δ, q, F) Output: () M = { (p,q) p,q Q and p ~ q } / (2) E M = { [q] q Q } IEA: We know how to find those pairs of states that ε distinguishes Use this and recursion to find those pairs distinguishable with longer strings Pairs left over will be indistinguishable

28 TABLE-FILLING ALGORITHM Input: FA M = (Q, Σ, δ, q, F) Output: () M = { (p,q) p,q Q and p / ~ q } (2) E M = { [q] q Q } q q Base Case: p accepts and q rejects p ~ q / q i q n q q q i q n

29 TABLE-FILLING ALGORITHM Input: FA M = (Q, Σ, δ, q, F) Output: () M = { (p,q) p,q Q and p / ~ q } (2) E M = { [q] q Q } q q q i Base Case: p accepts and q rejects p ~ q / Recursion: if there is σ Σ and states p, q satisfying q n q q q i q n δ (p, σ) = p ~ / p ~ / q δ (q, σ) = q Repeat until no more new s

30 q q q 2 q 3 q q q 2 q 3, q q q 2 q 3

31 q q q 2 q 3 q q q 2 q 3, q q q 2 q 3

32 q q q 2 q 3 q q q 2 q 3, q q q 2 q 3

33 q q q 2 q 3 q q q 2 q 3, q q q 2 q 3

34 q q q 2 q 3 q q q 2 q 3, q q q 2 q 3

35 q q q q q 3 q 2 q 2 q 3 q q q 2 q 3

36 q q q q q 3 q 2 q 2 q 3 q q q 2 q 3

37 q q q q q 3 q 2 q 2 q 3 q q q 2 q 3

38 Claim: If p, q are distinguished by Table-Filling algorithm (ie pair labelled by ), then p ~ / q Proof: By induction on the stage of the algorithm Claim: If p, q are not distinguished by Table-Filling algorithm, then p ~ q Proof (by contradiction):

39 Claim: If p, q are distinguished by Table-Filling algorithm (ie pair labelled by ), then p ~ q / Proof: By induction on the stage of the algorithm If (p, q) is marked at the start, then one s in F and one isn t, so ε distinguishes p and q

40 Claim: If p, q are distinguished by Table-Filling algorithm (ie pair labelled by ), then p ~ q / Proof: By induction on the stage of the algorithm If (p, q) is marked at the start, then one s in F and one isn t, so ε distinguishes p and q Suppose (p, q) is marked at stage n+ Then there are states p, q, string w Σ* and σ Σ such that:. (p, q ) are marked p ~ / q (by induction) δ(p, ^ w) F and ^ δ(q, w) F 2. p = δ(p,σ) and q = δ(q,σ) The string σw distinguishes p and q!

41 Claim: If p, q are not distinguished by Table-Filling algorithm, then p ~ q Proof (by contradiction):

42 Claim: If p, q are not distinguished by Table-Filling algorithm, then p ~ q Proof (by contradiction): Suppose the pair (p, q) is not marked by the algorithm, yet p ~ q (a bad pair ) / Suppose (p,q) is a bad pair with the shortest w. δ(p, ^ w) F and ^ δ(q, w) F So, w = σw, where σ Σ (Why is w >?)

43 Claim: If p, q are not distinguished by Table-Filling algorithm, then p ~ q Proof (by contradiction): Suppose the pair (p, q) is not marked by the algorithm, yet p ~ q (a bad pair ) / Suppose (p,q) is a bad pair with the shortest w. δ(p, ^ w) F and ^ δ(q, w) F (Why is w >?) So, w = σw, where σ Σ Let p = δ(p,σ) and q = δ(q,σ) Then (p, q ) cannnot be marked (Why?) But (p, q ) is distinguished by w! So (p, q ) is also a bad pair, but with a SHORTER w! Contradiction!

44 Input: FA M Algorithm MINIMIZE Output: FA M MIN () Remove all inaccessible states from M (2) Apply Table-Filling algorithm to get: E M = { [q] q is an accessible state of M }

45 Input: FA M Algorithm MINIMIZE Output: FA M MIN () Remove all inaccessible states from M (2) Apply Table-Filling algorithm to get: E M = { [q] q is an accessible state of M } efine: M MIN = (Q MIN, Σ, δ MIN, q MIN, F MIN ) Q MIN = E M, q MIN = [q ], F MIN = { [q] q F } δ MIN ( [q], σ ) = [ δ( q, σ ) ] Must show δ MIN is well defined!

46 Input: FA M Algorithm MINIMIZE Output: FA M MIN () Remove all inaccessible states from M (2) Apply Table-Filling algorithm to get: E M = { [q] q is an accessible state of M } efine: M MIN = (Q MIN, Σ, δ MIN, q MIN, F MIN ) Q MIN = E M, q MIN = [q ], F MIN = { [q] q F } δ MIN ( [q], σ ) = [ δ( q, σ ) ] ^ Claim: δ MIN ( [q], w ) = [ ^ δ( q, w) ], w Σ*

47 Input: FA M Algorithm MINIMIZE Output: FA M MIN () Remove all inaccessible states from M (2) Apply Table-Filling algorithm to get: E M = { [q] q is an accessible state of M } efine: M MIN = (Q MIN, Σ, δ MIN, q MIN, F MIN ) Q MIN = E M, q MIN = [q ], F MIN = { [q] q F } δ MIN ( [q], σ ) = [ δ( q, σ ) ] ^ So: δ MIN ( [q ], w ) = [ δ( ^ q, w) ], w Σ*

48 Input: FA M Algorithm MINIMIZE Output: FA M MIN () Remove all inaccessible states from M (2) Apply Table-Filling algorithm to get: E M = { [q] q is an accessible state of M } efine: M MIN = (Q MIN, Σ, δ MIN, q MIN, F MIN ) Q MIN = E M, q MIN = [q ], F MIN = { [q] q F } δ MIN ( [q], σ ) = [ δ( q, σ ) ] Follows: M MIN M

49 q q q 4,, q 5 q 2 q 3

50 q q q 4, q 5 q 3

51 q q q 4, q q 5 q q 3 q 3 q 4 q 5 q q q 3 q 4 q 5

52 q q q 4, q q 5 q q 3 q 3 q 4 q 5 q q q 3 q 4 q 5

53 q q q 4, q q 5 q q 3 q 3 q 4 q 5 q q q 3 q 4 q 5

54 q q q 4, q q 5 q q 3 q 3 q 4 q 5 q q q 3 q 4 q 5

55 q q q 4, q q 5 q q 3 q 3 q 4 q 5 q q q 3 q 4 q 5

56 q q q 4, q q 5 q q 3 q 3 q 4 q 5 q q q 3 q 4 q 5

57 MINIMIZE q q q 2

58 MINIMIZE q q q 2

59 PROPOSITION. Suppose M M and M has no inaccessible states and is irreducible Then, there exists a - onto correspondence between M MIN and M (preserving transitions) i.e., M MIN and M are Isomorphic

60 PROPOSITION. Suppose M M and M has no inaccessible states and is irreducible Then, there exists a - onto correspondence between M MIN and M (preserving transitions) i.e., M MIN and M are Isomorphic COR: M MIN is unique minimal FA M

61 PROPOSITION. Suppose M M and M has no inaccessible states and is irreducible Then, there exists a - onto correspondence between M MIN and M (preserving transitions) i.e., M MIN and M are Isomorphic COR: M MIN is unique minimal FA M Proof of Prop: We will construct a map recursively Base Case: q MIN q Recursive Step: If p p q σ q σ Then q q

62 PROPOSITION. Suppose M M and M has no inaccessible states and is irreducible Then, there exists a - onto correspondence between M MIN and M (preserving transitions) i.e., M MIN and M are Isomorphic COR: M MIN is unique minimal FA M Proof of Prop: We will construct a map recursively Base Case: q MIN q Recursive Step: If p p and δ(p, σ) = q and δ(p,σ) = q Then q q

63 We need to show: The map is everywhere defined The map is well defined The map is a bijection ( - and onto) The map preserves transitions

64 Base Case: q MIN q Recursive Step: If p p σ σ q q Then q q The map is everywhere defined: That is, for all q M MIN there is a q M such that q q If q M MIN, there is a string w such that δ^ MIN (q MIN,w) = q (WHY?) Let q = δ (q ^,w). q will map to q (by induction)

65 Base Case: q MIN q Recursive Step: If p p The map is well defined q σ q σ Then q q That is, for all q M MIN there is at most one q M such that q q Suppose there exist 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 (Why?)

66 Suppose there exist q and q such that q q and q q Suppose q and q are distinguishable M MIN M q MIN u q w Accept q u q w Accept q MIN v Contradiction! w q Reject q v q w Reject

67 The map is - Suppose there are distinct p and q such that p q and q q p and q are distinguishable (why?) M MIN M q MIN u p w Accept q u q w Accept q MIN v q w Reject q v Contradiction! w q Reject

68 Base Case: q MIN q Recursive Step: If p p σ σ q q The map is onto Then q q That is, for all q M there is a q M MIN such that q q If q M, there is w such that δ (q ^,w) = q Let q = δ^ MIN (q MIN,w). q will map to q (why?)

69 Base Case: q MIN q Recursive Step: If p p σ σ q q Then q q The map preserves transitions That is, if δ(p, σ) = q and p p and q q then, δ (p, σ) = q (Why?)

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

71 Read Chapters 2. & 2.2 for next time

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

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

CS 154, Lecture 4: Limitations on DFAs (I), Pumping Lemma, Minimizing DFAs CS 154, Lecture 4: Limitations on FAs (I), Pumping Lemma, Minimizing FAs Regular or Not? Non-Regular Languages = { w w has equal number of occurrences of 01 and 10 } REGULAR! C = { w w has equal number

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

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

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

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

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular Expressions Orit Moskovich Gal Rotem Tel Aviv University October 28, 2015 Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular

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

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. 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 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

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata Automata and Formal Languages - CM81 Non-Deterministic Finite Automata Andrés Sicard-Ramírez Universidad EAFIT Semester 217-2 Non-Deterministic Finite Automata (NFA) Introduction q i a a q j a q k The

More information

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA)

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA) Languages Non deterministic finite automata with ε transitions Recall What is a language? What is a class of languages? Finite Automata Consists of A set of states (Q) A start state (q o ) A set of accepting

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 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

Nondeterministic Finite Automata. Nondeterminism Subset Construction

Nondeterministic Finite Automata. Nondeterminism Subset Construction Nondeterministic Finite Automata Nondeterminism Subset Construction 1 Nondeterminism A nondeterministic finite automaton has the ability to be in several states at once. Transitions from a state on an

More information

Lecture 1: Finite State Automaton

Lecture 1: Finite State Automaton Lecture 1: Finite State Automaton Instructor: Ketan Mulmuley Scriber: Yuan Li January 6, 2015 1 Deterministic Finite Automaton Informally, a deterministic finite automaton (DFA) has finite number of s-

More information

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F)

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Outline Nondeterminism Regular expressions Elementary reductions http://www.cs.caltech.edu/~cs20/a October 8, 2002 1 Determistic Finite Automata A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Q is a finite

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

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 Formal Languages TMV026/DIT321 LP Testing Equivalence of Regular Languages

Finite Automata and Formal Languages TMV026/DIT321 LP Testing Equivalence of Regular Languages Finite Automata and Formal Languages TMV026/DIT321 LP4 2012 Lecture 10 Ana Bove April 23rd 2012 Overview of today s lecture: Equivalence of Regular Languages Minimisation of Automata Testing Equivalence

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

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) Sungjin Im University of California, Merced 2-3-214 Example II A ɛ B ɛ D F C E Example II A ɛ B ɛ D F C E NFA accepting

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

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

Regular Languages. Kleene Theorem I. Proving Kleene Theorem. Kleene Theorem. Proving Kleene Theorem. Proving Kleene Theorem

Regular Languages. Kleene Theorem I. Proving Kleene Theorem. Kleene Theorem. Proving Kleene Theorem. Proving Kleene Theorem Regular Languages Kleene Theorem I Today we continue looking at our first class of languages: Regular languages Means of defining: Regular Expressions Machine for accepting: Finite Automata Kleene Theorem

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

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA) Deterministic Finite Automata Non deterministic finite automata Automata we ve been dealing with have been deterministic For every state and every alphabet symbol there is exactly one move that the machine

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

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT. Recap DFA,NFA, DTM Slides by Prof. Debasis Mitra, FIT. 1 Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { {, } } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite

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

Automata and Languages

Automata and Languages Automata and Languages Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Nondeterministic Finite Automata with empty moves (-NFA) Definition A nondeterministic finite automaton

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

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata Sungjin Im University of California, Merced 1-27-215 Nondeterminism Michael Rabin and Dana Scott (1959) Michael Rabin Dana

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

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

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

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

Java II Finite Automata I

Java II Finite Automata I Java II Finite Automata I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz November, 23 Processing Regular Expressions We already learned about Java s regular expression

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

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 (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

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

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

Regular Language Equivalence and DFA Minimization. Equivalence of Two Regular Languages DFA Minimization

Regular Language Equivalence and DFA Minimization. Equivalence of Two Regular Languages DFA Minimization Regular Language Equivalence and DFA Minimization Equivalence of Two Regular Languages DFA Minimization Decision Property: Equivalence Given regular languages L and M, is L = M? Algorithm involves constructing

More information

Lecture 2: Regular Expression

Lecture 2: Regular Expression Lecture 2: Regular Expression Instructor: Ketan Mulmuley Scriber: Yuan Li January 8, 2015 In the last lecture, we proved that DFA, NFA, and NFA with ϵ-moves are equivalent. Recall that a language L Σ is

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

Finite Universes. L is a fixed-length language if it has length n for some

Finite Universes. L is a fixed-length language if it has length n for some Finite Universes Finite Universes When the universe is finite (e.g., the interval 0, 2 1 ), all objects can be encoded by words of the same length. A language L has length n 0 if L =, or every word of

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

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

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

Chapter 2: Finite Automata

Chapter 2: Finite Automata Chapter 2: Finite Automata 2.1 States, State Diagrams, and Transitions Finite automaton is the simplest acceptor or recognizer for language specification. It is also the simplest model of a computer. A

More information

CSC173 Workshop: 13 Sept. Notes

CSC173 Workshop: 13 Sept. Notes CSC173 Workshop: 13 Sept. Notes Frank Ferraro Department of Computer Science University of Rochester September 14, 2010 1 Regular Languages and Equivalent Forms A language can be thought of a set L of

More information

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

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed HKN CS/ECE 374 Midterm 1 Review Nathan Bleier and Mahir Morshed For the most part, all about strings! String induction (to some extent) Regular languages Regular expressions (regexps) Deterministic finite

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

CS 154 Formal Languages and Computability Assignment #2 Solutions

CS 154 Formal Languages and Computability Assignment #2 Solutions CS 154 Formal Languages and Computability Assignment #2 Solutions Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak www.cs.sjsu.edu/~mak Assignment #2: Question 1

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

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

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 CMPSCI 250: Introduction to Computation Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 λ-nfa s to NFA s to DFA s Reviewing the Three Models and Kleene s Theorem The Subset

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

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r Syllabus R9 Regulation UNIT-II NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: In the automata theory, a nondeterministic finite automaton (NFA) or nondeterministic finite state machine is a finite

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 8 January 24, 2018 Outline Turing Machines and variants multitape TMs nondeterministic TMs Church-Turing Thesis So far several models of computation finite automata

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

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA.

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA. Outline CS21 Decidability and Tractability Lecture 5 January 16, 219 and Languages equivalence of NPDAs and CFGs non context-free languages January 16, 219 CS21 Lecture 5 1 January 16, 219 CS21 Lecture

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

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

Computational Models - Lecture 1 1

Computational Models - Lecture 1 1 Computational Models - Lecture 1 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. February 29/ March 02, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames

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

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D )

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D ) Search algorithm Clever algorithm even for a single word Example: find abac in abaababac See Knuth-Morris-Pratt and String searching algorithm on wikipedia 2 Subset construction We have defined for a DFA

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, 24 2015 Last week was all about Deterministic Finite Automaton We saw three main

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

CSC236 Week 10. Larry Zhang

CSC236 Week 10. Larry Zhang CSC236 Week 10 Larry Zhang 1 Today s Topic Deterministic Finite Automata (DFA) 2 Recap of last week We learned a lot of terminologies alphabet string length of string union concatenation Kleene star language

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

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

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY KOLMOGOROV-CHAITIN (descriptive) COMPLEXITY TUESDAY, MAR 18 CAN WE QUANTIFY HOW MUCH INFORMATION IS IN A STRING? A = 01010101010101010101010101010101

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Theory of Regular Expressions DFAs and NFAs Reminders Project 1 due Sep. 24 Homework 1 posted Exam 1 on Sep. 25 Exam topics list posted Practice homework

More information

Homomorphisms and Efficient State Minimization

Homomorphisms and Efficient State Minimization Homomorphisms and Efficient State Minimization Mridul Aanjaneya Stanford University July 10, 2012 Mridul Aanjaneya Automata Theory 1/ 23 Homomorphisms A homomorphism on an alphabet is a function that gives

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

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

DFA to Regular Expressions

DFA to Regular Expressions DFA to Regular Expressions Proposition: If L is regular then there is a regular expression r such that L = L(r). Proof Idea: Let M = (Q,Σ, δ, q 1, F) be a DFA recognizing L, with Q = {q 1,q 2,...q n },

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

Outline. Summary. DFA -> Regex. Finish off Regex -> e-nfa -> NFA -> DFA -> Regex Minimization/equivalence (Myhill-Nerode theorem)

Outline. Summary. DFA -> Regex. Finish off Regex -> e-nfa -> NFA -> DFA -> Regex Minimization/equivalence (Myhill-Nerode theorem) Outline Finish off Regex -> e-nfa -> NFA -> DFA -> Regex Minimization/equivalence (Myhill-Nerode theorem) http://www.cs.caltech.edu/~cs20/a October 9, 2002 1 Summary NFA -> DFA If NFA has states Q, construct

More information

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 10/22, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

PUSHDOWN AUTOMATA (PDA)

PUSHDOWN AUTOMATA (PDA) PUSHDOWN AUTOMATA (PDA) FINITE STATE CONTROL INPUT STACK (Last in, first out) input pop push ε,ε $ 0,ε 0 1,0 ε ε,$ ε 1,0 ε PDA that recognizes L = { 0 n 1 n n 0 } Definition: A (non-deterministic) PDA

More information

Non-Deterministic Finite Automata

Non-Deterministic Finite Automata Slides modified Yishay Mansour on modification by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 8 Non-Deterministic Finite Automata 0,1 0,1 0 0,ε q q 1 q 2 3 1 q 4 an NFA

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

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata : Organization of Programming Languages Theory of Regular Expressions Finite Automata Previous Course Review {s s defined} means the set of string s such that s is chosen or defined as given s A means

More information

Sri vidya college of engineering and technology

Sri vidya college of engineering and technology Unit I FINITE AUTOMATA 1. Define hypothesis. The formal proof can be using deductive proof and inductive proof. The deductive proof consists of sequence of statements given with logical reasoning in order

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

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

Computational Models - Lecture 3 1

Computational Models - Lecture 3 1 Computational Models - Lecture 3 1 Handout Mode Iftach Haitner. Tel Aviv University. November 14, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Computational Models - Lecture 4

Computational Models - Lecture 4 Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push

More information

Extended transition function of a DFA

Extended transition function of a DFA Extended transition function of a DFA The next two pages describe the extended transition function of a DFA in a more detailed way than Handout 3.. p./43 Formal approach to accepted strings We define the

More information

Chap. 2 Finite Automata

Chap. 2 Finite Automata Chap. 2 Finite Automata 2.1 An Informal Picture of Finite Automata A man with a wolf, goat, and cabbage is on the left bank of a river A boat carries one man and only one of the other three. The wolf eats

More information

Finite Automata. Wen-Guey Tzeng Computer Science Department National Chiao Tung University

Finite Automata. Wen-Guey Tzeng Computer Science Department National Chiao Tung University Finite Automata Wen-Guey Tzeng Computer Science Department National Chiao Tung University Syllabus Deterministic finite acceptor Nondeterministic finite acceptor Equivalence of DFA and NFA Reduction of

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

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

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV27/DIT32 LP4 28 Lecture 5 Ana Bove March 26th 28 Recap: Inductive sets, (terminating) recursive functions, structural induction To define an inductive set

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