1 Lecture 20 LNFA subset of LFSA –Theorem 4.1 on page 105 of Martin textbook –Compare with set closure proofs Main idea –A state in FSA represents a set.

Slides:



Advertisements
Similar presentations
CSC 361NFA vs. DFA1. CSC 361NFA vs. DFA2 NFAs vs. DFAs NFAs can be constructed from DFAs using transitions: Called NFA- Suppose M 1 accepts L 1, M 2 accepts.
Advertisements

Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
1 Lecture 32 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union,
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
1 Module 20 NFA’s with -transitions –NFA- ’s Formal definition Simplifies construction –LNFA- –Showing LNFA  is a subset of LNFA (extra credit) and therefore.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
1 Lecture 22 Myhill-Nerode Theorem –distinguishability –equivalence classes of strings –designing FSA’s –proving a language L is not regular.
1 Module 15 FSA’s –Defining FSA’s –Computing with FSA’s Defining L(M) –Defining language class LFSA –Comparing LFSA to set of solvable languages (REC)
1 Lecture 14 Language class LFSA –Study limits of what can be done with FSA’s –Closure Properties –Comparing to other language classes.
1 Module 19 LNFA subset of LFSA –Theorem 4.1 on page 131 of Martin textbook –Compare with set closure proofs Main idea –A state in FSA represents a set.
Lecture 8 Recursively enumerable (r.e.) languages
1 Lecture 21 Regular languages review –Several ways to define regular languages –Two main types of proofs/algorithms Relative power of two computational.
1 Module 21 Closure Properties for LFSA using NFA’s –From now on, when I say NFA, I mean any NFA including an NFA- unless I add a specific restriction.
Why the algorithm works! Converting an NFA into an FSA.
1 Module 16 Distinguishability –Definition –Help in designing/debugging FSA’s.
1 Lecture 13 FSA’s –Defining FSA’s –Computing with FSA’s Defining L(M) –Defining language class LFSA.
1 Lecture 20 Regular languages are a subset of LFSA –algorithm for converting any regular expression into an equivalent NFA –Builds on existing algorithms.
1 Lecture 26 Decision problems about regular languages –Basic problems are solvable halting, accepting, and emptiness problems –Solvability of other problems.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
1 Lecture 16 FSA’s –Defining FSA’s –Computing with FSA’s Defining L(M) –Defining language class LFSA –Comparing LFSA to set of solvable languages (REC)
1 Module 18 NFA’s –nondeterministic transition functions computations are trees, not paths –L(M) and LNFA LFSA subset of LNFA –Comparing computational.
Lecture 18 NFA’s with -transitions –NFA- ’s Formal definition Simplifies construction –LNFA- –Showing LNFA  is a subset of LNFA and therefore a subset.
1 Lecture 16 FSA’s –Defining FSA’s –Computing with FSA’s Defining L(M) –Defining language class LFSA –Comparing LFSA to set of solvable languages (REC)
1 Lecture 18 Closure Properties of Language class LFSA –Remember ideas used in solvable languages unit –Set complement –Set intersection, union, difference,
LING 438/538 Computational Linguistics Sandiway Fong Lecture 12: 10/5.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
79 Regular Expression Regular expressions over an alphabet  are defined recursively as follows. (1) Ø, which denotes the empty set, is a regular expression.
1 Lecture 15 Distinguishability –Definition –Help in designing/debugging FSA’s NFA’s –nondeterministic transition functions computations are trees, not.
1 Lecture 36 Attempt to prove that CFL’s are closed under intersection –Review previous constructions –Translate previous constructions to current setting.
1 Module 31 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union, concatenation.
1 Lecture 16 NFA’s –nondeterministic transition functions computations are trees, not paths –L(M) and LNFA LFSA subset of LNFA –Comparing computational.
1 Lecture 23 Decision problems about regular languages –Programs can be inputs to other programs FSA’s, NFA’s, regular expressions –Basic problems are.
1 Module 25 Decision problems about regular languages –Basic problems are solvable halting, accepting, and emptiness problems –Solvability of other problems.
1 Lecture 19 Closure Properties for LFSA using NFA’s –union second proof –concatenation –Kleene closure.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
NFA- to NFA conversion. Purpose This presentation presents an example execution of the algorithm which takes as input an NFA with -transitions and produces.
Converting an NFA into an FSA Proving LNFA is a subset of LFSA.
1 Module 11 Proving more specific problems are not solvable Input transformation technique –Use subroutine theme to show that if one problem is unsolvable,
Lecture 4UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 4.
Why the algorithm works! Converting an NFA into an FSA.
1 Module 24 Myhill-Nerode Theorem –distinguishability –equivalence classes of strings –designing FSA’s –proving a language L is not regular.
1 Regular Expressions/Languages Regular languages –Inductive definitions –Regular expressions syntax semantics Not covered in lecture.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
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 language,
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
1 Module 14 Regular languages –Inductive definitions –Regular expressions syntax semantics.
1 Module 31 Closure Properties for CFL’s –Kleene Closure –Union –Concatenation CFL’s versus regular languages –regular languages subset of CFL.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
Lecture # 12. Nondeterministic Finite Automaton (NFA) Definition: An NFA is a TG with a unique start state and a property of having single letter as label.
Chapter 6 Properties of Regular Languages. 2 Regular Sets and Languages  Claim(1). The family of languages accepted by FSAs consists of precisely the.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
1 Module 12 Computation and Configurations –Formal Definition –Examples.
Mathematical Foundations of Computer Science Chapter 3: Regular Languages and Regular Grammars.
1 Module 17 Closure Properties of Language class LFSA –Remember ideas used in solvable languages unit –Set complement –Set intersection, union, difference,
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 Module 12 Computation and Configurations –Formal Definition –Examples.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
Regular Languages, Regular Operations, Closure
Hierarchy of languages
COSC 3340: Introduction to Theory of Computation
Instructor: Aaron Roth
Chapter 1 Regular Language
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 19 NFA corresponding to Closure of FA, Examples, Memory required to recognize a language, Example, Distinguishing one string from another,
Nondeterministic Finite State Automata (Dr. Torng)
COSC 3340: Introduction to Theory of Computation
Finite Automata Part Three
Presentation transcript:

1 Lecture 20 LNFA subset of LFSA –Theorem 4.1 on page 105 of Martin textbook –Compare with set closure proofs Main idea –A state in FSA represents a set of states in original NFA

2 LNFA subset LFSA Let L be an arbitrary language in LNFA Let M be the NFA such that L(M) = L –M exists by definition of L in LNFA Construct an FSA M’ such that L(M’) = L Argue L(M’) = L There exists an FSA M’ such that L(M’) = L L is in LFSA –By definition of L in LFSA

3 Visualization LNFA LFSA NFA’s FSA’s L L M M’ Let L be an arbitrary language in LNFA Let M be an NFA such that L(M) = L M exists by definition of L in LNFA Construct FSA M’ from NFA M Argue L(M’) = L There exists an FSA M’ such that L(M’) = L L is in LFSA

4 Comparison L 1 intersect L 2 L1L1 L2L2 LFSA M3M3 M1M1 M2M2 FSA’s LNFA LFSA NFA’s FSA’s L L M M’

5 Construction Specification We need an algorithm which does the following –Input: NFA M –Output: FSA M’ such that L(M’) = L(M)

6 An NFA can be in several states after processing an input string x –Example The given NFA can be in states {1,2,3} after processing string aa Difficulty aaab a,b Input string aaaaba (1, aaaaba) (1, aaaba)(2, aaaba) (1, aaba)(2, aaba)(3, aaba) (1, aba)(2, aba)(3, aba)crash (1, ba)(2, ba)(3, ba) (1, a)(4, a) (1, )(2, )(5, )

7 All strings which end up in the set of states {1,2,3} are indistinguishable with respect to L(M) –Example Strings aa, aaa, aaaa all end up in the same set of states {1,2,3} For all strings z, if aaz is in L(M), then aaaz and aaaaz are also in L(M) Observation aaab a,b Input string aaaaba (1, aaaaba) (1, aaaba)(2, aaaba) (1, aaba)(2, aaba)(3, aaba) (1, aba)(2, aba)(3, aba)crash (1, ba)(2, ba)(3, ba) (1, a)(4, a) (1, )(2, )(5, )

8 Given an NFA M = (Q, ,q 0, ,A), the equivalent FSA M’ should have one state for each subset of Q Example –In this case there are 5 states in Q –There are 2 5 subsets of Q including {} and Q –The FSA M’ will have 2 5 states What strings end up in state {1,2,3} of M’? –The strings which end up in states 1, 2, and 3 of NFA M. –In this case, strings which do not contain aaba and end with aa such as aa, aaa, and aaaa. Idea aaab a,b Input string aaaaba

9 Idea Illustrated aaab a,b Input string aaaaba (1,aaaaba)({1}, aaaaba) (1, aaaba)(2, aaaba)({1,2}, aaaba) (1, aaba)(2, aaba)(3, aaba) ({1,2,3}, aaba) (1, aba)(2, aba)(3, aba)({1,2,3}, aba) (1, ba)(2, ba)(3, ba)({1,2,3}, ba) (1, a)(4, a) ({1,4}, a) ({1,2,5}, ) (1, )(2, )(5, )

10 Construction Input NFA M = (Q, , q 0, , A) Output FSA M’ = (Q’,  ’, q’,  ’, A’) –What is Q’? all subsets of Q including Q and {} In this case, Q’ = {{}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} –What is  ’? We always make  ’ =  In this case,  ’ =  = {a,b} –What is q’? We always make q’ = {q 0 } In this case q’ = {1} a,b aa NFA M 1 23

11 Construction Input NFA M = (Q, , q 0, , A) Output FSA M’ = (Q’,  ’, q’,  ’, A’) –What is A’? Suppose a string x ends up in states 1 and 2 of the NFA M above. –Is x accepted by M? »No, neither 1 nor 2 are in A. –Should {1,2} be an accepting state in FSA M’? »No, {1,2} should not be in A’ Suppose a string x ends up in states 1 and 2 and 3 of the NFA M above. –Is x accepted by M? »Yes, because state 3 is in A. –Should {1,2,3} be an accepting state in FSA M’? »Yes, {1,2,3} should be in A’. Suppose p = {q 1, q 2, …, q k } where q 1, q 2, …, q k are in Q p is in A’ iff at least one of the states q 1, q 2, …, q k is in A In this case, A’ = {{3},{1,3},{2,3},{1,2,3}} a,b aa NFA M 1 23

12 Construction Input NFA M = (Q, , q 0, , A) Output FSA M’ = (Q’,  ’, q’,  ’, A’) –What is  ’? If string x ends up in states 1 and 2 after being processed by the NFA above, where does string xa end up after being processed by the NFA above? –From state 1, the a will take the NFA to states 1 and 2 –From state 2, the a will take the NFA to state 3 Figuring out  ’(p,a) in general –Suppose p = {q 1, q 2, …, q k } where q 1, q 2, …, q k are in Q –Then  ’(p,a) =  (q 1,a) union  (q 2,a) union … union  (q k,a) »Similar to 2 FSA to 1 FSA construction –In this case »  ’({1,2},a) =  (1,a) union  (2,a) » = {1,2} union {3} » = {1,2,3} a,b aa NFA M 1 23

13 Construction Summary Input NFA M = (Q, , q 0, , A) Output FSA M’ = (Q’,  ’, q’,  ’, A’) –Q’ = all subsets of Q including Q and {} In this case, Q’ = {{}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} –  ’ =  In this case,  ’ =  = {a,b} –q’ ={q 0 } In this case, q’ = {1} –A’ Suppose p = {q 1, q 2, …, q k } where q 1, q 2, …, q k are in Q p is in A’ iff at least one of the states q 1, q 2, …, q k is in A –  ’ Suppose p = {q 1, q 2, …, q k } where q 1, q 2, …, q k are in Q Then  ’(p,a) =  (q 1,a) union  (q 2,a) union … union  (q k,a) a,b aa NFA M 1 23

14 Example Summary a,b aa NFA M 1 23 {1}{1,2}{1,2,3}{1,3} {}{2}{3}{2,3} a,b a a a a a b b b b b FSA M’

15 Example Summary Continued a,b aa NFA M 1 23 {1}{1,2}{1,2,3}{1,3} {}{2}{3}{2,3} a,b a a a a a b b b b b FSA M’ These states cannot be reached from initial state and are unnecessary.

16 Example Summary Continued a,b aa NFA M 1 23 {1}{1,2}{1,2,3}{1,3} a a a a b b b b Smaller FSA M’ By examination, we can see that state {1,3} is unnecessary. However, this is a case by case optimization. It is not a general technique or algorithm.

17 Example 2 a,b ab Step 1: name the three states of NFA M ABC NFA M

18 Step 2: transition table a,b ab ABC NFA M {A}{B}{} ab {B}{B,C}{B} {} {B,C}{B}{B,C}  ’({B,C},a) =  (B,a) U  (C,a) = {B} U {} = {B}  ’({B,C},b) =  (B,b) U  (C,b) = {B,C} U {} = {B,C}

19 Step 3: accepting states a,b ab ABC NFA M {A}{B}{} ab {B} {B,C} {} {B,C}{B}{B,C} Which states should be accepting? Any state which includes an accepting state of M, in this case, C. A’ = {{B,C}}

20 Step 4: Answer a,b ab ABC NFA M Initial state is {A} Set of final states A’ = {{B,C}} {A}{B}{} ab {B} {B,C} {} {B,C}{B}{B,C} This is sufficient. You do NOT need to turn this into a diagram.

21 Step 5: Optional a,b ab ABC NFA M a ab {A}{B}{B,C} b a a,b {} b FSA M’

22 Comments You should be able to execute this algorithm –You should be able to convert any NFA into an equivalent FSA. You should understand the idea behind this algorithm –For an FSA M’, strings which end up in the same state of M’ are indistinguishable wrt L(M’) –For an NFA M, strings which end up in the same set of states of M are indistinguishable wrt L(M)

23 Comments You should understand the importance of this algorithm –Design tool We can design using NFA’s A computer will convert this NFA into an equivalent FSA –FSA’s can be executed by computers whereas NFA’s cannot (or at least cannot easily be run by computers) –Chaining together algorithms Perhaps it is easy to build NFA’s to accept L 1 and L 2 Use this algorithm to turn these NFA’s to FSA’s Use previous algorithm to build FSA to accept L 1 intersect L 2 You should be able to construct new algorithms for new closure property proofs