1 / 59

Kleene Algebra with Tests (Part 3: Theoretical Results)

Kleene Algebra with Tests (Part 3: Theoretical Results). Dexter Kozen Cornell University Workshop on Logic & Computation Nelson, NZ, January 2004. These Lectures. Tutorial on KA and KAT model theory complexity, deductive completeness relation to Hoare logic Practical applications

desma
Download Presentation

Kleene Algebra with Tests (Part 3: Theoretical Results)

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Kleene Algebra with Tests(Part 3: Theoretical Results) Dexter Kozen Cornell University Workshop on Logic & Computation Nelson, NZ, January 2004

  2. These Lectures • Tutorial on KA and KAT • model theory • complexity, deductive completeness • relation to Hoare logic • Practical applications • compiler optimization • scheme equivalence • static analysis • Theoretical applications • automata on guarded strings & BDDs • algebraic version of Parikh’s theorem • representation • dynamic model theory

  3. Kripke Frames over P,B K = (K, mK) mK : P 2K  KP = atomicprograms mK : B 2KB = atomic tests mK specifies a canonical interpretation for P,B TP,B = {KAT terms over P,B}

  4. Traces K = (K, mK) mK : P 2K  KP = atomicprograms mK : B 2KB = atomic tests A trace in K is a sequence x = u0p0u1p1u2 … un-1pn-1un, n  0, (ui,ui+1)  mK(pi) u0p0u1 … un-1pn-1un · unpnun+1 … um-1pm-1um = u0p0u1 … pn-1unpn … um-1pm-1um TracesK = {traces in K} ,,... denote traces

  5. Trace Algebras A,B  TracesKC  K A+B = A  BAB = { |  A,  B} A* = Un0An1 = K 0 = C = K − C [[p]]K= {upv | (u,v) mK(p)}, p  P [[b]]K= mK(b), b  B extends to KAT homomorphism [[ ]]K : TP,B 2Traces(K) TrK = { [[p]]K | p  TP,B} regular trace algebra of K

  6. Guarded Strings over P,B[Kaplan 69] • AtomsB= {atoms of free BA on B} • , , denote atoms • guarded strings 0p01p12p23  n-1pn-1n • join-irreducible elements of the free KAT on P,B • traces in Kripke frame G = (AtomsB,mG) • mG(p) = AtomsB x AtomsB • mG(b) = { |   b} • TrG = {regular sets of guarded strings}

  7. Relation Algebras A,B  K x K C  idK = {(u,u) | u  K} A+B = A  BAB = A  B A* = Un0An1 = idK0 = C = idK − C [p]K= mK(p), p  P [b]K= {(u,u) | u  mK(b)}, b  B extends to KAT homomorphism [ ]K : TP,B 2K x K RelK = { [p]K | p  TP,B} regular relation algebra of K

  8. Traces and Relations • RelK is a homomorphic image of TrK • Ext(A) = {(first(),last() |   A} • Ext : 2Traces(K) 2K x K • Ext : TrK RelK Ext([[p]]K) = [p]K • TrK is isomorphic to a relation algebra on TracesK • Rel(A) = {(,) |   TracesK,   A} • Thus Eq(REL) = Eq(TR)

  9. Traces and Relations g : K  AtomsB g(u) = unique  such that u  [[]]K g : TracesK  TracesG g(u0p0u1 … un-1pn-1un) = g(u0)p0g(u1) … g(un-1)pn-1g(un) g−1 : 2Traces(G) 2Traces(K) g−1(A) = {x | g(x)  A} g−1 : TrG TrKg−1([[p]]G) = [[p]]K Thus TrG is universal for relational and trace algebras

  10. Automata on Guarded Strings • ordinary finite automaton on alphabet P TB • transitions labeled p  P are action transitions • transitions labeled b  TB are test transitions • inputs are guarded strings 0p01  n-1pn-1n

  11. Automata on Guarded Strings • read head always points to an atom, initially 0 • an action transition with label p is enabled if p is the next action symbol in x; advance the head past p • a test transition with label b is enabled if   b, where  is the current atom in x; do not advance the head • accept if occupying an accept state while scanning n • ordinary NFA with -transitions is an AGS with B = {0,1}

  12. Kleene’s Theorem for AGS A set of guarded strings is accepted by some AGS over P,B iff it is [[p]]G for some p  TP,B

  13. Determinization of AGS • An AGS is deterministic if • there is exactly one start state • each state is either an action state (has exiting action transitions) or a test state (has exiting test transitions) but not both • every action state has exactly one exiting action transition for each p  P (exactly one enabled) • the exiting test transitions of a test state are pairwise exclusive and exhaustive (exactly one enabled) • every cycle contains at least one action transition • all accept states are action states

  14. Determinization of AGS Theorem Every nondeterministic AGS is equivalent to a deterministic AGS Proof Subset construction

  15. State Minimization Theorem If all possible tests are allowed, then minimal unique deterministic AGSs exist

  16. d d c c c c c c d d d d State Minimization If only B and B = {b | b  B} are allowed as tests, then minimal deterministic AGSs are not unique {cd,cd}

  17. State Minimization Theorem If only B and B = {b | b  B} are allowed as tests, and if the elements of B and B must be tested in some fixed order, then unique minimal deterministic AGSs exist Special case unique minimal ordered BDDs

  18. Myhill-Nerode Theorem for AGS One can define an overlay operation ^ on prefixes of guarded strings Given a set A of guarded strings, define x A y  z (x^z  A  y^z  A) Theorem A is regular iff A has finitely many classes. The A-classes give the minimal deterministic ordered AGS

  19. Representation Under what conditions is a given abstract KAT (K,B) guaranteed to be isomorphic to a relational KAT?

  20. Representation • Under what conditions is a given abstract KAT (K,B) guaranteed to be isomorphic to a relational KAT? • (bcbqc = 0  bpc = 0)  p  q • pq = 0  bpb = 0  bq = 0 • Theorem These conditions, together with *-continuity, are sufficient for nonstandard representation • Proof states = ultrafilters of B • p’ = {(u,v) | b  u c  v bpc  0}

  21. Dynamic Model Theory • Consider 1st-order KAT over a fixed signature • atomic actions = assignments x := e • atomic tests = atomic formulas R(e1,...,en) • A Kripke frame is Tarskian if it arises from a first-order structure A • states = valuations of variables over A • mA(x := e) = { (u,u[x/u(e)]) | u : Var  A} • mA(R(e1,...,en)) = {u | u = R(e1,...,en)} |

  22. Dynamic Model Theory Obs The equational theories of relation and trace algebras of Tarskian frames do not coincide x := 1; y := 2 and y := 2; x := 1 are equivalent in the relation algebra but not in the trace algebra Question Can we find algebras that are universal for the Tarskian trace and relation algebras? (i.e., that play the same role as the regular sets of guarded strings for KAT)

  23. Dynamic Model Theory Let T be a first-order theory A quantifier-free type (qf-type) is a maximal consistent set of quantifier-free formulas A qf-type of T is a qf-type consistent with T qf-types correspond to atoms in the guarded string model

  24. Dynamic Model Theory • Define the frame (U,mU) • U = {qf-types of T} • mU(x := e) = {(,{ | [x/e]  }) |   U} • mU (P(e1,...,en)) = {  U | P(e1,...,en)  } • Theorem TrU is universal for the equational theory of Tarskian trace algebras over models of T: • [[p]]U = [[q]]U iff [[p]]A = [[q]]A for all models A of T • Note that U itself is not Tarskian in general!

  25. Dynamic Model Theory • Not true for RelU ! • [P(c)  P(d) ; x := c]U = [P(c)  P(d) ; x := d]U • but these two programs are not equivalent in any Tarskian frame in which c  d • However they are observationally equivalent (indistinguishable by any formulas in the language)

  26. Dynamic Model Theory Theorem RelU is universal for the equational theory of relation algebras of Tarskian frames over models of T modulo observational equivalence; i.e., [p]U = [q]U iff p and q are observationally equivalent over all models of T

  27. Complexity of Scheme Halting and Equivalence Theorem Let T be a recursive qf-theory. The scheme halting and scheme equivalence problem over models of T are 1 and 1 complete, respectively Corollary There is no relatively complete deductive system for scheme equivalence (or inequivalence) 0 0

  28. Parikh’s Theorem [Parikh 66] • Every context-free language is letter equivalent to a regular set • Letter equivalence: just count occurrences of letters in strings, ignore order

  29. Examples • {ababca}  {aaabbc, cbbaaa} • {anbn | n  0} (ab)* • A is letter equivalent to B •  • every string in A has an anagramin B and vice versa

  30. Parikh Map • #a(x) = number of occurrences of a in x • (x) = (#a1(x),...,#an(x)) Parikh vector • (A) = {(x) | x  A} commutative image • Examples • ({ababca, cbbaaa}) = {(3,2,1)} • ({anbn | n  0}) = ((ab)*) = {(n,n) | n  0} • A is letter equivalent to B (A) = (B) def

  31. Parikh’s Theorem (Parikh's version) • Every context-free language is letter equivalent to a regular set.

  32. Parikh’s Theorem (Parikh's version) • Every context-free language is letter equivalent to a regular set. • Parikh’s Theorem (our version) • Every commutative Kleene algebra is uniformly algebraically closed.

  33. Commutative Kleene Algebra (CKA) • xy = yx • A theorem of CKA but not KA • (p+q)* = p*q* • () 1 + (p+q)p*q* = 1 + pp*q*+qp*q* • = 1 + pp*q*+p*qq* •  p*q* •  (p+q)*  p*q*

  34. Using(p+q)* = p*q* can show • Normal Form [Pilling 73] • Every expression is equivalent to • y1+ ... + yn, where yiis a product of am and (a1...ak)*. • Example • (((ab)*c)* + d)* = d* + (ab)*c*cd*

  35. Standard Model Reg(Nn) = regular sets of Parikh vectors in Nn A + B = A  B AB = {x + y | x  A, y  B} A* = Un0 An = A0 A1 A2 ... 1 = {(0,...,0)} 0 =  This is thefree CKAon n generators

  36. Algebraic Closure • Every system of polynomial inequalities • f1(x1,...,xn)  x1 • . • . • . • fn(x1,...,xn)  xn • over a CKA K has a unique least solution in Kn.

  37. Uniform Algebraic Closure • Every system of polynomial inequalities • f1(x1,...,xn)  x1 • . • . • . • fn(x1,...,xn)  xn • over a CKA K has a unique least solution in Kn. The components of the solution are given by polynomials in the coefficients of thefi.

  38. A context-free grammar is just a system of polynomial inequalities over the KA (*) • The associated context-free language is its least solution in (*) • Commutativity models letter equivalence • Examples • {anbn | n  0} S  aSb |  axb + 1  x • {balanced parens}S  (S) | SS |  (x) + xx + 1  x • {palindromes}S  aSa | bSb | a | b |  • axa + bxb + a + b + 1  x

  39. Previously known for • Reg(Nn) [Pilling 73] • commutative -continuous semirings [Kuich 87]

  40. Approach • differential operators /x on polynomials • Taylor’s theorem f(x+d) = f(x) + f(x+d)d • closed form solution for n inequalities in n unknowns involving the Jacobian matrix

  41. Polynomials K[x,y,...] (ax + by)* 1 + (ax*b*)* + bx + cy a + xy(bxy)* a,b,...  K x,y,... variables K[x,y,...]is a CKA

  42. K K[x,y,...] {x,y,...} L eval Polynomials K[x,y,...] (ax + by)* 1 + (ax*b*)* + bx + cy a + xy(bxy)* a,b,...  K x,y,... variables K[x,y,...]is a CKA K[x,y,...]is the direct sum (coproduct) of K and the free CKA on {x,y,...}

  43. Differential Operators • A map D:K  K is called a differential operator if for all x,y  K, • D(x+y) = Dx + Dy • D(xy) = xDy + yDx • D(x*) = x*Dx • D0 = D1 = 0

  44. K K[x,y,...] {x,y,...} K[x,y,...] • Differential Operators • A map D:K  K is called a differential operator if for all x,y  K, • D(x+y) = Dx + Dy • D(xy) = xDy + yDx • D(x*) = x*Dx • D0 = D1 = 0

  45. x (ax2y + bxy2 + (ax)* + 1) = axy + by2 + a(ax)* (x) = 1 (y) = 0, y  x  y (ax2y + bxy2 + (ax)* + 1) = ax2 + bxy  x  x  x  x (a) = 0, a  K  x Differential Operators :K[x,...]  K[x,...], where Examples

  46.  x  f  x  e  x (f(e)) = (e) · • Chain Rule • For f, e  K[x], • or in more conventional notation, • f(e(x)) = f(e(x))  e(x)

  47. Taylor’s Theorem • For f, d  K[x], • f(x+d) = f(x) + f(x+d)  d • In particular, evaluating at x = 0, • f(d) = f(0) + f(d)  d

  48. Theorem • Let K be a CKA and let f(x)  K[x]. The least solution of f(x)  x is f(f(0))*  f(0).

  49. Theorem • Let K be a CKA and let f(x)  K[x]. The least solution of f(x)  x is f(f(0))*  f(0). • Example{anbn | n  0} • f(x)  x axb + 1  x • f(x) axb + 1 • f(x) ab • f(0) 1 • f(f(0))*  f(0) (ab)*

  50. Theorem • Let K be a CKA and let f(x)  K[x]. The least solution of f(x)  x is f(f(0))*  f(0). • Example{balanced parentheses} • f(x)  x axb + x2 + 1  x • f(x) axb + x2 + 1 • f(x) ab + x • f(0) 1 • f(f(0))*  f(0) (ab + 1)* = (ab)*

More Related