> 6(
H/0|DTimes New Roman\5D,0DWo
0DTahomaew Roman\5D,0DWo
0D" DMonotype Sorts\5D,0DWo
00DLucida Sans Unicode,0DWo
0D"@DSymbolSans Unicode,0DWo
0Da.
@n?" dd@ @@```X<L6
"!#$%&'(*)+, .-/0123456c$pf3f33f3@g4JdJd08ppp@uʚ;2Nʚ;<4!d!ddЁ
0P<4dddddЁ
0P___PPT9/0t(?O=e,Regular Expressions*Definitions
Equivalence to Finite Automata$RE s: IntroductionRegular expressions are an algebraic way to describe languages.
They describe exactly the regular languages.
If E is a regular expression, then L(E) is the language it defines.
We ll describe RE s and their languages recursively. f
RE s: DefinitionBasis 1: If a is any symbol, then a is a RE, and L(a) = {a}.
Note: {a} is the language containing one string, and that string is of length 1.
Basis 2: is a RE, and L() = {}.
Basis 3: " is a RE, and L(") = ".>QF3f 3M3f3f,RE s: Definition (2)Induction 1: If E1 and E2 are regular expressions, then E1+E2 is a regular expression, and L(E1+E2) = L(E1)L(E2).
Induction 2: If E1 and E2 are regular expressions, then E1E2 is a regular expression, and L(E1E2) = L(E1)L(E2).d3f !3f !,RE s: Definition (3)@Induction 3: If E is a RE, then E* is a RE, and L(E*) = (L(E))*.A3f6Precedence of OperatorsParentheses may be used wherever needed to influence the grouping of operators.
Order of precedence is * (highest), then concatenation, then + (lowest).Examples: RE s33L(01) = {01}.
L(01+0) = {01, 0}.
L(0(1+0)) = {01, 00}.
Note order of precedence of operators.
L(0*) = {, 0, 00, 000,& }.
L((0+10)*(+1)) = all strings of 0 s and 1 s without two consecutive 1 s.7'f'=@Equivalence of RE s and AutomataWe need to show that for every RE, there is an automaton that accepts the same language.
Pick the most powerful automaton type: the -NFA.
And we need to show that for every automaton, there is a RE defining its language.
Pick the most restrictive type: the DFA.^Y2S)Y+S)6Converting a RE to an -NFA$Proof is an induction on the number of operators (+, concatenation, *) in the RE.
We always construct an automaton of a special form (next slide). 6Form of -NFA s Constructed$
$RE to -NFA: Basis03f"Symbol a:
:
":J@RE to -NFA: Induction 1 Union8!3f PRE to -NFA: Induction 2 Concatenation8)3f
DRE to -NFA: Induction 3 Closure8#3f# DFA-to-REA strange sort of induction.
States of the DFA are assumed to be 1,2,& ,n.
We construct RE s for the labels of restricted sets of paths.
Basis: single arcs or no arc at all.
Induction: paths that are allowed to traverse next state in order.Lh3f 3f:$k-PathsA k-path is a path through the graph of the DFA that goes though no state numbered higher than k.
Endpoints are not restricted; they can be any state.&:33W%Example: k-Paths33
)k-Path InductionjLet Rijk be the regular expression for the set of labels of k-paths from state i to state j.
Basis: k=0. Rij0 = sum of labels of arc from i to j.
" if no such arc.
But add if i=j.$U3f% +Example: Basis336R120 = 0.
R110 = " + = .,k-Path Inductive Case3fA k-path from i to j either:
Never goes through state k, or
Goes through k one or more times.
Rijk = Rijk-1 + Rikk-1(Rkkk-1)* Rkjk-1.Au(A>n-Illustration of Induction
3f0
Final StepThe RE with the same language as the DFA is the sum (union) of Rijn, where:
n is the number of states; i.e., paths are unconstrained.
i is the start state.
j is one of the final states.HLnu@ n1Example33R233 = R232 + R232(R332)*R332 = R232(R332)*
R232 = (10)*0+1(01)*1
R332 = 0(01)*(1+00) + 1(10)*(0+11)
R233 = [(10)*0+1(01)*1] [(0(01)*(1+00) + 1(10)*(0+11))]*5SummaryJEach of the three types of automata (DFA, NFA, -NFA) we discussed, and regular expressions as well, define exactly the same set of languages: the regular languages.$/v7.Algebraic Laws for RE sUnion and concatenation behave sort of like addition and multiplication.
+ is commutative and associative; concatenation is associative.
Concatenation distributes over +.
Exception: Concatenation is not commutative.>IIb 3$8Identities and Annihilators" is the identity for +.
R + " = R.
is the identity for concatenation.
R = R = R.
" is the annihilator for concatenation.
"R = R" = "."&
)
#'/
!"
&'(*./23469: ` ̙33` ` ff3333f` 333MMM` f` f` 3>?" dd@,?udd@ w " @ ` n?" dd@ @@``PR @ ` `p>>f(
6m P
T Click to edit Master title style!
!
0pp
RClick to edit Master text styles
Second level
Third level
Fourth level
Fifth level!
S
0Lu ``
>*
0z `
@*
0 `
@*Z
Byh@ ? ̙33 Default Design
0zrP
(
0pq P
q
P*
0v v
R*
d
c$ ?
v
0v
@v
RClick to edit Master text styles
Second level
Third level
Fourth level
Fifth level!
S
6v `P v
P*
6v ` v
R*
H
0h ? ̙330$(
r
STqpq
r
Sq `
q
H
0h ? ̙33
`$$(
$r
$ S2vP
v
r
$ S(3vv
H
$0h ? ̙33
,$(
,r
, Sd0vP
v
r
, S 1vv
H
,0h ? ̙33H
4(
4r
4 SSvP
v
4 STv<$
0v
0l
@v
4
@v,$D
0R
4
<hVvp@v
PConcatenation : the set of strings wx such that w
Is in L(E1) and x is in L(E2).PQf- #+ZB
4
s*D0
`pH
40h ? ̙33
D<<(
<r
< SivP
v
r
< S 0, where each wi is
in L(E).
Note: when n=0, the string is .f(
3>
-ZB
<
s*D p` H
<0h ? ̙33
H$(
Hr
H SvP
v
r
H Svv
H
H0h ? ̙33
D$(
Dr
D SvP
v
r
D Svv
H
D0h ? ̙33
T$(
Tr
T S0v
v
r
T Sv`v
H
T0h ? ̙33
@\$(
\r
\ S8vP
v
r
\ Svv
H
\0h ? ̙33W
`
d(
dr
d SvP
v
X2
d
0̙0 P
X2
d
0̙0
P
RB
d
s*D ` RB
d
s*D P 2
d
<zPYp
6H
0h ?/@ ̙33
$(
r
SGzP
z
r
SHzz
H
0h ? ̙33
$(
r
SSzP
z
r
STzz
H
0h ? ̙33
B:@j
(
r
S_zP
z
8 `P
P` 2
<$>L$LZ*$*Zh8$8hvF-$FvT$Tb$bp-$p~$~$-$-$$-$$-$-$,$,:
-$
:H$HV&-$&Vd4-$4drB-$BrP$P^-$^k-$ky-$y-$-$-$-$-$-$-$-$'-$'5-$5C-$CQ!-$!Q_/-$/_m=-$=m{K-$K{Y-$Yg-$gu-$u-$-$-$-$-$-$-$-$#-$#1-$1?-$?M-$M[+-$+[i9-$9iwG-$GwU-$Uc-$cq-$q-$-$-$-$-$-$-$-$-$--$-;-$;I-$IW'-$'We5-$5erB-$BrP-$P^-$^l-$lz-$z-$-$-$-$-$$-$-$($(6-$6D-$DR"$"R`0-$0`n>$>n|L-$L|Z$Zh$hv-$v$$$&&&-&$&&-&&
&&-&&&&-$0>$>L$LZ*$*Zh8$8hvF-$FvT$Tb$bp-$p~$~$-$-$$-$$-$-$,$,:
-$
:H$HV&-$&Vd4-$4drB-$BrP$P^-$^k-$ky-$y-$-$-$-$-$-$-$-$'-$'5-$5C-$CQ!-$!Q_/-$/_m=-$=m{K-$K{Y-$Yg-$gu-$u-$-$-$-$-$-$-$-$#-$#1-$1?-$?M-$M[+-$+[i9-$9iwG-$GwU-$Uc-$cq-$q-$-$-$-$-$-$-$-$-$--$-;-$;I-$IW'-$'We5-$5erB-$BrP-$P^-$^l-$lz-$z-$-$-$-$-$$-$-$($(6-$6D-$DR"$"R`0-$0`n>$>n|L-$L|Z$Zh$hv-$v$$$&-
--&&&y&/w`w
[ "؋w`wf- @Times New Roman\؋w`wf- . 2
f1 .--iyH-- @"Tahomaw
^ "\؋w`wf- .$2
CRegular Expressions% !
!!
!.--Q1-- @"Tahomaw
@"\؋w`wf- .2
|Definitions
. .42
Equivalence to Finite Automata
$.--"Systemf
G-&TNPP &՜.+,0
(HOn-screen ShowStanford University, CS Dept.a Times New RomanTahomaMonotype SortsLucida Sans UnicodeSymbolDefault DesignRegular ExpressionsRE’s: IntroductionRE’s: DefinitionRE’s: Definition – (2)RE’s: Definition – (3)Precedence of OperatorsExamples: RE’s#Equivalence of RE’s and AutomataConverting a RE to an ε-NFAForm of ε-NFA’s ConstructedRE to ε-NFA: Basis$RE to ε-NFA: Induction 1 – Union,RE to ε-NFA: Induction 2 – Concatenation&RE to ε-NFA: Induction 3 – Closure
DFA-to-REk-PathsExample: k-Pathsk-Path InductionExample: Basisk-Path Inductive CaseIllustration of InductionFinal StepExampleSummaryAlgebraic Laws for RE’sIdentities and AnnihilatorsFonts UsedDesign Template
Slide Titles_JeffJeff
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Root EntrydO)Current UserSummaryInformation(0/PowerPoint Document(DocumentSummaryInformation8