“a procedure for checking equality of regular expressions” - a. ginzburg presented by kenneth...

16
“A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of Regular Expressions." Journal of the ACM 14.2 (1967): 355-62. Web.

Upload: gary-harrell

Post on 19-Dec-2015

226 views

Category:

Documents


2 download

TRANSCRIPT

“A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS”

- A. GINZBURG

Presented by Kenneth Burgess

Ginzburg, A. "A Procedure for Checking Equality of Regular Expressions." Journal of the ACM 14.2 (1967): 355-62. Web.

CONNECTION TO CLASS

FA -> TG -> RE -> FA Polymorphism

In acquiescence to the insatiable demands of a ravening appetite, I require sustenance in the form of ingested nutrition.

Yes.

The Equality Dilemma

MOTIVE – WHY THIS MATTERS

Algorithmic

Which translates into…

FINALLY, THE PROCEDURE

Taking advantage of polymorphism RE -> TG -> Finite set of left linear

equationsY = aYa + bYb + ^

Ya = aYaa + bYab

Yb = aYba + bYbb

If each possible pairing of derivatives share “^”, the RE’s are equal.

THE THEORY BEHIND

Taking derivatives of a RE Definition of a derivative

R = ab+bab(a+b)* An example derivative: R(b) =

ab(a+b)* You try: R(a) =

LINEAR EQUATIONS

Now we take the finite set of !!unequal!! derivatives

R = a + ba*R = aRa+ bRb

Ra = aRaa + bRab + ^ = aRaa + bRab + ^

Rb = aRba+ bRbb + ^ = aRb + bRaa+ ^

Raa = aRaaa + bRaab = aRaa + bRaa

CHARACTERISTICS OF DERIVATIVES Every RE has a finite number of unequal

derivatives Similar to our proposition -> every RE will

produce a TG of finite states

Every derivative has a corresponding set of vertices in the graph In short, Rx is rep. by the same TG as R, but with

Ax as initial vertice

EXAMPLE – R ~ S

PAIRS

# of distinct derivatives = # of distinct sets of beginning inputs

To consider equality, we have to consider all possible beginning inputs for both regular expressions

u (the number of pairs of inputs we have to consider) <= mn

u (distinct pairs of R and S) <= m (distinct derivatives of R) n (distinct derivatives of S)

PAIRS OF R AND S

Pair (Rx,Sx)

Infers R has ^? S has ^?

(^,^) (a,a)(b,b)

(a,a) Yep Yep

(b,b) (ba,ba) Yep YepHowever, we do not continue, since ba is considered equal to bSince the columns R has ^? and S has ^? agree, the two RE’s are equivalent.

TABLE REPRESENTATION

Inputs Vertices of R Equal To ^?1 2 3

^ xa x xb x xba x b x

To streamline this process, we create tables of equivalencies – showing derivatives (or inputs), vertices corresponding, and whether they include ^.

HOW DOES THIS HELP US?

Examine T0

When 0 is inputted into the graph,2 -> 43 -> 2

HOW DOES THIS HELP US?

Examine T^

When ^ is put into the graph,what happens?

HOW DOES THIS HELP US?

A^ are the starting verticesSo A^ T^ = A^

Relational functions… so 2 T1 = 2 (does nothing)2 T0 = 4 (input 2, get out 4)2 T^ = 2,3

HOW DOES THIS HELP US?

- A(10) can be computed by relational functions.- Computers can produce the derivatives.- Computers can check equivalency as long as they keep track of which states are accepting states

TO REVIEW

RE -> TG Construct table representation of

possible inputs Represent TG as set of relational

matrices Determine U, the set of unique pairs of R

and S inputs For each pair in U, determine if both R

and S agree on whether or not they accept