Top Banner
“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.
16

“A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

Dec 19, 2015

Download

Documents

Gary Harrell
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

“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.

Page 2: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

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

Page 3: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

MOTIVE – WHY THIS MATTERS

Algorithmic

Which translates into…

Page 4: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

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.

Page 5: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

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

Page 6: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

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

Page 7: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

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

Page 8: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

EXAMPLE – R ~ S

Page 9: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

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)

Page 10: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

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.

Page 11: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

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 ^.

Page 12: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

HOW DOES THIS HELP US?

Examine T0

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

Page 13: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

HOW DOES THIS HELP US?

Examine T^

When ^ is put into the graph,what happens?

Page 14: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

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

Page 15: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

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

Page 16: “A PROCEDURE FOR CHECKING EQUALITY OF REGULAR EXPRESSIONS” - A. GINZBURG Presented by Kenneth Burgess Ginzburg, A. "A Procedure for Checking Equality of.

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