CS 44 – Aug. 29 Regular operations –Union construction Section 1.2 - Nondeterminism –2 kinds of FAs –How to trace input –NFA design makes “union” operation.

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.
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 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
Chapter Two: Finite Automata
Introduction to Computability Theory
NFAs Sipser 1.2 (pages 47–54). CS 311 Fall Recall… Last time we showed that the class of regular languages is closed under: –Complement –Union.
NFAs and DFAs Sipser 1.2 (pages 47-63). Last time…
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
NFAs Sipser 1.2 (pages 47–54). CS 311 Mount Holyoke College 2 Recall… Last time we showed that the class of regular languages is closed under: –Complement.
1 Introduction to Computability Theory Discussion1: Non-Deterministic Finite Automatons Prof. Amos Israeli.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
Finite Automata and Non Determinism
CS5371 Theory of Computation
CS 310 – Fall 2006 Pacific University CS310 Finite Automata Sections:1.1 page 44 September 8, 2006.
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.
Finite Automata Finite-state machine with no output. FA consists of States, Transitions between states FA is a 5-tuple Example! A string x is recognized.
Cohen, Chapter 61 Introduction to Computational Theory Chapter 6.
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.
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 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.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
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.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
1 Non-Deterministic Automata Regular Expressions.
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.2: NFA’s) David Martin With some modifications.
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.
Nondeterminism (Deterministic) FA required for every state q and every symbol  of the alphabet to have exactly one arrow out of q labeled . What happens.
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.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
Theory of Languages and Automata
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
Lecture 05: Theory of Automata:08 Kleene’s Theorem and NFA.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NFA to DFA.
CSCI 2670 Introduction to Theory of Computing August 26, 2004.
CSCI 2670 Introduction to Theory of Computing August 25, 2005.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
CMSC 330: Organization of Programming Languages Theory of Regular Expressions Finite Automata.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NFA to.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CS 461 – Sept. 2 Review NFA  DFA Combining FAs to create new languages –union, intersection, concatenation, star –We can basically understand how these.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
1 Closure E.g., we understand number systems partly by understanding closure properties: Naturals are closed under +, , but not -, . Integers are closed.
CS 461 – Aug. 31 Section 1.2 – Nondeterministic FAs How to trace input √ NFA design makes “union” operation easier Equivalence of NFAs and DFAs.
Properties of Regular Languages
Intro to Theory of Computation
CSE322 PROPERTIES OF REGULAR LANGUAGES
Properties of Regular Languages
CS 154, Lecture 3: DFANFA, Regular Expressions.
COSC 3340: Introduction to Theory of Computation
CSE322 CONSTRUCTION OF FINITE AUTOMATA EQUIVALENT TO REGULAR EXPRESSION Lecture #9.
Properties of Context-Free languages
Chapter 1 Regular Language
CHAPTER 1 Regular Languages
NFAs accept the Regular Languages
Presentation transcript:

CS 44 – Aug. 29 Regular operations –Union construction Section Nondeterminism –2 kinds of FAs –How to trace input –NFA design makes “union” operation easier –Equivalence of NFAs and DFAs

Wolf, Goat, Cabbage A man would like to cross a river with his wolf, goat and head of cabbage. Can only ferry 1 of 3 items at a time. Plus: –Leaving wolf & goat alone: wolf will eat goat. –Leaving goat & cabbage alone: goat will eat cabbage. Yes, we can solve this problem using an FA! –Think about possible states and transitions.

Operations on sets We can create new regular sets from existing ones, rather than starting from scratch. Binary operations –Union –Intersection Unary operations –Complement –Star: This is the concatenation of 0 or more elements. For example, if A = {0, 11}, then A* is { ε, 0, 11, 00, 1111, 011, 110, …} “Closure property”: you always get a regular set when you use the above operations.

Union Book shows construction (see handout) We want to union two languages A 1 and A 2 : M 1 accepts A 1 and M 2 accepts A 2. The combined machine is called M. M pretends it’s running M 1 and M 2 at same time! δ((r 1,r 2 ),a) = (δ 1 (r 1,a),δ 2 (r 2,a)) # states increases because it’s the Cartesian product of M 1 and M 2 ’s states. Next section will show easier way to do union.

Union Book shows construction (see handout) We want to union two languages A 1 and A 2 : M 1 accepts A 1 and M 2 accepts A 2. The combined machine is called M. M pretends it’s running M 1 and M 2 at same time! δ((r 1,r 2 ),a) = (δ 1 (r 1,a),δ 2 (r 2,a)) # states increases because it’s the Cartesian product of M 1 and M 2 ’s states. Next section will show easier way to do union.

Non-determinism There are 2 kinds of FA’s –DFA: deterministic FA –NFA: non-deterministic FA NFA is like DFA except: –A state may have any # of arrows per input symbol –You can have ε-transitions. With this kind of transition, you can go to another state “for free”. Non-determinism can make machine construction more flexible. At first the theory seems more complex, but NFA’s will come in handy.

Example s1s2s3 s4 10, ε1 0, 1 From stateInput 0Input 1Input ε s1 s1, s2 s2s3 s4

continued See the non-determinism? Remember, any time you reach a state that has ε-transitions coming out, take it! It’s free. Let’s trace input s1s2s3 s4 10, ε1 0, 1

s1s2s3 s4 10, ε1 0, 1 StartRead 0Read 1Read 0Read 1 Read 0 s1 s2s3 [dies] s2[dies] s3s4 s2s3s4 s3[dies]

Moral When tracing a word like , we just want to know if there is any way to get to the accept state. Language is anything containing 11 or 101. Corresponding DFA would have more states.