CSE 135: Introduction to Theory of Computation Optimal DFA

Size: px
Start display at page:

Download "CSE 135: Introduction to Theory of Computation Optimal DFA"

Transcription

1 CSE 35: Introduction to Theory of Computation Optimal DFA Sungjin Im University of California, Merced

2 Optimal Algorithms for Regular Languages Myhill-Nerode Theorem There is a unique optimal algorithm for every problem that can be solved using finite memory. Anil Nerode

3 Optimal Algorithms for Regular Languages Myhill-Nerode Theorem There is a unique optimal algorithm for every problem that can be solved using finite memory. algorithm here means a deterministic machine Anil Nerode

4 Optimal Algorithms for Regular Languages Anil Nerode Myhill-Nerode Theorem There is a unique optimal algorithm for every problem that can be solved using finite memory. algorithm here means a deterministic machine optimal means requires least memory, i.e., has fewest states

5 Optimal Algorithms for Regular Languages Anil Nerode Myhill-Nerode Theorem There is a unique optimal algorithm for every problem that can be solved using finite memory. algorithm here means a deterministic machine optimal means requires least memory, i.e., has fewest states unique means that any two DFAs with fewest states for a language are isomorphic

6 Roadmap DFA minimization: Minimize a given DFA M by merging indistinguishable states.

7 Roadmap DFA minimization: Minimize a given DFA M by merging indistinguishable states. In general, could be only minimal (locally optimal) In DFA minimization, a minimal (locally optimal) DFA is a minimum (globally optimal) DFA. Test if two given DFAs are equivalent. Revisit Myhill-Nerode Theorem.

8 Many DFAs for the same language

9 Minimization Problem Ultimate goal:

10 Minimization Problem Ultimate goal:

11 Minimization Problem Ultimate goal: Given a DFA M, construct the DFA with fewest states M such that L(M ) = L(M).

12 Minimization Problem Ultimate goal: Given a DFA M, construct the DFA with fewest states M such that L(M ) = L(M). Intermediate goal: Minimize a given DFA M by merging indistinguishable states.

13 Minimization Problem Ultimate goal: Given a DFA M, construct the DFA with fewest states M such that L(M ) = L(M). Intermediate goal: Minimize a given DFA M by merging indistinguishable states. Applications Algorithms using DFAs run in time directly related to the number of states of DFA. Implementation of the DFA itself takes memory proportional to log number of states. So constructing small DFAs is very critical.

14 Algorithm Step : Remove all unreachable states.

15 Algorithm Step : Remove all unreachable states. * Use DFS o BFS.

16 Algorithm Step : Remove all unreachable states. * Use DFS o BFS. Step 2: Merge similar states.

17 Some possible approaches Want to merge similar states.

18 Some possible approaches Want to merge similar states. Attempt : Focus on what each state remembers/encodes.

19 Some possible approaches Want to merge similar states. Attempt : Focus on what each state remembers/encodes. Seems hard when the DFA is large.

20 Some possible approaches Want to merge similar states. Attempt : Focus on what each state remembers/encodes. Seems hard when the DFA is large. Attempt 2: State Characterization? Two states are indistinguishable if ˆδ(p, w) = ˆδ(q, w) for all strings w.

21 Some possible approaches Want to merge similar states. Attempt : Focus on what each state remembers/encodes. Seems hard when the DFA is large. Attempt 2: State Characterization? Two states are indistinguishable if ˆδ(p, w) = ˆδ(q, w) for all strings w. Seems not strong enough.

22 Distinguishability When must two states p and q of M not be collapsed?

23 Distinguishability When must two states p and q of M not be collapsed? w. ˆδ(p, w) F and ˆδ(q, w) F ; or w. ˆδ(p, w) F and ˆδ(q, w) F

24 Distinguishability When must two states p and q of M not be collapsed? w. ˆδ(p, w) F and ˆδ(q, w) F ; or w. ˆδ(p, w) F and ˆδ(q, w) F We will say that p and q are distinguishable when this happens.

25 Indistinguishability We say that two states p and q of M are indistinguishable/equivalent if w. ˆδ(p, w) F iff ˆδ(q, w) F

26 Indistinguishability We say that two states p and q of M are indistinguishable/equivalent if w. ˆδ(p, w) F iff ˆδ(q, w) F

27 Indistinguishability We say that two states p and q of M are indistinguishable/equivalent if w. ˆδ(p, w) F iff ˆδ(q, w) F

28 Indistinguishability We say that two states p and q of M are indistinguishable/equivalent if w. ˆδ(p, w) F iff ˆδ(q, w) F Indistinguishability defines an equivalence class: A A (reflexivity), A B B A (symmetricity), A B and B C (transivity). So let s use p q to say that two states p and q are indistinguishable.

29 Gradually Refine Indistinguishability Recall p q : w. ˆδ(p, w) F iff ˆδ(q, w) F For each k, define p k q : w with w k. ˆδ(p, w) F iff ˆδ(q, w) F An equivalence class partitions states into disjoint groups. has two groups: Q \ F and F.

30 Gradually Refine Indistinguishability Suppose that we know for each pair of two states p, q if p k q or not. How can we examine if p k+ q or not? If p k q, then we have p k+ q. Each group of states can be only refined! If p k q, then we need to do more work:

31 Gradually Refine Indistinguishability Suppose that we know for each pair of two states p, q if p k q or not. How can we examine if p k+ q or not? If p k q, then we have p k+ q. Each group of states can be only refined! If p k q, then we need to do more work: p k+ q iff a Σ.δ(p, a) k δ(q, a)

32 Gradually Refine Indistinguishability Suppose that we know for each pair of two states p, q if p k q or not. How can we examine if p k+ q or not? If p k q, then we have p k+ q. Each group of states can be only refined! If p k q, then we need to do more work: Do you see why? p k+ q iff a Σ.δ(p, a) k δ(q, a)

33 Gradually Refine Indistinguishability Suppose that we know for each pair of two states p, q if p k q or not. How can we examine if p k+ q or not? If p k q, then we have p k+ q. Each group of states can be only refined! If p k q, then we need to do more work: Do you see why? p k+ q p k+ q iff a Σ.δ(p, a) k δ(q, a) u with u k a Σ.ˆδ(p, au) F iff ˆδ(q, au) F u with u k a Σ.ˆδ(δ(p, a), u) F iff ˆδ(δ(q, a), u) F a Σ u with u k.ˆδ(δ(p, a), u) F iff ˆδ(δ(q, a), u) F a Σ.δ(p, a) k δ(q, a)

34 Distinguishability Inductive Definition Distinguishability can be inductively defined as follows

35 Distinguishability Inductive Definition Distinguishability can be inductively defined as follows If p F and q F then p and q are distinuishable

36 Distinguishability Inductive Definition Distinguishability can be inductively defined as follows If p F and q F then p and q are distinuishable If for some a, δ(p, a) = p and δ(q, a) = q, and p and q are distinguishable, then p and q are distinguishable

37 Distinguishability An Algorithm Let distinct be a table with an entry for each pair of states. Initially all entries are. if p F and q F (or vice versa) then distinct(p, q) := repeat for each pair (p, q) and symbol a if distinct(δ(p, a), δ(q, a)) =, then distinct(p, q) := until no changes in table

38 Minimization Algorithm. Remove states that are not reachable from the initial state

39 Minimization Algorithm. Remove states that are not reachable from the initial state 2. Find all pairs of states that are distinguishable

40 Minimization Algorithm. Remove states that are not reachable from the initial state 2. Find all pairs of states that are distinguishable 3. Collapse pairs that are not distinguishable

41 Example A B C D E H G F

42 Example A B C D E H G F

43 Example B C E F G H A B C E F G A B C E H G F

44 Example B C E F G H A B C E F G A B C E H G F

45 Example B C E F G H A B C E F G A B C E H G F

46 Example B C E F G H A B C E F G A B C E H G F

47 Example : : 2 : 3 : {A, B, E, F, G, H}, {C} {A, E, G}, {B, H}, {F }, {C} {A, E}, {G}, {B, H}, {F }, {C} {A, E}, {G}, {B, H}, {F }, {C} No change from 2 to 3, so stop.

48 Example (2) Remove unreachable states. DFA M

49 Example (2) Remove unreachable states. DFA M

50 Example (2) :

51 Example (2) : {A, B, C}, {D, E}.

52 Example (2) : {A, B, C}, {D, E}. :

53 Example (2) : {A, B, C}, {D, E}. : {A}, {B, C}, {D, E}.

54 Example (2) : {A, B, C}, {D, E}. : {A}, {B, C}, {D, E}. 2 :

55 Example (2) : {A, B, C}, {D, E}. : {A}, {B, C}, {D, E}. 2 : {A}, {B, C}, {D, E}.

56 Optimal Algorithms for Regular Languages : {A, B, C}, {D, E}. : {A}, {B, C}, {D, E}. 2 : {A}, {B, C}, {D, E}.

57 Roadmap DFA minimization: Minimize a given DFA M by merging indistinguishable states (possibly locally optimal) done In DFA minimization, a minimal (locally optimal) DFA is a minimum (globally optimal) DFA. Test if the two given DFAs are equivalent. Revisit Myhill-Nerode Theorem.

58 Decide if two given DFAs accpet the same language We would like to test if two DFAs M = (Q M, Σ M, δ M, q M, F M ) and N = (Q N, Σ N, δ N, q N, F N ) accept the same language or not.

59 Decide if two given DFAs accpet the same language We would like to test if two DFAs M = (Q M, Σ M, δ M, q M, F M ) and N = (Q N, Σ N, δ N, q N, F N ) accept the same language or not.. Run the table-filling algorithm on both DFAs simultaneously.

60 Decide if two given DFAs accpet the same language We would like to test if two DFAs M = (Q M, Σ M, δ M, q M, F M ) and N = (Q N, Σ N, δ N, q N, F N ) accept the same language or not.. Run the table-filling algorithm on both DFAs simultaneously. 2. M and N accept the same language iff q M qn.

61 Table-filling Algorithm Gives a Globally Optimal DFA Very short proof sketch: M = (Q M, Σ M, δ M, q M, F M ): DFA output by the algorithm N = (Q N, Σ N, δ N, q N, F N ): a globally optimal DFA For the sake of contradiction suppose Q N < Q M. Then one can find q M i q M j such that q M i q N t q M j for some q N t Q N.

62 Isomorphism Definition Let M = (Q, Σ, δ, q, F ) and M 2 = (Q 2, Σ, δ 2, q 2, F 2 ) be two DFAs. A function f : Q Q 2 is said to be isomorphism iff f is bijective, i.e., one-to-one and onto f (q ) = q 2 For every p Q and a Σ, f (δ (p, a)) = δ 2 (f (p), a) q F iff f (q) F 2

63 Isomorphism Definition Let M = (Q, Σ, δ, q, F ) and M 2 = (Q 2, Σ, δ 2, q 2, F 2 ) be two DFAs. A function f : Q Q 2 is said to be isomorphism iff f is bijective, i.e., one-to-one and onto f (q ) = q 2 For every p Q and a Σ, f (δ (p, a)) = δ 2 (f (p), a) q F iff f (q) F 2 M and M 2 are said to be isomorphic if there is an isomorphism f from M to M 2.

64 Isomorphism Definition Let M = (Q, Σ, δ, q, F ) and M 2 = (Q 2, Σ, δ 2, q 2, F 2 ) be two DFAs. A function f : Q Q 2 is said to be isomorphism iff f is bijective, i.e., one-to-one and onto f (q ) = q 2 For every p Q and a Σ, f (δ (p, a)) = δ 2 (f (p), a) q F iff f (q) F 2 M and M 2 are said to be isomorphic if there is an isomorphism f from M to M 2. Thus, if M and M 2 are isomorphic then they are the same machine except for possibly renaming states.

65 Myhill-Nerode Theorem implies... Theorem For any regular language L, threre is a unique (upto isomorphism) DFA with fewest states that recognizes L.

CSE 135: Introduction to Theory of Computation Equivalence of DFA and NFA

CSE 135: Introduction to Theory of Computation Equivalence of DFA and NFA CSE 135: Introduction to Theory of Computation Equivalence of DFA and NFA Sungjin Im University of California, Merced 02-03-2015 Expressive Power of NFAs and DFAs Is there a language that is recognized

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Constructions on Finite Automata

Constructions on Finite Automata Constructions on Finite Automata Informatics 2A: Lecture 4 Mary Cryan School of Informatics University of Edinburgh mcryan@inf.ed.ac.uk 24 September 2018 1 / 33 Determinization The subset construction

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

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

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

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

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

Büchi Automata and their closure properties. - Ajith S and Ankit Kumar

Büchi Automata and their closure properties. - Ajith S and Ankit Kumar Büchi Automata and their closure properties - Ajith S and Ankit Kumar Motivation Conventional programs accept input, compute, output result, then terminate Reactive program : not expected to terminate

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

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

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

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

Introduction to Formal Languages, Automata and Computability p.1/51

Introduction to Formal Languages, Automata and Computability p.1/51 Introduction to Formal Languages, Automata and Computability Finite State Automata K. Krithivasan and R. Rama Introduction to Formal Languages, Automata and Computability p.1/51 Introduction As another

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

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

Finite State Automata

Finite State Automata Trento 2005 p. 1/4 Finite State Automata Automata: Theory and Practice Paritosh K. Pandya (TIFR, Mumbai, India) Unversity of Trento 10-24 May 2005 Trento 2005 p. 2/4 Finite Word Langauges Alphabet Σ is

More information

Constructions on Finite Automata

Constructions on Finite Automata Constructions on Finite Automata Informatics 2A: Lecture 4 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 23rd September, 2014 1 / 29 1 Closure properties of regular languages

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

2. Elements of the Theory of Computation, Lewis and Papadimitrou,

2. Elements of the Theory of Computation, Lewis and Papadimitrou, Introduction Finite Automata DFA, regular languages Nondeterminism, NFA, subset construction Regular Epressions Synta, Semantics Relationship to regular languages Properties of regular languages Pumping

More information

Deterministic finite Automata

Deterministic finite Automata Deterministic finite Automata Informatics 2A: Lecture 3 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 21 September, 212 1 / 29 1 Languages and Finite State Machines What is

More information

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

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

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

Finite Automata - Deterministic Finite Automata. Deterministic Finite Automaton (DFA) (or Finite State Machine)

Finite Automata - Deterministic Finite Automata. Deterministic Finite Automaton (DFA) (or Finite State Machine) Finite Automata - Deterministic Finite Automata Deterministic Finite Automaton (DFA) (or Finite State Machine) M = (K, Σ, δ, s, A), where K is a finite set of states Σ is an input alphabet s K is a distinguished

More information

Equivalence. See section 4.4 of the text

Equivalence. See section 4.4 of the text Equivalence See section 4.4 of the text Our algorithm for converting a regular expression into a DFA produces a correct but overly complex automaton. We will now look at some technique for simplifying

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

Finite Automata. Seungjin Choi

Finite Automata. Seungjin Choi Finite Automata Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr 1 / 28 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

Regular expressions and Kleene s theorem

Regular expressions and Kleene s theorem Regular expressions and Kleene s theorem Informatics 2A: Lecture 5 Mary Cryan School of Informatics University of Edinburgh mcryan@inf.ed.ac.uk 26 September 2018 1 / 18 Finishing DFA minimization An algorithm

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

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

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

DD2371 Automata Theory

DD2371 Automata Theory KTH CSC VT 2008 DD2371 Automata Theory Dilian Gurov Lecture Outline 1. The lecturer 2. Introduction to automata theory 3. Course syllabus 4. Course objectives 5. Course organization 6. First definitions

More information

1 Showing Recognizability

1 Showing Recognizability CSCC63 Worksheet Recognizability and Decidability 1 1 Showing Recognizability 1.1 An Example - take 1 Let Σ be an alphabet. L = { M M is a T M and L(M) }, i.e., that M accepts some string from Σ. Prove

More information

CMPSCI 250: Introduction to Computation. Lecture #32: The Myhill-Nerode Theorem David Mix Barrington 11 April 2014

CMPSCI 250: Introduction to Computation. Lecture #32: The Myhill-Nerode Theorem David Mix Barrington 11 April 2014 CMPSCI 250: Introduction to Computation Lecture #32: The Myhill-Nerode Theorem David Mix Barrington 11 April 2014 The Myhill-Nerode Theorem Review: L-Distinguishable Strings The Language Prime has no DFA

More information

ACS2: Decidability Decidability

ACS2: Decidability Decidability Decidability Bernhard Nebel and Christian Becker-Asano 1 Overview An investigation into the solvable/decidable Decidable languages The halting problem (undecidable) 2 Decidable problems? Acceptance problem

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

NPDA, CFG equivalence

NPDA, CFG equivalence NPDA, CFG equivalence Theorem A language L is recognized by a NPDA iff L is described by a CFG. Must prove two directions: ( ) L is recognized by a NPDA implies L is described by a CFG. ( ) L is described

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 4.1, 5.1 Define reductions from one problem to another. Use reductions to prove

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

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

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

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

2. Syntactic Congruences and Monoids

2. Syntactic Congruences and Monoids IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 3: Algebra and Languages David Mix Barrington and Alexis Maciel July 19, 2000 1.

More information

Finite Automata. Theorems - Unit I SUSAN ELIAS. Professor Department of Computer Science & Engineering Sri Venkateswara College of Engineering

Finite Automata. Theorems - Unit I SUSAN ELIAS. Professor Department of Computer Science & Engineering Sri Venkateswara College of Engineering Finite Automata Theorems - Unit I SUSAN ELIAS Professor Department of Computer Science & Engineering Sri Venkateswara College of Engineering September 17, 2012 Unit I - Guidelines Formal Definitions Definition

More information

arxiv:cs/ v1 [cs.cc] 9 Feb 2007

arxiv:cs/ v1 [cs.cc] 9 Feb 2007 The DFAs of Finitely Different Languages Andrew Badr Ian Shipman February 1, 2008 arxiv:cs/0702053v1 [cs.cc] 9 Feb 2007 Abstract Two languages are finitely different if their symmetric difference is finite.

More information

Equivalence. See section 4.4 of the text

Equivalence. See section 4.4 of the text Equivalence See section 4.4 of the text Our algorithm for converting a regular expression into a DFA produces a correct but overly complex automaton. We will now look at some technique for simplifying

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2018 http://cseweb.ucsd.edu/classes/sp18/cse105-ab/ Today's learning goals Sipser Ch 5.1, 5.3 Define and explain core examples of computational problems, including

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 6 CHAPTER 2 FINITE AUTOMATA 2. Nondeterministic Finite Automata NFA 3. Finite Automata and Regular Expressions 4. Languages

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

DM17. Beregnelighed. Jacob Aae Mikkelsen

DM17. Beregnelighed. Jacob Aae Mikkelsen DM17 Beregnelighed Jacob Aae Mikkelsen January 12, 2007 CONTENTS Contents 1 Introduction 2 1.1 Operations with languages...................... 2 2 Finite Automata 3 2.1 Regular expressions/languages....................

More information

Undecidable Problems and Reducibility

Undecidable Problems and Reducibility University of Georgia Fall 2014 Reducibility We show a problem decidable/undecidable by reducing it to another problem. One type of reduction: mapping reduction. Definition Let A, B be languages over Σ.

More information

Decidability and Undecidability

Decidability and Undecidability Decidability and Undecidability Major Ideas from Last Time Every TM can be converted into a string representation of itself. The encoding of M is denoted M. The universal Turing machine U TM accepts an

More information

Chapter Two: Finite Automata

Chapter Two: Finite Automata Chapter Two: Finite Automata In theoretical computer science, automata theory is the study of abstract machines (or more appropriately, abstract 'mathematical' machines or systems) and the computational

More information

Computational Models - Lecture 4 1

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

More information

Inf2A: The Pumping Lemma

Inf2A: The Pumping Lemma Inf2A: Stuart Anderson School of Informatics University of Edinburgh October 8, 2009 Outline 1 Deterministic Finite State Machines and Regular Languages 2 3 4 The language of a DFA ( M = Q, Σ, q 0, F,

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

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

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

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

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

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

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata.

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata. Finite Automata Automata (singular: automation) are a particularly simple, but useful, model of computation. They were initially proposed as a simple model for the behavior of neurons. The concept of a

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

Theory of Computation Thomas Zeugmann Hokkaido University Laboratory for Algorithmics http://www-alg.ist.hokudai.ac.jp/ thomas/toc/ Lecture 3: Finite State Automata Motivation In the previous lecture we learned how to formalize

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

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

(pp ) PDAs and CFGs (Sec. 2.2)

(pp ) PDAs and CFGs (Sec. 2.2) (pp. 117-124) PDAs and CFGs (Sec. 2.2) A language is context free iff all strings in L can be generated by some context free grammar Theorem 2.20: L is Context Free iff a PDA accepts it I.e. if L is context

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

0.1 Minimizing Finite State Machines

0.1 Minimizing Finite State Machines .. MINIMIZING FINITE STATE MACHINES. Minimizing Finite State Machines Here we discuss the problem of minimizing the number of states of a DFA. We will show that for any regular language L, thereisaunique

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

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

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

2017/08/29 Chapter 1.2 in Sipser Ø Announcement:

2017/08/29 Chapter 1.2 in Sipser Ø Announcement: Nondeterministic Human-aware Finite Robo.cs Automata 2017/08/29 Chapter 1.2 in Sipser Ø Announcement: q Piazza registration: http://piazza.com/asu/fall2017/cse355 q First poll will be posted on Piazza

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

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

DISTINGUISHABILITY AND COMPLETENESS OF CRISP DETERMINISTIC FUZZY AUTOMATA

DISTINGUISHABILITY AND COMPLETENESS OF CRISP DETERMINISTIC FUZZY AUTOMATA Iranian Journal of Fuzzy Systems Vol. 14, No. 5, (2017) pp. 19-30 19 DISTINGUISHABILITY AND COMPLETENESS OF CRISP DETERMINISTIC FUZZY AUTOMATA R. VERMA AND S. P. TIWARI Abstract. In this paper, we introduce

More information

Chapter 6: NFA Applications

Chapter 6: NFA Applications Chapter 6: NFA Applications Implementing NFAs The problem with implementing NFAs is that, being nondeterministic, they define a more complex computational procedure for testing language membership. To

More information

Two Way Deterministic Finite Automata

Two Way Deterministic Finite Automata Two Way Deterministic Finite Automata Jagvir Singh and Pavan Kumar Akulakrishna Indian Institute of Science November 29, 2013 Jagvir Singh and Pavan Kumar Akulakrishna (IISC) 2DFA November 29, 2013 1 /

More information

Homework Assignment 6 Answers

Homework Assignment 6 Answers Homework Assignment 6 Answers CSCI 2670 Introduction to Theory of Computing, Fall 2016 December 2, 2016 This homework assignment is about Turing machines, decidable languages, Turing recognizable languages,

More information

Inf2A: Converting from NFAs to DFAs and Closure Properties

Inf2A: Converting from NFAs to DFAs and Closure Properties 1/43 Inf2A: Converting from NFAs to DFAs and Stuart Anderson School of Informatics University of Edinburgh October 13, 2009 Starter Questions 2/43 1 Can you devise a way of testing for any FSM M whether

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