Then the left side is clearly \an y sequence of 0's and - - PDF document

then the left side is clearly an y sequence of 0 s and 1
SMART_READER_LITE
LIVE PREVIEW

Then the left side is clearly \an y sequence of 0's and - - PDF document

Extended RE's UNIX pioneered the use of additional op erators and notation for RE's: E ? = 0 or 1 o ccurrences of E = + E . + = 1 or more o ccurrences of = . E E E E Char acter


slide-1
SLIDE 1 Extended RE's UNIX pioneered the use
  • f
additional
  • p
erators and notation for RE's:
  • E
? =
  • r
1
  • ccurrences
  • f
E =
  • +
E .
  • E
+ = 1
  • r
more
  • ccurrences
  • f
E = E E
  • .
  • Char
acter classes [a
  • z
GX ] = the union
  • f
all (ASCI I) c haracters from a to z , plus the c haracters G and X , for example. Algebraic La ws for RE's If t w
  • expressions
E and F ha v e no v ariables, then E = F means that L(E ) = L(F ) (not that E and F are iden tical expressions).
  • Example:
1 + = 11
  • .
If E and F are RE's with v ariables, then E = F (E is e quivalent to F ) means that whatev er languages w e substitute for the v ariables (pro vided w e substitute the same language ev erywhere the same v ariable app ears), the resulting expressions denote the same language.
  • Example:
R + = RR
  • .
With t w
  • notable
exceptions, w e can think
  • f
union (+) as if it w ere addition with ; in place
  • f
the iden tit y 0, and concatenation, with
  • in
place
  • f
the iden tit y 1, as m ultiplication.
  • +
and concatenation are b
  • th
asso ciativ e.
  • +
is comm utativ e.
  • La
ws
  • f
the iden tities hold for b
  • th.
  • ;
is the annihilator for concatenation.
  • The
exceptions: 1. Concatenation is not comm utativ e: ab 6= ba. 2. + is idemp
  • tent
: E + E = E for an y expression E . Chec king a La w Supp
  • se
w e are told that the la w (R + S )
  • =
(R
  • S
  • )
  • holds
for RE's. Ho w w
  • uld
w e c hec k that this claim is true?
  • Think
  • f
R and S as if they w ere single sym b
  • ls,
rather than placeholders for languages, i.e., R = f0g and S = f1g.

Then the left side is clearly \an y sequence
  • f
0's and 1's. 1
slide-2
SLIDE 2

The righ t side also denotes an y string
  • f
0's and 1's, since and 1 are eac h in L(0
  • 1
  • ).
  • That
test is ne c essary (i.e., if the test fails, then the la w do es not hold.

W e ha v e particular languages that serv e as a coun terexample.
  • But
is it sucient (if the test succeeds, the la w holds)? Pro
  • f
  • f
Suciency The b
  • k
has a fairly simple argumen t for wh y , when the \concretized" expressions denote the same language, then the languages w e get b y substituting an y languages for the v ariables are also the same.
  • But
if y
  • u
think that's
  • b
vious, the b
  • k
also has an example
  • f
\RE's with in tersection" where the same statemen t is false.
  • Also
| is it clear that w e can tell whether t w
  • RE's
without v ariables denote the same language?

Algorithm to do so will b e co v ered. Closure Prop erties
  • Not
ev ery language is a regular language.
  • Ho
w ev er, there are some rules that sa y \if these languages are regular, so is this
  • ne
deriv ed from them.
  • There
is also a p
  • w
erful tec hnique | the pumping lemma | that helps us pro v e a language not to b e regular.
  • Key
to
  • l:
Since w e kno w RE's, DF A's, NF A's,
  • NF
A's all dene exactly the regular languages, w e can use whic hev er represen tation suits us when pro ving something ab
  • ut
a regular language. Pumping Lemma If L is a regular language, then there exists a constan t n suc h that ev ery string w in L,
  • f
length n
  • r
more, can w e written as w = xy z , where: 1. < jy j. 2. jxy j
  • n.
2
slide-3
SLIDE 3 3. F
  • r
all i
  • 0,
w y i z is also in L.

Note y i = y rep eated i times; y = .
  • The
alternating quan tiers in the logical statemen t
  • f
the PL mak es it v ery complex: (8L)(9n)(8w )(9x; y ; z )(8i). Pro
  • f
  • f
Pumping Lemma
  • Since
w e claim L is regular, there m ust b e a DF A A suc h that L = L(A).
  • Let
A ha v e n states; c ho
  • se
this n for the pumping lemma.
  • Let
w b e a string
  • f
length
  • n
in L, sa y w = a 1 a 2
  • a
m , where m
  • n.
  • Let
q i b e the state A is in after reading the rst i sym b
  • ls
  • f
w .

q = start state, q 1 =
  • (q
; a 1 ), q 2 = ^
  • (q
; a 1 a 2 ), etc.
  • Since
there are
  • nly
n dieren t states, t w
  • f
q ; q 1 ; : : : ; q n m ust b e the same; sa y q i = q j , where
  • i
< j
  • n.
  • Let
x = a 1
  • a
i ; y = a i+1
  • a
j ; z = a j +1
  • a
m .
  • Then
b y rep eating the lo
  • p
from q i to q i with lab el a i+1
  • a
j zero times
  • nce,
  • r
more, w e can sho w that xy i z is accepted b y A. PL Use W e use the PL to sho w a language L is not regular.
  • Start
b y assuming L is regular.
  • Then
there m ust b e some n that serv es as the PL constan t.

W e ma y no kno w what n is, but w e can w
  • rk
the rest
  • f
the \game" with n as a parameter.
  • W
e c ho
  • se
some w that is kno wn to b e in L.

T ypically , w dep ends
  • n
n.
  • Applying
the PL, w e kno w w can b e brok en in to xy z , satisfying the PL prop erties.

Again, w e ma y not kno w ho w to break w , so w e use x; y ; z as parameters.
  • W
e deriv e a con tradiction b y pic king i (whic h migh t dep end
  • n
n, x, y , and/or z ) suc h that xy i z is not in L. 3
slide-4
SLIDE 4 Example Consider the set
  • f
strings
  • f
0's whose length is a p erfect square; formally L = f0 i j i is a squareg.
  • W
e claim L is not regular.
  • Supp
  • se
L is regular. Then there is a constan t n satisfying the PL conditions.
  • Consider
w = n 2 , whic h is surely in L.
  • Then
w = xy z , where jxy j
  • n
and y 6= .
  • By
PL, xy y z is in L. But the length
  • f
xy y z is greater than n 2 and no greater than n 2 + n.
  • Ho
w ev er, the next p erfect square after n 2 is (n + 1) 2 = n 2 + 2n + 1.
  • Th
us, xy y z is not
  • f
square length and is not in L.
  • Since
w e ha v e deriv ed a con tradiction, the
  • nly
unpro v ed assumption | that L is regular | m ust b e at fault, and w e ha v e a \pro
  • f
b y con tradiction" that L is not regular. Closure Prop erties Certain
  • p
erations
  • n
regular languages are guaran teed to pro duce regular languages.
  • Example:
the union
  • f
regular languages is regular; start with RE's, and apply + to get an RE for the union. Substitu ti
  • n
  • T
ak e a regular language L
  • v
er some alphab et .
  • F
  • r
eac h a in , let L a b e a regular language.
  • Let
s b e the substitution dened b y s(a) = L a for eac h a.

Extend s to strings b y s(a 1 a 2
  • a
n ) = s(a 1 )s(a 2 )
  • s(a
n ); i.e., concatenate the languages L a 1 L a 2
  • L
a n .

Extend s to languages b y s(M ) =[ w in M s(w ).
  • Then
s(L) is regular. Pro
  • f
That Substitu ti
  • n
  • f
Regular Languages In to a Regular Language is Regular
  • Let
R b e a regular expression for language L. 4
slide-5
SLIDE 5
  • Let
R a b e a regular expression for language s(a) = L a , for all sym b
  • ls
a in .
  • Construct
a RE E for s(L) b y starting with R and replacing eac h sym b
  • l
a b y the RE L a .
  • Pro
  • f
that L(E ) = s(L) is an induction
  • n
the heigh t
  • f
(the expression tree for) RE R. Basis : R is a single sym b
  • l,
a. Then E = R a , L = fag, and s(L) = s(fag) = L(R a ).
  • Cases
where R is
  • r
; easy . Induction : There are three cases, dep ending
  • n
whether R = R 1 + R 2 , R = R 1 R 2 ,
  • r
R = R
  • 1
. W e'll do
  • nly
R = R 1 R 2 .
  • L
= L 1 L 2 , where L 1 = L(R 1 ) and L 2 = L(R 2 ).
  • Let
E 1 b e R 1 , with eac h a replaced b y R a , and E 2 similarly .
  • By
the IH, L(E 1 ) = s(L 1 ) and L(E 2 ) = s(L 2 ).
  • Th
us, L(E ) = s(L 1 )s(L 2 ) = s(L). Application s
  • f
the Substitu ti
  • n
Theorem
  • If
L 1 and L 2 are regular, so is L 1 L 2 .

Let s(a) = L 1 and s(b) = L 2 . Substitute in to the regular language fabg.
  • So
is L 1 [ L 2 .

Substitute in to fa; bg.
  • Ditto
L
  • 1
.

Substitute in to L(a
  • ).
  • Closure
under homomorphism = substitution
  • f
  • ne
string for eac h sym b
  • l.

Sp ecial case
  • f
a substitution. Example: Homomorphism Let L = L(0
  • 1
  • ),
and let h b e a homomorphism dened b y h(0) = aa and h(1) = .
  • Then
h(L) = L
  • aa)
  • =
all strings
  • f
an ev en n um b er
  • f
a's. Closure Under In v erse Homomorphism
  • h
1 (L) = fw j h(w ) is in Lg. 5
slide-6
SLIDE 6
  • See
argumen t in course reader. Briey:

Giv en homomorphism h and regular language L, start with a DF A A for L.

Construct DF A B for h 1 (L), b y ha ving B go from state q to state p
  • n
input a if ^
  • q
; h(a)
  • =
p. Closure Under Rev ersal
  • The
r everse
  • f
a string w = a 1 a 2
  • a
n is a n
  • a
2 a 1 .

Denoted w R .

Note
  • R
= .
  • The
rev erse
  • f
a language L is the set con taining the rev erse
  • f
eac h string in L.
  • If
L is regular, so is L R .

Pro
  • f:
use RE's, recursiv e rev ersal as in course reader. 6