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.

ecomes ∃u, v 1 , v 2 . x=f(v 1 , v 2 ) ∧ u=v 1 ). The resultcontains only the relation <strong>and</strong> function symbols thatoccur in structural base <strong>for</strong>mulas. Make sure each termvariable has a corresponding shape variable by applyingrules ShpInt. For example, ∃v 1 , v 2 . x=f(v 1 , v 2 )becomes ∃v 1 , v 2 , x s , v1 s, vs 2 . sh(v 1)=v1 s ∧ sh(v 2)=v2 s ∧sh(x)=x s ∧ x=f(v 1 , v 2 ). Next, apply congruenceclosure (CongCl) <strong>and</strong> occur check (OccChk). For example,∃x, u, v 1 , v 2 . x=f(v 1 , v 2 ) ∧ y=f(u, v 2 ) ∧ u=v 1becomes ∃x, u, v 2 . x=f(u, v 2 ) ∧ y=x, whereasx=f(u, v) ∧ u=f(x, v) becomes false. Use HomExprules to ensure that parameter term variables are mapped toparameter shape variables, non-parameter term variablesare mapped to non-parameter shape variables, <strong>and</strong> thatthe homomorphism property P3) of Definition 11 holds.Repeat CongCl <strong>and</strong> OccChk rules if needed. For example,∃v 1 , v 2 , x s , v1 s, vs 2 . sh(v 1)=v1 s ∧ sh(v 2)=v2 s ∧ sh(x)=xs ∧x=f(v 1 , v 2 ) becomes ∃v 1 , v 2 , x s , v1, s v2. s sh(v 1 )=v1 s ∧sh(v 2 )=v2 s ∧ sh(x)=xs ∧ x=f(v 1 , v 2 ) ∧ x s =f s (v1 s, vs 2 ).Eliminate all disequalities between term variables usingthe NEQEl rule, which is justified by the negation of theequivalence:t 1 = t 2 ⇐⇒ sh(t 1 ) = sh(t 2 ) ∧ |t 1 = t 2 | sh(t1) = 0 (4)For example, u≠x ∧ sh(u)=u s ∧ sh(x)=x s becomes((u s ≠x s )∨(u s =x s ∧|u≠x| u s≥1))∧sh(u)=u s ∧sh(x)=x s .Repeat previous stages (e.g. DNF, CongCl, OccChk) ifneeded. Convert all cardinality constraints into constraintson parameter term variables, using CCD rules justifiedby (1), e.g. |u≠v| u s=1 becomes (|u 1 ≠v 1 | u s1=0 ∧|u 2 ≠v 2 | u s2=1) ∨ (|u 1 ≠v 1 | u s1=1 ∧ |u 2 ≠v 2 | u s2=0)in the context of u=f(u 1 , v 1 ) ∧ v=f(v 1 , v 2 ) ∧u s =f s (u s 1 , us 2 ) ∧ sh(u)=sh(v)=us ∧ sh(u 1 )=sh(v 1 )=u s 1 ∧sh(u 2 )=sh(v 2 )=u s 2. Finally, to produce the <strong>for</strong>muladistinct(u s 1 , . . .,us n ) use ShDis to ensure that <strong>for</strong> every twoshape variables x s 1 <strong>and</strong> xs 2 occurring in the conjunctionexactly one of the conjuncts x s 1=x s 2 or x s 1≠x s 2 is present.2.5. Conversion to Quantifier-Free FormulasThe conversion from structural base <strong>for</strong>mulas toquantifier-free <strong>for</strong>mulas is the main phase of our quantifiereliminationalgorithm. We split this conversion into severalstages; Proposition 25 below summarizes the overall conversionprocess.Consider a structural base <strong>for</strong>mula β ≡ ∃ū ∗ . C(¯x ∗ , ū ∗ )with free variables ¯x ∗ <strong>and</strong> internal variables ū ∗ , whereC(¯x ∗ , ū ∗ ) is quantifier-free. C(¯x ∗ , ū ∗ ) defines a relationbetween variables ¯x ∗ , ū ∗ . If this relation has a functionaldependence from the free variables ¯x ∗ to some internal variableu, with a term t(¯x ∗ ) such that C(¯x ∗ , ū ∗ ) |= u = t(¯x ∗ ),then the internal variable u can be replaced by t(¯x ∗ ) <strong>and</strong>the quantification over u can be eliminated. This leads tothe notion of determinations.Definition 14 The set dets of variable determinations of astructural base <strong>for</strong>mula β is the least set S of pairs 〈u ∗ , t ∗ 〉where u ∗ is an internal term or shape variable <strong>and</strong> t ∗ is aterm over the free variables of β, such such that:1. if x ∗ = u ∗ occurs in termBase or shapeBase <strong>for</strong> afree variable x ∗ , then 〈u ∗ , x ∗ 〉 ∈ S;2. if 〈u ∗ , t ∗ 〉 ∈ S <strong>and</strong> u ∗ = f ∗ (u ∗ 1 , . . . , u∗ k) occurs inshapeBase or termBase then{〈u ∗ 1, f1 ∗ (t ∗ )〉, . . . , 〈u ∗ k , f k ∗(t∗ )〉} ⊆ S;3. if {〈u ∗ 1 , t∗ 1 〉, . . . , 〈u∗ k , t∗ k 〉} ⊆ S <strong>and</strong>u ∗ = f ∗ (u ∗ 1, . . . , u ∗ k ) occurs in shapeBase ortermBase then 〈u ∗ , f ∗ (t ∗ 1 , . . .,t∗ k)〉 ∈ S;4. if 〈u, t〉 ∈ S <strong>and</strong> sh(u) = u s occurs in termHom then〈u s , sh(t)〉 ∈ S.Definition 15 An internal variable u ∗ is determined if〈u ∗ , t ∗ 〉 ∈ dets <strong>for</strong> some term t s . An internal variable isundetermined if it is not determined.Lemma 16 follows by induction using Definition 14.Lemma 16 Let β ≡ ∃ū. C(¯x ∗ , ū ∗ ) be a structural base<strong>for</strong>mula. If 〈u ∗ , t ∗ 〉 ∈ dets(β) then C(¯x ∗ , ū ∗ ) |= u ∗ = t ∗ .Corollary 17 Let β ≡ ∃〈u ∗ i 〉 i. C(¯x ∗ , 〈u ∗ i 〉 i) be a structuralbase <strong>for</strong>mula such that each internal variable u ∗ i isdetermined by some term t ∗ i , that is, 〈u∗ i , t∗ i 〉 ∈ dets(β).Then β is equivalent to the well-defined quantifier-free <strong>for</strong>mulaβ ′ ≡ C(¯x ∗ , 〈t ∗ i 〉 i).Proof. By Lemma 16 using the rule∃u.u = t ∧ φ(u) ⇐⇒ φ(t) (5)which holds when the term t is well-defined. If t is notwell-defined, then both β <strong>and</strong> β ′ evaluate to false.Our goal thus reduces to eliminating all undeterminedvariables from a structural base <strong>for</strong>mula. We first show howto eliminate undetermined composed non-parameter termvariables.Lemma 18 Let u be an undetermined composed nonparameterterm variable in a structural base <strong>for</strong>mula βsuch that u is a source i.e. no conjunct of the <strong>for</strong>mu ′ =f(u 1 , . . .,u, . . .,u k ) occurs in termBase. Let β ′ be theresult of removing from β the variable u <strong>and</strong> all conjunctscontaining u. Then β is equivalent to β ′ .8

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

Saved successfully!

Ooh no, something went wrong!