Cs3102: Theory of Computation Class 4: Nondeterminism Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the TexPoint manual.

Slides:



Advertisements
Similar presentations
4b Lexical analysis Finite Automata
Advertisements

Complexity and Computability Theory I Lecture #4 Rina Zviel-Girshin Leah Epstein Winter
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
Regular Expressions and DFAs COP 3402 (Summer 2014)
8/27/2009 Sofya Raskhodnikova Intro to Theory of Computation L ECTURE 2 Theory of Computation Finite Automata Operations on languages Nondeterminism L2.1.
Finite Automata CPSC 388 Ellen Walker Hiram College.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2005.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
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.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
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.
Introduction to Computability Theory
1 Introduction to Computability Theory Discussion1: Non-Deterministic Finite Automatons Prof. Amos Israeli.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Lexical Analysis III Recognizing Tokens Lecture 4 CS 4318/5331 Apan Qasem Texas State University Spring 2015.
CS5371 Theory of Computation
CS 310 – Fall 2006 Pacific University CS310 Finite Automata Sections:1.1 page 44 September 8, 2006.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
Fall 2006Costas Busch - RPI1 Regular Expressions.
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.
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.
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
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.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
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 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
1 Non-Deterministic Automata Regular Expressions.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
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.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
Cs3102: Theory of Computation Class 2: Problems and Finite Automata Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
1 Unit 1: Automata Theory and Formal Languages Readings 1, 2.2, 2.3.
Theory of Languages and Automata
By: Er. Sukhwinder kaur.  What is Automata Theory? What is Automata Theory?  Alphabet and Strings Alphabet and Strings  Empty String Empty String 
Cs3102: Theory of Computation Class 6: Pushdown Automata Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the TexPoint manual.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Cs3102: Theory of Computation Class 5: Non-Regular Languages Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the TexPoint.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
using Deterministic Finite Automata & Nondeterministic Finite Automata
CS 154 Formal Languages and Computability February 9 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
Theory of Computation Automata Theory Dr. Ayman Srour.
Deterministic Finite Automata Nondeterministic Finite Automata.
Theory of Computation Automata Theory Dr. Ayman Srour.
Non Deterministic Automata
Chapter 2 FINITE AUTOMATA.
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Non-Deterministic Finite Automata
CS 154, Lecture 3: DFANFA, Regular Expressions.
Non-Deterministic Finite Automata
Non Deterministic Automata
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Chapter 1 Regular Language
Non Deterministic Automata
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

cs3102: Theory of Computation Class 4: Nondeterminism Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A AAA A AAAAAA AAA A PS1 is due now!

Adding Nondeterminism 1 2 Deterministic machine: at every step, there is only one choice Nondeterministic machine: at some steps, there may be more than one choice. a a, b b b

Nondeterminism in Practice

Nondeterminism in Theory Omnipotent: Machine splits into a new machine for each choice; if any machine accepts, accept. Omniscient: Whenever it has to make a choice, machine always guesses right.

Example NFA 12 3 ab a, b

Defining DFAs A deterministic finite automaton is a 5-tuple: Q finite set (“states”)  finite set (“alphabet”)  : Q    Q transition function q 0  Q start state F  Q set of accepting states How do we need to change this to support nondeterminism?

Defining NFAs A nondeterministic finite automaton is a 5-tuple: Q finite set (“states”)  finite set (“alphabet”) transition function q 0  Q start state F  Q set of accepting states Output of transition function is a set of states, not just one state.

Computation Model of NFA

Is an NFA more powerful than a DFA?

Power of Machines Languages that can be recognized by an A Languages that can be recognized by a B A and B are non-comparable.

Power of Machines Languages that can be recognized by an A Languages that can be recognized by a B B is less powerful than A: (1)Some A can recognize every language a B can recognize. (2)There is some language that can be recognized by an A but not by any B.

Power of Machines Languages that can be recognized by an A Languages that can be recognized by a B A and B are equal: (1)every language that can be recognized by an A can be recognized by some B (2)every language that can be recognized by a B can be recognized by some A

Power of NFA/DFA Easy part: is there any language a DFA can recognize that cannot be recognized by an NFA? Hard part: is there any language an NFA can recognized that cannot be recognized by a DFA?

L(NFA)  L(DFA) A nondeterministic finite automaton is a 5-tuple: Q finite set (“states”)  finite set (“alphabet”) q 0  Q start state F  Q set of accepting states Proof by construction: Construct the NFA N corresponding to any DFA A = (Q, , , q 0,F): N = (Q, ,  ’, q 0,F) where  q  Q,  ’(q,  ) = reject  a  ,  ’(q, a) = {  (q, a) } Proof by construction: Construct the NFA N corresponding to any DFA A = (Q, , , q 0,F): N = (Q, ,  ’, q 0,F) where  q  Q,  ’(q,  ) = reject  a  ,  ’(q, a) = {  (q, a) }

Power of NFA/DFA Easy part: is there any language a DFA can recognize that cannot be recognized by an NFA? Hard part: is there any language an NFA can recognized that cannot be recognized by a DFA? No: NFAs are at least as powerful as DFAs.

L(DFA)  L(NFA)

Example Conversion 12 3 ab a, b

12 3 ab {1} {2} {1, 2} {1, 3} {2, 3} {1,2, 3} {3} {}

12 3 ab a, b {1} {2} {1, 2} {1, 3} {2, 3} {1,2, 3} {3} {} a a b b b a b

Converting NFAs to DFAs How many states may be needed for the DFA corresponding to and NFA with N states? How much bigger is the transition function for the DFA corresponding to and NFA with N states?

Regular Expressions

“something formatted like an [ ] address” [A-Za-z0-9]*)* This matches most addresses. Matching the full spec of all possible addresses is left as exercise.

Regular Expression Base: Language a   { a }  {  }  { } Induction: R 1, R 2 are regular expressions R 1  R 2 L(R 1 )  L(R 2 ) R 1  R 2 { xy | x  L(R 1 ) and y  L(R 2 ) } R 1 * { x n | x  L(R 1 ) and n ≥ 0 }

How powerful are Regular Expressions? Is there a Regular Expression that describes the same language as any NFA? Is there some NFA that describes the same language as any Regular Expression?

L(RE)  L(NFA) Base: Language a   { a }  {  }  { } Induction: R 1, R 2 are regular expressions R 1  R 2 L(R 1 )  L(R 2 ) R 1  R 2 { xy | x  L(R 1 ) and y  L(R 2 ) } R 1 * { x n | x  L(R 1 ) and n ≥ 0 } Proof by construction. Trivial to draw NFAs for Each of these languages.

L(RE)  L(NFA) Base: Language a   { a }  {  }  { } Proof by construction. Trivial to draw NFAs for Each of these languages. Proof by construction. Trivial to draw NFAs for Each of these languages.

L(RE)  L(NFA) Induction: R 1, R 2 are regular expressions R 1  R 2 L(R 1 )  L(R 2 ) R 1  R 2 { xy | x  L(R 1 ) and y  L(R 2 ) } R 1 * { x n | x  L(R 1 ) and n ≥ 0 } Proof by induction and construction. Assume there are NFAs A 1 and A 2 that recognize the languages L(R 1 ) and L(R 2 ). Show how to construct an NFA that recognizes the produced language for each part. Proof by induction and construction. Assume there are NFAs A 1 and A 2 that recognize the languages L(R 1 ) and L(R 2 ). Show how to construct an NFA that recognizes the produced language for each part.

Proving: R 1  R 2

Charge PS2 will be posted by tomorrow Finish reading Chapter 1 Thursday: how to prove a language is non- regular