Automata and Formal Languages Tim Sheard 1 Lecture 9 Reasoning with DFAs.

Slides:



Advertisements
Similar presentations
CS2303-THEORY OF COMPUTATION Closure Properties of Regular Languages
Advertisements

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.
Properties of Regular Languages
8/27/2009 Sofya Raskhodnikova Intro to Theory of Computation L ECTURE 2 Theory of Computation Finite Automata Operations on languages Nondeterminism L2.1.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
Introduction to Computability Theory
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
Costas Busch - RPI1 Single Final State for NFAs. Costas Busch - RPI2 Any NFA can be converted to an equivalent NFA with a single final state.
CS 310 – Fall 2006 Pacific University CS310 Converting NFA to DFA Sections:1.2 Page 54 September 15, 2006.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata (cont.) Prof. Amos Israeli.
1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
Lecture 3: Closure Properties & Regular Expressions Jim Hook Tim Sheard Portland State University.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
1 Languages and Finite Automata or how to talk to machines...
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
Lecture 7 Sept 22, 2011 Goals: closure properties regular expressions.
1 NFAs accept the Regular Languages. 2 Equivalence of Machines Definition: Machine is equivalent to machine if.
Fall 2006Costas Busch - RPI1 Properties of Regular Languages.
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.
Courtesy Costas Busch - RPI1 Non-regular languages.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
Finite Automata Costas Busch - RPI.
Lecture 4UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 4.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
NFA Closure Properties. NFAs also have closure properties We have given constructions for showing that DFAs are closed under 1.Complement 2.Intersection.
NFA Closure Properties Sipser pages pages NFAs also have closure properties We have given constructions for showing that DFAs are closed under.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
1 Let L= { w= u v : u  {a, b}*, v  {c, d}* and |u|= |v|} 1.Design a context-free grammar that generates L. 2.Use your grammar and the construction from.
1 State SymbolRead- Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
Lecture 5 Sept 06, 2012 Regular expressions – examples Converting DFA to regular expression. (same works for NFA to r.e. conversion.) Converting R.E. to.
Strings and Languages CS 130: Theory of Computation HMU textbook, Chapter 1 (Sec 1.5)
Class Discussion Can you draw a DFA that accepts the language {a k b k | k = 0,1,2,…} over the alphabet  ={a,b}?
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
CS 203: Introduction to Formal Languages and Automata
Regular Language Algorithms. Algorithms We have seen many algorithms for manipulating computational systems for the regular languages. Each treats these.
Strings and Languages Denning, Section 2.7. Alphabet An alphabet V is a finite nonempty set of symbols. Each symbol is a non- divisible or atomic object.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
1 Closure E.g., we understand number systems partly by understanding closure properties: Naturals are closed under +, , but not -, . Integers are closed.
Dept. of Computer Science & IT, FUUAST Automata Theory 2 Automata Theory III Properties of Regular Languages 1.Closure 2.Union 3.Concatenation 4.Complement(Negation)
1 Use the pumping theorem for context-free languages to prove that L= { a n b a n b a p : n, p ≥ 0, p ≥ n } is not context-free. Hint: For the pumping.
Lecture 15: Theory of Automata:2014 Finite Automata with Output.
Languages.
Properties of Regular Languages
Formal Language & Automata Theory
Single Final State for NFA
CSE322 PROPERTIES OF REGULAR LANGUAGES
Properties of Regular Languages
CS 154, Lecture 3: DFANFA, Regular Expressions.
Closure Properties of DFAs
COSC 3340: Introduction to Theory of Computation
CSE322 CONSTRUCTION OF FINITE AUTOMATA EQUIVALENT TO REGULAR EXPRESSION Lecture #9.
Closure Properties of Context-Free languages
Closure Properties of Regular Languages
Properties of Context-Free languages
Closure Properties of Regular Languages
Convert to a DFA: Start state: Final States: P Symbol Q E(Q) a b.
Chapter 1 Regular Language
CSC312 Automata Theory Kleene’s Theorem Lecture # 12
Kleene’s Theorem (Part-3)
NFAs accept the Regular Languages
Presentation transcript:

Automata and Formal Languages Tim Sheard 1 Lecture 9 Reasoning with DFAs

Closure properties of DFAs Languages captured by DFA’s are closed under Union Concatenation Kleene Star Complement Intersection That is to say if L 1 and L 2 are recognized by a DFA, then there exists another DFA, L 3, such that 1.L 3 = complement L 1 2.L 3 = L 1  L 2 3.L 3 = L 1 ∩ L 2 4.L 3 = L 1 * 5.L 3 = L 1  L 2 (The first 3 are easy, we’ll wait on 4 and 5).

Complement Complementation Take a DFA for L and change the status - final or non-final - of all its states. The resulting DFA will accept exactly those strings that the first one rejects. It is, therefore, a DFA for the Complent(L). Thus, the complement of DFA recognizable language is DFA recognizable.

Complement Example Contains a “0” Contains only “1”

2 nd Complement Example Just “abc” Anything but “abc”

Intersection The intersection L  M of two DFA recognizable languages must be recognizable by a DFA too. A constructive way to show this is to construct a new DFA from 2 old ones.

Constructive Proof The proof is based on a construction that given two DFAs A and B, produces a third DFA C such that L( C ) = L( A )  L( B ). The states of C are pairs (p,q), where p is a state of A and q is a state of B. A transition labeled a leads from (p,q) to (p',q') iff there are transitions in A and B. The start state is the pair of original start states; the final states are pairs of original final states. The transition function  A   q,a) = (  A  q,a),  B  q,a) ) This is called the product construction.

Example 1 a+aa+aaa aa+aaa+aaaa What is the intersection? Make a new DFA where states of the new DFA are pairs of states form the old ones

Automata and Formal Languages Tim Sheard 9 Lecture 9

Reachable states only Intersection {a,aa,aaa} ∩ {aa,aaa,aaaa}

Example 2 p q 0 r s ,1 A – string contains a 0 B – string contains a 1 C – string contains a 0 and a 1

Automata and Formal Languages Tim Sheard 12 Lecture 9 Contains a “0” Contains a “1” Contains both a “1” and a “0”

Difference The identity: L - M = L  C( M ) reduces the closure under set-theoretical difference operator to closure under complementation and intersection.

Example Difference -= L - M = L  C( M ) L={a,aa,aaa} M={aa,aaa,aaaa}

Union The union of the languages of two DFAs (over the same alphabet) is recognizable by another DFA. We reuse the product construction of the intersection proof, but widen what is in the final states of the constructed result. Let A=( Q a, ,s a,F a, T a ) and B = (Q b, ,s b,F b, T b ) Then: A  B = ((Q a,Q b ), ,(s a,s b ),Final,  ) Final = { (p,q) | p from F a, q from Q b }  { (p,q) | p from Q a, q from F b }  ((a,b),x) = (  a  a,x),  b  b,y) )

Automata and Formal Languages Tim Sheard 16 Lecture 9 B={bc} A={ab} A  B ={ab,bc}

Only reachable from start

Example Closure Construction Given a language L, let L' be the set of all prefixes of even length strings which belong to L. We prove that if L is regular then L' is also regular. It is easy to show that prefix(L) is regular when L is (How?). We also know that the language Even of even length strings is regular (How?). All we need now is to note that L' = Even  prefix(L) and use closure under intersection.

What’s next We have given constructions for showing that DFAs are closed under 1.Complement 2.Intersection 3.Difference 4.Union In order to establish the closure properties of 1.Reversal 2.Kleene star 3.Concatenation We will need to introduce a new computational system.