NFA’s With ε-Transitions

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)
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
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.
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 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
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.
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 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.
Nondeterministic Finite Automata
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
1 Non-Deterministic Automata Regular Expressions.
Introduction to Finite Automata Adapted from the slides of Stanford CS154.
Theory of Computing Lecture 22 MAS 714 Hartmut Klauck.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
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.
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
What Are They? Who Needs ‘em? An Example: Scoring in Tennis Finite Automata 11.
NFA ε - NFA - DFA equivalence. What is an NFA An NFA is an automaton that its states might have none, one or more outgoing arrows under a specific symbol.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
1 Chapter 2 Finite Automata (part b) Windmills in Holland.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
Regular Expressions Costas Busch - LSU.
Lecture Notes 
Overview of Previous Lesson(s) Over View  A token is a pair consisting of a token name and an optional attribute value.  A pattern is a description.
Jianguo Lu : Lab 3 Jan 30, Winter 2004.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
What do we know? DFA = NFA =  -NFA We have seen algorithms to transform DFA to NFA (trival) NFA to  NFA (trivial) NFA to DFA (subset construction)
1 Example: Graph of a DFA Start 1 0 ACB 1 0 0,1 Previous string OK, does not end in 1. Previous String OK, ends in a single 1. Consecutive 1’s have been.
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
1 Chapter 2 Finite Automata (part a) Hokkaido, Japan.
Nondeterminism Subset Construction ε -Transitions.
CIS Automata and Formal Languages – Pei Wang
NFAε - NFA - DFA equivalence
Non Deterministic Automata
Closure Properties of Regular Languages
Nondeterministic Finite Automata
Properties of Regular Languages
Finite Automata a b A simplest computational model
What Are They? Who Needs ‘em? An Example: Scoring in Tennis
Single Final State for NFA
Chapter 2 FINITE AUTOMATA.
Jaya Krishna, M.Tech, Assistant Professor
CS 154, Lecture 3: DFANFA, Regular Expressions.
Principles of Computing – UFCFA3-30-1
COSC 3340: Introduction to Theory of Computation
4. Properties of Regular Languages
Non-Deterministic Finite Automata
Nondeterministic Finite Automata
Non Deterministic Automata
Introduction to Finite Automata
Definitions Equivalence to Finite Automata
Discrete Math II Howon Kim
CSCI 2670 Introduction to Theory of Computing
Closure Properties of Regular Languages
CS21 Decidability and Tractability
Definitions Equivalence to Finite Automata
Are DFAs and NFAs Equivalent
Chapter 1 Regular Language
Regular Language Equivalence and DFA Minimization
CSCI 2670 Introduction to Theory of Computing
CHAPTER 1 Regular Languages
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

NFA’s With ε-Transitions We can allow state-to-state transitions on ε input. These transitions are done spontaneously, without looking at the input string. A convenience at times, but still only regular languages are accepted.

Example: ε-NFA ε 0 1 ε A {E} {B} ∅ B ∅ {C} {D} C ∅ {D} ∅ D ∅ ∅ ∅ 0 1 ε A {E} {B} ∅ B ∅ {C} {D} C ∅ {D} ∅ D ∅ ∅ ∅ E {F} ∅ {B, C} F {D} ∅ ∅ * C E F A B D 1 ε

Closure of States CL(q) = set of states you can reach from state q following only arcs labeled ε. Example: CL(A) = {A}; CL(E) = {B, C, D, E}. Closure of a set of states = union of the closure of each state. C E F A B D 1 ε

Extended Delta δ Basis: (q, ε) = CL(q). ˄ δ Basis: (q, ε) = CL(q). Induction: (q, xa) is computed as follows: Start with (q, x) = S. Take the union of CL(δ(p, a)) for all p in S. Intuition: (q, w) is the set of states you can reach from q following a path labeled w. ˄ δ ˄ δ ˄ δ And notice that δ(q, a) is not that set of states, for symbol a.

Example: Extended Delta C E F A B D 1 ε Example: Extended Delta ˄ δ (A, ε) = CL(A) = {A}. (A, 0) = CL({E}) = {B, C, D, E}. (A, 01) = CL({C, D}) = {C, D}. Language of an ε-NFA is the set of strings w such that (q0, w) contains a final state. ˄ δ ˄ δ ˄ δ

Equivalence of NFA, ε-NFA Every NFA is an ε-NFA. It just has no transitions on ε. Converse requires us to take an ε-NFA and construct an NFA that accepts the same language. We do so by combining ε–transitions with the next transition on a real input. Warning: This treatment is a bit different from that in the text.

Picture of ε-Transition Removal Transitions on ε Transitions on ε

Picture of ε-Transition Removal To here, and performs the subset construction Text goes from here a a a Transitions on ε Transitions on ε

Picture of ε-Transition Removal To here, with no subset construction a We’ll go from here a a Transitions on ε Transitions on ε

Equivalence – (2) Start with an ε-NFA with states Q, inputs Σ, start state q0, final states F, and transition function δE. Construct an “ordinary” NFA with states Q, inputs Σ, start state q0, final states F’, and transition function δN.

Equivalence – (3) Compute δN(q, a) as follows: Let S = CL(q). δN(q, a) is the union over all p in S of δE(p, a). F’ = the set of states q such that CL(q) contains a state of F. Intuition: δN incorporates ε–transitions before using a but not after.

Equivalence – (4) Prove by induction on |w| that CL(δN(q0, w)) = E(q0, w). Thus, the ε-NFA accepts w if and only if the “ordinary” NFA does. ˄ ˄ δ

Example: ε-NFA-to-NFA Interesting closures: CL(B) = {B,D}; CL(E) = {B,C,D,E} Example: ε-NFA-to-NFA 0 1 ε A {E} {B} ∅ B ∅ {C} {D} C ∅ {D} ∅ D ∅ ∅ ∅ E {F} ∅ {B, C} F {D} ∅ ∅ * 0 1 A {E} {B} B ∅ {C} C ∅ {D} D ∅ ∅ E {F} {C, D} F {D} ∅ * Since closures of B and E include final state D. * * Since closure of E includes B and C; which have transitions on 1 to C and D. ε-NFA

Summary DFA’s, NFA’s, and ε–NFA’s all accept exactly the same set of languages: the regular languages. The NFA types are easier to design and may have exponentially fewer states than a DFA. But only a DFA can be implemented!