This action might not be possible to undo. Are you sure you want to continue?

BooksAudiobooksComicsSheet Music### Categories

### Categories

### Categories

### Publishers

Scribd Selects Books

Hand-picked favorites from

our editors

our editors

Scribd Selects Audiobooks

Hand-picked favorites from

our editors

our editors

Scribd Selects Comics

Hand-picked favorites from

our editors

our editors

Scribd Selects Sheet Music

Hand-picked favorites from

our editors

our editors

Top Books

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Audiobooks

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Comics

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Sheet Music

What's trending, bestsellers,

award-winners & more

award-winners & more

P. 1

Class 4|Views: 36|Likes: 0

Published by Taqi Shah

See more

See less

https://www.scribd.com/doc/82406192/Class-4

05/28/2014

text

original

Courtesy Costas Busch - RPI

1

Any NFA can be converted to an equivalent NFA with a single final state

Courtesy Costas Busch - RPI

2

a a b

Example

NFA

b

a a b b P

Equivalent NFA

P

3

Courtesy Costas Busch - RPI

NFA

In General

Equivalent NFA

P P P

Courtesy Costas Busch - RPI

**Single final state
**

4

Extreme Case

NFA without final state

Add a final state Without transitions

Courtesy Costas Busch - RPI

5

Properties of Regular Languages

Courtesy Costas Busch - RPI

6

For regular languages we will prove that: Union: Concatenation: Star: Reversal: Complement: Intersection:

L1 and L2

L1 L2

L1L2 L1 *

R L1 Are regular Languages

L1

Courtesy Costas Busch - RPI

L1 L2

7

We say: Regular languages are closed under Union: Concatenation: Star: Reversal: Complement: Intersection:

L1 L2

L1L2 L1 *

R L1

L1

Courtesy Costas Busch - RPI

L1 L2

8

Regular language

L1

Regular language

L2

LM1
! L1

NFA

LM 2
! L2

NFA

M1

M2

Single final state

**Single final state
**

9

Courtesy Costas Busch - RPI

Example

nu0

M1

a

b

L1 ! {a b}

n

M2 L2 ! _ a ba

b a

Courtesy Costas Busch - RPI

10

Union

NFA for

L1 L2 M1

P P

P

M2

P

Courtesy Costas Busch - RPI

11

Example

NFA for

L1 L2 ! {a b} {ba} L1 ! {a b}

a

b

P P

n

n

P

L2 ! {ba}

b

P

a

12

Courtesy Costas Busch - RPI

Concatenation

NFA for

L1L2 M1

P

M2

P

Courtesy Costas Busch - RPI

13

Example

NFA for

**L1L2 ! {a b}{ba} ! {a bba}
**

n

n

n

L1 ! {a b}

a b P

L2 ! {ba}

b a P

Courtesy Costas Busch - RPI

14

Star Operation

NFA for L1 *

P

M1

P

P

P L1 *

P

Courtesy Costas Busch - RPI 15

Example

NFA for

L1* ! {a b} *

P

n

w ! w1w2 . wk wi L1 n

L1 ! {a b}

a

P

b

P P

Courtesy Costas Busch - RPI

16

Reverse

NFA for

L1

M1

L1 d M1

R

**1. Reverse all transitions 2. Make initial state final state and vice versa
**

Courtesy Costas Busch - RPI 17

Example

M1

a

L1 ! {a b}

n

b

a

R L1

d M1

b

! {ba }

n

Courtesy Costas Busch - RPI

18

Complement

L1

M1

L1

d M1

**1. Take the DFA that accepts L1 2. Make final states non-final, and vice-versa
**

Courtesy Costas Busch - RPI 19

Example

M1

a

a, b

L1 ! {a b}

n

b

a, b

a L1 ! {a, b} * {a b}

n

a, b

d M1

b

Courtesy Costas Busch - RPI

a, b

20

Intersection

DeMorgan·s Law:

L1 L2 ! L1 L2

regular regular regular regular regular

21

L1 , L2 L1 , L2 L1 L2 L1 L2 L1 L2

Courtesy Costas Busch - RPI

Example

n

L1 ! {a b} regular L2 ! {ab, ba} regular

L1 L2 ! {ab}

regular

Courtesy Costas Busch - RPI

22

Regular Expressions

Courtesy Costas Busch - RPI

23

Regular Expressions

Regular expressions describe regular languages

Example:

(a b c) *

describes the language

**_a, bca ! _P , a, bc, aa, abc, bca,...a *
**

Courtesy Costas Busch - RPI 24

Recursive Definition

Primitive regular expressions: Given regular expressions

, P, E

r1 and r2

r1 r2 r1 r2 r1 *

Are regular expressions

r1

Courtesy Costas Busch - RPI 25

Examples

A regular expression:

a b c * (c )

Not a regular expression:

a b

Courtesy Costas Busch - RPI

26

Languages of Regular Expressions

Lr : language of regular expression r

Example

L( a b c) * ! _P , a, bc, aa, abc, bca,...a

Courtesy Costas Busch - RPI

27

Definition

For primitive regular expressions:

**L
! LP
! _Pa La
! _aa
**

Courtesy Costas Busch - RPI 28

Definition (continued)

For regular expressions r and r2 1

**Lr1 r2
! Lr1
Lr2
Lr1 r2
! Lr1
Lr2
Lr1 *
! Lr1
* Lr1
! Lr1
**

Courtesy Costas Busch - RPI 29

Example

Regular expression:

a b a *

**La b
a *
! La b
La *
! La b
La *
! La
Lb
La
* ! _aa _ a
_aa
* b ! _a, ba_P , a, aa, aaa,...a ! _a, aa, aaa,..., b, ba, baa,...a
**

Courtesy Costas Busch - RPI 30

Example

Regular expression

r ! a b * a bb

Lr ! _a, bb, aa, abb, ba, bbb,...a

Courtesy Costas Busch - RPI

31

Example

Regular expression

r ! aa * bb * b

Lr ! {a b

2n 2m

b : n, m u 0}

Courtesy Costas Busch - RPI

32

Example

Regular expression

r ! (0 1) * 00 (0 1) *

**L(r ) = { all strings with at least
**

two consecutive 0 }

Courtesy Costas Busch - RPI

33

Example

Regular expression

r ! (1 01) * (0 P )

**L(r ) = { all strings without
**

two consecutive 0 }

Courtesy Costas Busch - RPI

34

**Equivalent Regular Expressions
**

Definition: Regular expressions are equivalent if

r1 and r2 L(r1) ! L( r2 )

Courtesy Costas Busch - RPI

35

Example

**L = { all strings without
**

two consecutive 0 }

**r1 ! (1 01) * (0 P ) r2 ! (1* 011*) * (0 P ) 1* (0 P ) L(r1 ) ! L(r2 ) ! L r1 and r2
**

are equivalent regular expr.

36

Courtesy Costas Busch - RPI

Regular Expressions and Regular Languages

Courtesy Costas Busch - RPI

37

Theorem

Languages Generated by Regular Expressions

!

Regular Languages

Courtesy Costas Busch - RPI

38

Theorem - Part 1

Languages Generated by Regular Expressions Regular Languages

**1. For any regular expression r the language L(r ) is regular
**

Courtesy Costas Busch - RPI 39

Theorem - Part 2

Languages Generated by Regular Expressions Regular Languages

2. For any regular language L there is a regular expression r with L ( r ) ! L

Courtesy Costas Busch - RPI

40

Proof - Part 1

1. For any regular expression r the language L (r ) is regular

Proof by induction on the size of

r

Courtesy Costas Busch - RPI

41

Induction Basis

Primitive Regular Expressions: NFAs

, P, E

L( M1 ) ! ! L() L( M 2 ) ! {P} ! L(P )

a

regular languages

L( M 3 ) ! {a} ! L(a )

Courtesy Costas Busch - RPI 42

Inductive Hypothesis

Assume for regular expressions r and r2 1 that L(r1 ) and L(r2 ) are regular languages

Courtesy Costas Busch - RPI

43

Inductive Step

We will prove:

Lr1 r2 Lr1 r2 Lr1 * Lr1

Are regular Languages

Courtesy Costas Busch - RPI

44

By definition of regular expressions:

**Lr1 r2
! Lr1
Lr2
Lr1 r2
! Lr1
Lr2
Lr1 *
! Lr1
* Lr1
! Lr1
**

Courtesy Costas Busch - RPI 45

By inductive hypothesis we know: L(r1 ) and L(r2 ) are regular languages

We also know: Regular languages are closed under: Union Concatenation Star

Lr1 Lr2 Lr1 Lr2

Lr1
*

Courtesy Costas Busch - RPI 46

Therefore:

**Lr1 r2
! Lr1
Lr2
Lr1 r2
! Lr1
Lr2
Lr1 *
! Lr1
*
**

Courtesy Costas Busch - RPI 47

Are regular languages

And trivially:

L((r1 )) is a regular language

Courtesy Costas Busch - RPI

48

Proof ² Part 2

2. For any regular language L there is a regular expression r with L ( r ) ! L

Proof by construction of regular expression

Courtesy Costas Busch - RPI

49

Since L is regular take the NFA M that accepts it

L( M ) ! L

**Single final state
**

Courtesy Costas Busch - RPI 50

**From M construct the equivalent Generalized Transition Graph
**

in which transition labels are regular expressions

Example:

M

a

a, b

Courtesy Costas Busch - RPI

c

a

ab

c

51

Another Example:

b a q0 b q1 a, b

b q2

b a q0 b

Courtesy Costas Busch - RPI

b

q1 a b q2

52

Reducing the states:

b a

b

q0 b

q1 a b q2

bb * a q0 bb * ( a b)

b q2

53

Courtesy Costas Busch - RPI

Resulting Regular Expression:

bb * a q0

bb * ( a b)

b

q2

r ! (bb * a ) * bb * (a b)b * L(r ) ! L( M ) ! L

Courtesy Costas Busch - RPI 54

Removing states:

In General e g d qi

a

c

q

b

f

qj

ae * d

g ceced d **

ce * b

qi f aeb b ae * *

Courtesy Costas Busch - RPI

qj

55

The final transition graph:

r1 r3

r4

q0

r2

qf

The resulting regular expression: r ! (r1 r2 r4 * r3 ) * r2 r4 * r ! r1 * r2 (r4 r3 r1 * r2 ) *

L(r ) ! L( M ) ! L

Courtesy Costas Busch - RPI 56

Theorem

If L ! L ( A) for some DFA A Then there is a regular expression R such that

L ! L(R)

Proof: (by induction on the size of R) Let A·s states be {1, 2, «, n} for some integer n Construct a collection of regular expressions that describe progressively broader sets of paths in DFA A

57

Let R be the regex that represent the set of strings w such that w is the label of a path from state i to j in A, and that path has no intermediate state who·s label is greater than k. Note: beginning & end points, i.e. i & j are not intermediate so they can be greater than k

(k ) ij

Courtesy Costas Busch - RPI

58

Inductive Definition

Basis: k = 0 Since all states are >= 1, restriction on the paths is that the path must have no intermediate states at all. If i j An arc from i to j ( 0) Depending of the DFA A Rij may be , a or

R

( 0) ij

! a1 a2 . am

**(If there are m symbols that label arcs from i to j)
**

59

Inductive Definition

If i = j all loops from i to itself legal paths of length 0

R

(0) ij

! P a1 a2 . am

(If there are m symbols that label arcs from i to i)

60

Inductive Definition

Induction: Suppose that there is a path from i to j that goes through no state with label higher than k. Consider two cases path does not go thru state k at all.

i

j

(k ) ij

R

!R

( k 1) ij

61

path goes thru state k at least once - More than once once

i

k

k

k

j

R R

( k 1) ik

(R

( k 1) ij

( k 1) * kk

)

R

( k 1) * kk

( k 1) kj

(k ) ij

!R

R

( k 1) ik

(R

) R

( k 1) kj

62

Software Testing Techniques

Software Testing Strategies

Analysis Modeling

Software Cost and Effort Estimation in Software Engineering Process

Software Cost and Effort Estimation

Lect 5 Team Orgnization

Lect 4 Cost Estimation

Lect 3 Project Management

Software Engineering 1- Lec 5 Software Project Managment

Well Meadows Hospital Normalization

Tutorial on database modeling and ERD.

Normalization Exercise Answer

Normalization Notes

ERD To Relational Model Example

ERD Database Model Notes

ERD database modeling.

developerdmodel

Conceptual Data Modeling

Cmmi Uaar Seminar 2012

ch05

Ch03

Ch02

Ch01

Lect 4 Req Engin Process

S.E Lec 2

- Read and print without ads
- Download to keep your version
- Edit, email or read offline

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

CANCEL

OK

You've been reading!

NO, THANKS

OK

scribd

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->