MA/CSSE 474 Theory of Computation Minimizing DFSMs.

Slides:



Advertisements
Similar presentations
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Advertisements

1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
1 Lecture 22 Myhill-Nerode Theorem –distinguishability –equivalence classes of strings –designing FSA’s –proving a language L is not regular.
1 Module 16 Distinguishability –Definition –Help in designing/debugging FSA’s.
Strings and Languages Operations
Regular Expression (EXTRA)
1 Lecture 15 Distinguishability –Definition –Help in designing/debugging FSA’s NFA’s –nondeterministic transition functions computations are trees, not.
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
MA/CSSE 474 Theory of Computation
1 Module 24 Myhill-Nerode Theorem –distinguishability –equivalence classes of strings –designing FSA’s –proving a language L is not regular.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Formal Methods in SE Theory of Automata Qasiar Javaid Assistant Professor Lecture # 06.
1 Language Definitions Lecture # 2. Defining Languages The languages can be defined in different ways, such as Descriptive definition, Recursive definition,
MA/CSSE 474 Theory of Computation DFSM Canonical Form Proof of NDFSM  DFSM ALGORITHM (as much as we have time for) This version includes the "answers"
Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided by author Slides edited for.
1 Chapter 1 Introduction to the Theory of Computation.
Module 2 How to design Computer Language Huma Ayub Software Construction Lecture 8.
L ECTURE 3 Chapter 4 Regular Expressions. I MPORTANT T ERMS Regular Expressions Regular Languages Finite Representations.
Discrete Structures Li Tak Sing( 李德成 ) Lecture note 2 1.
Computability Review homework. Regular Operations. Nondeterministic machines. NFSM = FSM Homework: By hand, build FSM version of specific NFSM. Try to.
MA/CSSE 474 Theory of Computation Regular Expressions Intro.
Regular Expressions and Languages A regular expression is a notation to represent languages, i.e. a set of strings, where the set is either finite or contains.
Regular Expressions Chapter 6 1. Regular Languages Regular Language Regular Expression Finite State Machine L Accepts 2.
UNIT - 2.  A binary operation on a set combines two elements of the set to produce another element of the set. a*b  G,  a, b  G e.g. +, -, ,  are.
Regular Expressions Chapter 6. Regular Languages Regular Language Regular Expression Finite State Machine L Accepts.
1 Closure Properties of Regular Languages L 1 and L 2 are regular. How about L 1  L 2, L 1  L 2, L 1 L 2, L 1, L 1 * ?
CS 203: Introduction to Formal Languages and Automata
MA/CSSE 474 Theory of Computation Minimizing DFSMs.
Lecture # 4.
Lecture 6: Context-Free Languages
Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
Lecture 02: Theory of Automata:2014 Asif Nawaz Theory of Automata.
Lecture 03: Theory of Automata:2014 Asif Nawaz Theory of Automata.
MA/CSSE 474 Theory of Computation How many regular/non-regular languages are there? Closure properties of Regular Languages (if there is time) Pumping.
MA/CSSE 474 Theory of Computation Decision Problems, Continued DFSMs.
1 Advanced Theory of Computation Finite Automata with output Pumping Lemma Theorem.
MA/CSSE 474 Theory of Computation Regular Expressions Intro.
Regular Expression (EXTRA)
Pumping Lemma.
Theory of Computation Lecture #
Regular Languages, Regular Operations, Closure
More on showing L non-regular
Properties of Regular Languages
Regular Expressions (Examples)
CSE 3813 Introduction to Formal Languages and Automata
MA/CSSE 474 Decision Problems about Regular Languages
Hierarchy of languages
Recap lecture 29 Example of prefixes of a language, Theorem: pref(Q in R) is regular, proof, example, Decidablity, deciding whether two languages are equivalent.
Properties of Regular Languages
Pumping Lemma.
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation
Recap lecture 26 Example of nonregular language, pumping lemma version I, proof, examples,
Instructor: Aaron Roth
Instructor: Aaron Roth
Pushdown Automata (PDA) Part 2
MA/CSSE 474 Theory of Computation Nondeterminism NFSMs.
More on showing L non-regular
Instructor: Aaron Roth
MA/CSSE 474 Theory of Computation
MA/CSSE 474 DFSM to RE Theory of Computation
Chapter 1 Introduction to the Theory of Computation
Recap lecture 18 NFA corresponding to union of FAs,example, NFA corresponding to concatenation of FAs,examples, NFA corresponding to closure of an FA,examples.
Recap lecture 25 Intersection of two regular languages is regular, examples, non regular languages, example.
Minimize # states in a DFSM
Turing -Recognizable vs. -Decidable
More About Nondeterminism
CSC312 Automata Theory Lecture # 3 Languages-II.
Recap Lecture 3 RE, Recursive definition of RE, defining languages by RE, { x}*, { x}+, {a+b}*, Language of strings having exactly one aa, Language of.
THEORY OF COMPUTATION 06 NUMBER OF STATES.
Presentation transcript:

MA/CSSE 474 Theory of Computation Minimizing DFSMs

Your Questions? Previous class days' material Reading Assignments HW4 or HW5 problems Tuesday's Exam Anything else Computer science Heap (data structure), a data structure commonly used to implement a priority queue Heap (programming) (or free store), an area of memory used for dynamic memory allocation Even in the relatively narrow area of Computer science, the term "Heap" is ambiguous. From Wikipedia:

Recap: Equivalent Strings (w.r.t. L) We say that two strings x and y are equivalent or indistinguishable with respect to a language L if, no matter what string z is appended to both, either both concatenated strings will be in L or neither will. Write it in first-order logic: x L y iff z  * (xz  L iff yz  L). We are heading toward trying to find a minimal state DFSM that is equivalent to a given DFSM. We define an equivalence relation on a pair of strings, with respect to a language L. x L y iff z  * (xz  L iff yz  L). Why is this the right notion? We'll see that it corresponds naturally to what the states of a recognizing FSM have to remember. Recall that x L y iff z  * (xz  L ↔ yz  L).

Another Example of L  = {a, b} L = {w  * : |w| is even}  bb aabb a aba bbaa b aab aabaa aa bbb baa The equivalence classes of L: Recall that x L y iff z  * (xz  L ↔ yz  L).

Yet Another Example of L Do this one for practice later  = {a, b} L = aab*a  bb aabaa a aba aabbba b aab aabbaa aa baa aabb The equivalence classes of L: Recall that x L y iff z  * (xz  L ↔ yz  L).

More Than One Class Can Contain Strings in L  = {a, b} L = {w  * : no two adjacent characters are the same} The equivalence classes of L: [1] [] [2] [a, aba, ababa, …] [3] [b, ab, bab, abab, …] [4] [aa, abaa, ababb…] Recall that x L y iff z  * (xz  L ↔ yz  L).

One More Example of L  = {a, b} L = {anbn, n  0}  aa aaaa a aba aaaaa b aaa The equivalence classes of L: Note that there are infinitely many classes. And this language is not regular. Recall that x L y iff z  * (xz  L ↔ yz  L).

The Best We Can Do Theorem: Let L be a regular language and let M be a DFSM that accepts L. The number of states in M is greater than or equal to the number of equivalence classes of L. Proof: Suppose that the number of states in M were less than the number of equivalence classes of L. Then, by the pigeonhole principle, there must be at least one state q that contains strings from at least two equivalence classes of L. But then M’s future behavior on those strings will be identical, which is not consistent with the fact that they are in different equivalence classes of L.

The Best Is Unique Theorem: Let L be a regular language over some alphabet . Then there is a DFSM M with L(M)=L and that has precisely n states where n is the number of equivalence classes of L. Any other FSM that accepts L must either have more states than M or it must be equivalent to M except for state names. Proof: (by construction) M = (K, , , s, A), where: ● K contains n states, one for each equivalence class of L. ● s = [], the equivalence class under L that contains . ● A = {[x] : x  L}. ● ([x], a) = [xa]. In other words, if M is in the state that contains some string x, then, after reading the next symbol, a, M will go to the state that contains xa.

Construct DFSM from L M = (K, , , s, A), where: ● K contains one state for each equivalence class of L. ● s = [], the equivalence class of  under L. ● A = {[x] : x  L}. [Aside: what is the union of all of these classes?] ● ([x], a) = [xa]. (if M is in state containing x, then, after reading the next symbol, a, it goes to state containing xa). Need to show: K is finite. L regular → |K| ≤ #states of any M that accepts L, which is finite.  is a well-defined function*. i.e. ∀x,y∊Σ*,a∊Σ ([x]=[y] → [xa]=[ya]) L = L(M). Before we prove this, we first show this lemma:  lemma: r,t∊ Σ*( ([], rt) ⊦M* ([r], t)). We prove it by induction on |r|. * work with another student to prove this Prove the contrapositive: If [xa] ≠ [ya], then there is a string z that distinguishes them, i.e (WLOG) xaz ∊ L and yaz ∉ L. If we rewrite these as x(az) and y(az), then az distinguishers x and y, so [x] ≠ [y]. Not much to do for the base case!

Proof, Continued A smaller machine M# that also accepts L does not exist. Proof: This follows directly from our previous Theorem, which says that the number of equivalence classes of L is a lower bound on the number of states in any DFSM that accepts L. A different machine M# that also has n states and that accepts L does not exist. Proof: See p88 in the textbook if you are interested. It is straightforward but tedious, so due to lack of time we will not do it in class.

Example  = {a, b} L = {w  * : no two adjacent characters are the same} The equivalence classes of L: 1: []  2: [a, ba, aba, baba, ababa, ...] (b)(ab)*a 3: [b, ab, bab, abab, ...] (a)(ba)*b 4: [bb, aa, bba, bbb, ...] the rest ● Equivalence classes become states ● Start state is [] ● Accepting states are all equivalence classes in L ● ([x], a) = [xa]