- 62 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about 'INHERENT LIMITATIONS OF COMPUTER PROGRAMS' - pascal

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

CSci 4011

INHERENT LIMITATIONS OF COMPUTER PROGRAMS

q1

1

0

0,1

1

M

q0

q2

0

0

1

q3

M = (Q, Σ, , q0, F) where

Q = {q0, q1, q2, q3}

Σ = {0,1}

: Q Σ→ Q transition function*

q0 Q is start state

F = {q1, q2} Q accept states

*

THE REGULAR OPERATIONS

Negation: A = { w | w A }

Union: A B = { w | w A or w B }

Intersection: A B = { w | w A and w B }

Reverse: AR = { w1 …wk | wk …w1 A }

Concatenation: A B = { vw | v A and w B }

Star: A* = { w1 …wk | k ≥ 0 and each wi A }

REGULAR EXPRESSIONS

- is a regular expression representing {}

ε is a regular expression representing {ε}

is a regular expression representing

If R1 and R2 are regular expressions representing L1 and L2 then:

(R1R2) represents L1L2

(R1 R2) represents L1 L2

(R1)* represents L1*

REGULAR EXPRESSIONS

(+ ∪- ∪ε) {0…9}* (. ∪ε) {0…9}+

* NICK STINKS *

CSCI {1...4}{0...9}{0...9}{0…9}

* NICK RULES *

{ w | w has exactly a single 1 }

0*10*

{ w ||w|≥ 3 and its 3rd symbol is 0 }

ΣΣ0Σ*

{ w | every odd position of w is a 1 }

(1Σ)*(1∪ε)

EQUIVALENCE

Given regular expression R, we show there exists NFA N such that R represents L(N)

L can be represented by a regexp

L is a regular language

Induction on the length of R:

Given regular expression R, we show there exists NFA N such that R represents L(N)

Induction on the length of R:

L can be represented by a regexp

L is a regular language

Base Cases (R has length 1):

R =

R = ε

R =

Inductive Step:

Assume R has length k > 1 and that any regular expression of length < k represents a language that can be recognized by an NFA

Three possibilities for R:

R = R1 R2

R = R1R2

R = (R1)*

0

0

01*0

1

Proof idea: Transform an NFA for L into a regular expression by removing states and re-labeling the arrows with regular expressions

L can be represented by a regexp

L is a regular language

a∪b

a

q2

GENERALIZED NFAsa*b

qs

qa

G accepts w if it finds q0q1…qk, w1…wk:

wi∈R(qi,qi+1)

w = w1w2…wk

q0=qs, qk=qa

R(qs,q2) = a*b

R(qa,q) = Ø

R(q,qs) = Ø

ε

ε

ε

ε

ε

GNFA TO REGEXP

NFA

While machine has more than 2 states:

Pick an internal state, rip it out and re-label the arrows with regular expressions to account for the missing state

Convert the NFA to a regular expression

a, b

(a b)b*b(bb*b)*

b

q1

q2

(a b)b*b

ε

b

(a b)b*b(bb*b)*a

bb*b

a

b

ε

q3

ε

((a b)b*b(bb*b)*a)*

((a b)b*b(bb*b)*a)*(a b)b*b(bb*b)*

Formally:

Add qstart and qaccept to create G

Run CONVERT(G):

If #states = 2

return the expression on the arrow going from qstart to qaccept

If #states > 2

Formally:

Add qstart and qaccept to create G

Run CONVERT(G):

If #states > 2

select qripQ different from qstart and qaccept

define Q = Q – {qrip}

define Ras:

R(qi,qj) = R(qi,qrip)R(qrip,qrip)*R(qrip,qj) R(qi,qj)

return CONVERT(G)

Download Presentation

Connecting to Server..