13.07.2015 Views

paper pdf - Lab for Automated Reasoning and Analysis - LARA

paper pdf - Lab for Automated Reasoning and Analysis - LARA

paper pdf - Lab for Automated Reasoning and Analysis - LARA

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Proof Sketch. It remains to eliminate undetermined shapevariables from β. This process is similar to term algebraquantifier elimination [25, Section 3.4]; the key ingredientis Lemma 10, which relies on the fact that undeterminedparameter variables may take on infinitely many values. Wethere<strong>for</strong>e ensure that the conjuncts outside shapeBase donot constrain the undetermined parameter shape variablesto denote the values from a finite set.Consider an undetermined parameter shape variable u s .u s does not occur in termHom, because all term variablesare determined <strong>and</strong> a conjunct u s =sh(u) would implythat u s is determined as well. u s can thus occur onlyin cardin within some cardinality constraint |φ| u s=k or|φ| u s≥k. Moreover, <strong>for</strong>mula φ in each such cardinality constraintis closed: otherwise φ would contain some free termvariable u <strong>and</strong> since all term variables are determined, u swould be determined as well.Let u s denote some shape s. Because φ is a closed <strong>for</strong>mula,|φ| is equal to 0 if φ C =false <strong>and</strong> to the shape sizem = |leaves(s)| if φ C =true. (The fact that closed <strong>for</strong>mulasreduce to the constraints on the domain size appears in[30, Theorem 3.36, Page 13]. In term powers, these constraintsbecome constraints on the size of the shape.) Wetrans<strong>for</strong>m β into the disjunction β 1 ∨ β 2 of base <strong>for</strong>mulaswhere β 1 ≡ β ∧ prim(φ) <strong>and</strong> β 2 ≡ β ∧ prim(¬φ). Constraintsof the <strong>for</strong>m prim(¬φ) ∧ |φ| u s=k reduce to 0=k,we replace them by true if k≡0 <strong>and</strong> false if k≢0. Onthe other h<strong>and</strong>, prim(φ) ∧ |φ| u s=k denotes the constraintm = k <strong>and</strong> prim(φ) ∧ |φ| u s≥k denotes m≥k. Hence,by repeating this process <strong>for</strong> every <strong>for</strong>mula φ which appearsin some cardinality constraint |φ| u s=k or |φ| u s≥k,we obtain a conjunction of linear constraints of the <strong>for</strong>mm = k <strong>and</strong> m ≥ k. These constraints specify a finiteor infinite set S ⊆ {0, 1, . . .} of possible sizes m. LetA = {s | |leaves(s)| ∈ S}. By nature of our constraints,if the set S is infinite then it contains an infinite intervalof <strong>for</strong>m {m 0 , m 0 + 1, . . .}, so the set A is infinite. If Σcontains a unary constructor <strong>and</strong> S is nonempty, then A isalso infinite. If Σ contains no unary constructors <strong>and</strong> S isfinite then A is finite <strong>and</strong> we can effectively compute A.The cardinality constraints containing u s are thus equivalentto ∨ pi=1 us = t s i where A = {ts 1 , . . . , ts p }. Trans<strong>for</strong>m∨the structural base <strong>for</strong>mula β into a disjunction of <strong>for</strong>mulaspi=1 β i where β i results from β by replacing the cardinalityconstraints containing u s with u s = t s i . Convert each β ito a structural base <strong>for</strong>mula by labelling the subterms of t s iwith internal shape variables using UNF rules, <strong>and</strong> by doingcase analysis on the equality between the new internalshape variables, using ShDis rule. By repeating this process<strong>for</strong> all shape variables u s where the set S is finite, we obtainbase <strong>for</strong>mulas where the set A is infinite <strong>for</strong> every undeterminedparameter shape variable u s . We may then eliminateall undetermined parameter <strong>and</strong> non-parameter shape variablesalong with the conjuncts that contain them. The resultis an equivalent <strong>for</strong>mula because Lemma 10 implies that itis always possible to find the values of eliminated parametervariables, so their existence is a redundant condition. Wethere<strong>for</strong>e eliminate all undetermined shape variables <strong>and</strong> theresulting structural base <strong>for</strong>mulas contain only determinedvariables.Proposition 25 (Struct. Base to Quantifier-Free) Everystructural base <strong>for</strong>mula β can be effectively trans<strong>for</strong>med toan equivalent well-defined quantifier-free <strong>for</strong>mula φ.Proof. Apply Corollary 19, then Lemma 23, <strong>and</strong> thenLemma 24. All variables in the resulting disjunction ofstructural base <strong>for</strong>mulas are determined, so each of themis equivalent to some quantifier free <strong>for</strong>mula φ i by Corollary17. The disjunction ∨ i φ i is the desired quantifier-free<strong>for</strong>mula φ.Summary of Our Quantifier Elimination Algorithm.Consider a closed L P -<strong>for</strong>mula φ. Convert φ to an extendedterm-power<strong>for</strong>mula φ 1 using (2). Convert φ 1 to prenex<strong>for</strong>m φ 2 . Eliminate all quantifiers from φ 2 starting from theinnermost one, as follows. If φ 2 ≡ 〈Q i u ∗ i 〉 i∃v ∗ . ψ where ψis quantifier-free then apply Proposition 13, Proposition 12<strong>and</strong> then Proposition 25. If φ 2 ≡ 〈Q i u ∗ i 〉∀v∗ . ψ then consider〈Q i u ∗ i 〉.¬∃v∗ . ¬ψ <strong>and</strong> proceed as in the previous case.By applying Proposition 13 <strong>and</strong> Proposition 25 to the resultingvariable-free <strong>for</strong>mula we obtain a propositional combinationof prim(φ) <strong>for</strong>mulas. Theorem 3 then follows by (3).Acknowledgements We thank Albert Meyer, Jens Palsberg,Tim Priesnitz, Stefan Ratschan, Jakob Rehof, ZhendongSu, <strong>and</strong> anonymous reviewers <strong>for</strong> useful comments.References[1] A. Aiken, D. Kozen, <strong>and</strong> E. Wimmers. Decidability ofsystems of set constraints with negative constraints.In<strong>for</strong>mation <strong>and</strong> Computation, 122, 1995.[2] A. Aiken, E. L. Wimmers, <strong>and</strong> T. K. Lakshman. Soft typingwith conditional types. In Proc. 21st ACM POPL, pages163–173, New York, NY, 1994.[3] H. Ait-Kaci, A. Podelski, <strong>and</strong> G. Smolka. A featureconstraint system <strong>for</strong> logic programming with entailment.In Theoretical Computer Science, volume 122, pages263–283, January 1994.[4] R. M. Amadio <strong>and</strong> L. Cardelli. Subtyping recursive types.Transactions on Programming Languages <strong>and</strong> Systems,15(4):575–631, 1993.[5] L. O. Andersen. Program <strong>Analysis</strong> <strong>and</strong> Specialization ofthe C Programming Language. PhD thesis, DIKU,University of Copenhagen, 1994.[6] R. Backofen. A complete axiomatization of a theory withfeature <strong>and</strong> arity constraints. Journal of LogicProgramming, 24:37–72, 1995.10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!