CSci 4011
This presentation is the property of its rightful owner.
Sponsored Links
1 / 28

INHERENT LIMITATIONS OF COMPUTER PROGRAMS PowerPoint PPT Presentation


  • 42 Views
  • Uploaded on
  • Presentation posted in: General

CSci 4011. INHERENT LIMITATIONS OF COMPUTER PROGRAMS. q 1. 1. 0. 0,1. 1. M. q 0. q 2. 0. 0. 1. q 3. M = (Q, Σ , , q 0 , F) where. Q = {q 0 , q 1 , q 2 , q 3 }. Σ = {0,1}.  : Q  Σ → Q transition function *. q 0  Q is start state.

Download Presentation

INHERENT LIMITATIONS OF COMPUTER PROGRAMS

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


Inherent limitations of computer programs

CSci 4011

INHERENT LIMITATIONS OF COMPUTER PROGRAMS


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

*


Inherent limitations of computer programs

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 }


Inherent limitations of computer programs

REGULAR EXPRESSIONS


Inherent limitations of computer programs

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 L1L2

(R1  R2) represents L1 L2

(R1)* represents L1*


Inherent limitations of computer programs

REGULAR EXPRESSIONS

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

* NICK STINKS *

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

* NICK RULES *


Inherent limitations of computer programs

PRECEDENCE

* 

EXAMPLE

R1R2*  R3 =

(R1 (R2*)) ∪R3


Inherent limitations of computer programs

{ 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∪ε)


Inherent limitations of computer programs

EQUIVALENCE

L can be represented by a regexp

L is a regular language


Inherent limitations of computer programs

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:


Inherent limitations of computer programs

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 = 


Inherent limitations of computer programs

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)*


Inherent limitations of computer programs

L can be represented by a regexp

L is a regular language


Inherent limitations of computer programs

Transform (1(0  1))* to an NFA

ε

1

1,0

ε


Inherent limitations of computer programs

CONVERT TO NFAs

a*(b∪ε)a*

(1)*∪1(1)*

(lol∪zomg)*


Inherent limitations of computer programs

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


Generalized nfas

a∪b

a

q2

GENERALIZED NFAs

a*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) = Ø


Inherent limitations of computer programs

ε

ε

ε

ε

ε

NFA TO GNFA

NFA

Add unique and distinct start and accept states


Inherent limitations of computer programs

ε

ε

ε

ε

ε

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


Inherent limitations of computer programs

a

a,b

(a*b)(ab)*

ε

b

ε

a*b

q1

q2

q3

q0

R(q0,q3) = (a*b)(ab)*


Inherent limitations of computer programs

b

bb

a

q1

q2

a

ε

b

ε

b

a

ε

q3


Inherent limitations of computer programs

b

bb

a

q1

q2

a  ba

a

ε

b

ε

b

a

ε


Inherent limitations of computer programs

b

= R(q1,q1)

bb  (a  ba)b*a

bb

a

q1

q2

a  ba

ε

ε

b  (a  ba)b*

b


Inherent limitations of computer programs

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

ε


Inherent limitations of computer programs

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

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


Inherent limitations of computer programs

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


Inherent limitations of computer programs

Formally:

Add qstart and qaccept to create G

Run CONVERT(G):

If #states > 2

select qripQ different from qstart and qaccept

define Q = Q – {qrip}

define Ras:

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

return CONVERT(G)


Inherent limitations of computer programs

NFA

DFA

DEF

Regular

Language

Regular

Expression


  • Login