Entailment with Conditional Equality Constraints - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Entailment with Conditional Equality Constraints

Description:

Entailment with Conditional Equality Constraints. Zhendong Su Alex Aiken ... (C1 V C2) Flanagan and Felleisen [PLDI'97] atomic set constraint entailment ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 25
Provided by: zhend
Category:

less

Transcript and Presenter's Notes

Title: Entailment with Conditional Equality Constraints


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
3
Constraint Simplification
  • Removing redundant constraints from a system.
  • Example (using unification constraints)
  • C xy, yz, xz
  • xy and yz implies xz, get C xy, yz
  • How about if we are only interested in the
    variables x and y?

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 xy,yz ? xz
  • 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 xy ?x,y xy,yz,xz

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
6
Related Work
  • Theoretical issues
  • subtyping entailment
  • (C1 ? ? ? ?) Henglein and Rehof LICS97,
    ICALP98
  • set constraint entailment
  • (C1 ?V C2) Flanagan and Felleisen PLDI97
  • atomic set constraint entailment
  • (C1 ? ? ? ?) Niehren, Mueller, and Talbot
    LICS99
  • polymorphic type simplification
  • (??.?\C) Aiken, Wimmers, and Palsberg TACS97

7
Related Work (cont.)
  • Practical simplifications
  • polymorphic type simplification
  • Fahndrich and Aiken SC96
  • Pottier ICFP96
  • Marlow and Wadler (Erlang) ICFP97
  • set constraint simplification (C1 ?V C2)
  • Flanagan and Felleisen PLDI97
  • constraint solving
  • Fahndrich, Foster, Su, and Aiken PLDI98
  • Su, Fahndrich, and Aiken POPL00

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.

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 ?(?) ?(?)

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 ? ?

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.

12
An Example
?
?
?
?
?
?
t1
t2
t3
t
C2
C1
Does C1 ? C2 ?
NO
Does C1 ??, ?, ? C2 ?
YES
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

14
Closed Systems
?
?
?
?
?
?
?
?
?
?
t1
t2
?
?
t3
t4
t1
t2
?
?
?1
?1
t
t
Example
Closed system for example
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
t1
t2
?
?
?1
?1
t
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 .

17
Completion
  • Lemma 3. Through a completion procedure, C1 ?V C2
    can be reduced to C1 ?V C2, where C2 is a
    closed system.
  • See paper for details.

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.

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

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
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
?
t
s
?
22
The Reduction (cont.)
  • To ensure at most one of ?x and ?x is ?
  • ? is not satisfiable iff C1 ?V C2 (?x, ?x in V)

?x1
?x1
?xn
?xn
...
?xn
?x1
t1
...
?xn
tn
?x1
...
?
s1
sn-1
?
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

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
Write a Comment
User Comments (0)
About PowerShow.com