1 / 24

Entailment with Conditional Equality Constraints

Entailment with Conditional Equality Constraints. Zhendong Su Alex Aiken University of California, Berkeley. Constraint Based Analysis. Basic Idea:. program source. constraint generation. constraints. constraint resolution. analysis results. Constraint Simplification.

hastin
Download Presentation

Entailment with Conditional Equality Constraints

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. Entailment with Conditional Equality Constraints Zhendong Su Alex Aiken University of California, Berkeley

  2. Constraint Based Analysis • Basic Idea: program source constraint generation constraints constraint resolution analysis results ESOP'01

  3. Constraint Simplification • Removing redundant constraints from a system. • Example (using unification constraints) • C = {x=y, y=z, x=z} • x=y and y=z implies x=z, get C’ = {x=y, y=z} • How about if we are only interested in the variables x and y? ESOP'01

  4. Constraint Entailment • Entailment is a decision problem • justify a potential candidate for simplification • shed light on the hardness of simplification • Simple Entailment C1  C2 • holds if every solution of C1 is a solution of C2. • Example: {x=y,y=z}  {x=z} • Restricted Entailment C1 V C2 • holds if for every solution of C1 there exists a solution of C2 s.t. they agree on V. • Example: {x=y} {x,y} {x=y,y=z,x=z} ESOP'01

  5. How to Use Entailment? • Simplify C • Simplify C with respect to V C’ := C for each ci  C if(C’\{ci}  ci) C’ := C’\{ci} C’ := C for each ci  C if(C’\{ci} V C’) C’ := C’\{ci} ESOP'01

  6. Related Work • Theoretical issues • subtyping entailment • (C1    ) Henglein and Rehof [LICS’97, ICALP’98] • set constraint entailment • (C1 V C2) Flanagan and Felleisen [PLDI’97] • atomic set constraint entailment • (C1    ) Niehren, Mueller, and Talbot [LICS’99] • polymorphic type simplification • (.\C) Aiken, Wimmers, and Palsberg [TACS’97] ESOP'01

  7. Related Work (cont.) • Practical simplifications • polymorphic type simplification • Fahndrich and Aiken [SC’96] • Pottier [ICFP’96] • Marlow and Wadler (Erlang) [ICFP’97] • set constraint simplification (C1 V C2) • Flanagan and Felleisen [PLDI’97] • constraint solving • Fahndrich, Foster, Su, and Aiken [PLDI’98] • Su, Fahndrich, and Aiken [POPL’00] ESOP'01

  8. Contributions • Give the first interesting class with efficiently decidable entailment problem. • Use novel techniques in constructing the algorithm. • Provide a natural boundary between tractable and intractable constraint theories. ESOP'01

  9. Conditional Unification • simple types:  ::=  |  |  | 12 • ground types: simple types without variables • constraints: 1 = 2   • valuation:  :    •  : variables  : ground types • satisfaction: •  1 = 2  (1)= (2) •      () =  or () = () ESOP'01

  10. Simple Entailment • Theorem 1. C1  C2 is decidable in polynomial time. • Basic idea to decide C   =  •      implies    •    and    implies  =  •     and   implies  =  • apply unification and congruence closure to check if  =  ESOP'01

  11. Restricted Entailment • Theorem 2. C1 V C2 is decidable in polynomial time. • The most interesting and difficult result of the paper. • The key idea: transform the constraints so that we only need to consider at most two conditional constraints at a time. ESOP'01

  12. An Example       t1 t2 t3 t C2 C1 Does C1 C2 ? NO Does C1 {, ,} C2 ? YES ESOP'01

  13. Outline of the Algorithm • Introduce closed systems, for which it is sufficient to consider only pairs of conditional constraints • Entailment with pair constraints can be decided in polynomial time • Reduce entailment to entailment in terms of closed systems to get quadratic # of entailments of pair constraints ESOP'01

  14. Closed Systems           t1  t2  t3 t4 1 t1  t2  1 t t Example Closed system for example ESOP'01

  15. Closed Systems (cont.) • A property: it suffices to consider pairs of conditional constraints for the solutions of a closed system w.r.t. to a set of variables V.       t3 t4 1 t1  t2  1 t ESOP'01

  16. Pair Constraint Entailment • Lemma 1. C1 V C2 can be decidable in polynomial time if C2 consists only unification constraints . • Lemma 2. C1 V C2 can be decidable in polynomial time if C2 consists at most two conditional constraints . ESOP'01

  17. Completion • Lemma 3. Through a completion procedure, C1 V C2 can be reduced to C’1 V’ C’2, where C’2 is a closed system. • See paper for details. ESOP'01

  18. Putting Things Together • Main Theorem:C1 V C2 can be decide in polynomial time. • proof sketch: By Lemma 3, we reduce to entailment in terms of closed systems. We then consider quadratic # of entailment of pair constraints, where each one can be decided in polynomial time by Lemma 2. ESOP'01

  19. An Extension • A natural extension for comparison • add   (1 = 2) • intuitively means either  =  or 1 = 2 •       (= ) • Theorem 3. The entailment problem C1 V C2 is coNP-complete (reduction from 3SAT). ESOP'01

  20. The Reduction • 3SAT •  = C1 …  Cm • Ci = x  ¬y  z • associate x with x and ¬x • meaning x is true iff x and ¬x=    (1 = 2) Use for 2 1 ESOP'01

  21. The Reduction (cont.) • For each boolean variable x • For each clause Ci = x  ¬y  z x ¬x C1: part 1   t ¬ x y ¬z C1: part 2  s t  ESOP'01

  22. The Reduction (cont.) • To ensure at most one of x and¬x is •  is notsatisfiable iff C1VC2 (x, ¬x in V) x1 ¬x1 xn ¬xn ... xn t1 ¬x1 ... tn ¬xn x1 ...  s1 sn-1  ESOP'01

  23. Summary • Polynomial time algorithms for entailment • Algorithms can be used in practice to scale analyses based on conditional equality constraints • An extension to be used as a natural boundary between tractable and intractable constraint theories ESOP'01

  24. Open Problems • Many open problems in this area • Two long standing ones are: • Non-structural subtype entailment • Subtyping polymorphically constrained types • Hardness of simplification means good heuristics are very valuable ESOP'01

More Related