Download presentation
Presentation is loading. Please wait.
1
CSCI 2670 Introduction to Theory of Computing
September 12, 2007
2
Agenda Last class Today Tomorrow
Further exploration of equivalence of DFA’s and NFA’s Closure of regular languages under regular operators Regular expressions Today Equivalence of RE’s and regular languages Tomorrow Another method for describing regular languages
3
RE inductive definition
R is a regular expression if R is a for some a ε R1 R2 where R1 and R2 are both regular expressions R1 R2 where R1 and R2 are both regular expressions (R1*) where R1 is a regular expression Abuse of notation. These should be sets!
4
RE’s and regular languages
Theorem: A language is regular if and only if some regular expression describes it. i.e., every regular expression has a corresponding DFA and vice versa
5
RE’s and regular languages
Lemma: If a language is described by a regular expression, then it is regular. find an NFA corresponding to any regular expression use inductive definition of RE’s Proved yesterday
6
Equivalence of RE’s and DFA’s
We have seen that every RE has a corresponding NFA Therefore, every RE has a corresponding DFA I.e, every RE describes a regular language We need to show that every regular language can be described by a RE Begin by converting all DFA’s into GNFA’s Generalized Non-deterministic Finite Automata
7
GNFA’s A GNFA is an NFA with the following properties:
The start state has transition arrows going to every other state, but no arrows coming in from any other state There is exactly one accept state and there is an arrow from every other state to this state, but no arrows to any other state from the accept state The start state is not the accept state
8
GNFA’s (continued) Except for the start and accept states, one arrow goes from every state to every other state and also from each state to itself Instead of being labeled with symbols from the alphabet, transitions are labeled with regular expressions
9
Example GNFA 01 1 10
10
Equivalence of DFA’s and RE’s
First show every DFA can be converted into a GNFA that accepts the same language Then show that any GNFA has a corresponding RE that accepts the same language
11
Converting a DFA into a GNFA
Add two new states New start state with an ε jump to the original DFA’s start state New accept state with an ε jump from each of the original DFA’s accept states This new state will be the only accept state All transition labels with multiple labels are relabeled with the union of the previous labels All pairs of states without transitions get a transition labeled
12
Converting a DFA to a GNFA
1 q1 q2 q3 q4 0,1 qs qt ε ε Add two new states
13
Converting a DFA to a GNFA
q2 1 qs qt q1 1 ε ε q3 q4 0,1 01 0,1 01 All transition labels with multiple labels are relabeled with the union of the previous labels
14
Converting a DFA to a GNFA
q2 1 qs qt q1 1 ε ε q3 q4 01 01 All pairs of states without transitions get a transition labeled
15
Converting a DFA to a GNFA
q2 1 qs qt q1 1 ε ε q3 q4 01 01 The resulting state diagram is a GNFA All GNFA properties are satisfied
16
Converting a DFA to a GNFA
q2 1 qs qt q1 1 ε ε q3 q4 01 01 No step changed the strings accepted by the machine
17
Converting a GNFA to a RE
If the GNFA has two states, then the label connecting the states is the RE Otherwise, remove one state at a time without changing the language accepted by the machine until the GNFA has two states
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.