220 likes | 344 Views
The Model Evolution Calculus with Built-in Theories. Peter Baumgartner MPI Informatik, Saarbr ü cken www.mpi-sb.mpg.de/~baumgart/. Problem. The Model Evolution Calculus is a sound and refutationally complete calculus for first-order clause logic
E N D
The Model Evolution Calculuswith Built-in Theories Peter Baumgartner MPI Informatik, Saarbrücken www.mpi-sb.mpg.de/~baumgart/
Problem • The Model Evolution Calculus is a sound and refutationally complete calculus for first-order clause logic • Can we extend it with built-in theory handling?That is, „plug in“ an (efficient) reasoner for a special domain • Examples for interesting theories • Equality • Real arithmetic • Theories axiomatized by logic programs • Can existing theory reasoners be plugged in (to Darwin)? • Equality: Waldmeister • Real arithmetic: quantifier elimination • Logic programs: logic program interpreter The Model Evolution Calculus with Built-in Theories
Model Evolution – Idea (1) DPLL: Davis-Putnam-Logemann-Loveland Procedure (1960-63) Basis of some of the SAT solvers (Chaff, …) Input: Propositional clause set Output: Model or „unsatisfiable” A :A Algorithm components: - Simplification - Split - Backtracking B :B C :C No, split on C The Model Evolution Calculus with Built-in Theories
Model Evolution – Idea (2) ¼First Order DPLL [Joint Work with Cesare Tinelli] Input: First-order clause set Output: Model or „unsatisfiable” if termination flight(sb,y) :flight(sb,y) Procedure components: - Simplification - Split - Backtracking :flight(sb,d) flight(sb,d) train(sb,d) :train(sb,d) No, split on train(sb,d) The Model Evolution Calculus with Built-in Theories
Calculus • Sequent Style Calculus • Simplified Calculus (for the purpose of talk) • No simplification inference rules to modify • No simplification inference rules to modify • No „universal“ variables, only „parametric“ ones Current Clause Set: Initally: input clauses Context: A set of literals (same as branch on previous slide) Initially: { :v } The Model Evolution Calculus with Built-in Theories
Derivation Rules (1) Split if (1) is a context unifier of CÇL against (2) neither L nor :L is contraditory with - is a context unifier: is a most general simultaneous unifier of the clause literals and context literals with opposite sign (pairwise)- L is contradictory with : contains a variant of :L Context: P(u,u) Q(v,b) = { x!u, y!u, v!a, z!b } Clause: :P(x,y)Ç:Q(a,z) Clause : :P(x,x)Ç:Q(a,b) :Q(a,b) is admissible for Split contradictory not contradictory The Model Evolution Calculus with Built-in Theories
Derivation Rules (2) Close if (1) ; or C? (2) there is a context unifier of C against such that each literal of C is contraditory with - is a context unifier: is a most general simultaneous unifier of the clause literals and context literals with opposite sign (pairwise)- L is contradictory with : contains a variant of :L Context: P(u,u) Q(a,b) = { x!u, y!u, z!b } Clause: :P(x,y)Ç:Q(a,z) Clause : :P(x,x)Ç:Q(a,b) Close is applicable contradictory contradictory The Model Evolution Calculus with Built-in Theories
Model Evolution – Further Ingredients • Derivation • Start with sequent :v` „Input Clause Set“ • Apply Split and Close derivation rules (gives tree over sequents) • Refutation: Every branch ends in sequent of the form `? • Fairness • Consider a derivation with limit context 1 = Ui>0 i • Close is not applicable to any i • Roughly: if some ground instance C of an input clause is falsified by ithen there is a j>i such that j satisfies C(this can always be achieved by applying the split rule) • Completeness • Assume a fair derivation with limit context • Show that 1constitutes a model for the input clause set The Model Evolution Calculus with Built-in Theories
Theories – Basic Definitions • A TheoryT is a consistent set of sentences • Consider here universal theories (no existential quantifier in prenex normal form) • Def: Clause set is T-unsatisfiable iff [T is unsatisfiable • Def: Let K be a set of literals and L be a literalK ²TLiff K[T ²Liff for every structure A and every valuation v: A,v ²K[T implies A,v²LExamples { P(u,a), u=f(u), a=f(a) } ²EP(f(u),f(a)) holds{ P(u,a), u=f(u), v=f(v) } ²EP(f(u),f(a)) does not hold The Model Evolution Calculus with Built-in Theories
ME(T) – Derivation Rules (1) T-Split if (1) is a T-context unifier of CÇL against with key set K[ { L } (2) K2:K (3) neither K nor :K is T-contraditory with is a T -context unifier of clause L1Ç … ÇLn iff there are sets K1,…,Kn of variants of literals from s.th. Ki²T:Li Each set Ki[ { Li } is called a key set Key set: { P(a,b), u=f(u), v=f(v), :P(f(a),f(x)) } Context: P(a,b) u=f(u) Clause: :P(f(a),f(x)) = { u!a, v!b, x!b } T-Split on :(a=f(a)) The Model Evolution Calculus with Built-in Theories
ME(T) – Derivation Rules (1) T-Split if (1) is a T-context unifier of CÇL against with key set K[ { L } (2) K2:K (3) neither K nor :K is T-contraditory with Kis T –contradictory with iff there is a set K of variants of literals from s.th. K²T:Ki Example for T –contradictory: K = { P(u,v), u=f(u), v=f(v) } Context: P(u,v) u=f(u) K: :P(f(u),f(v)) The Model Evolution Calculus with Built-in Theories
ME(T) – Derivation Rules (2) T-Repair if (1) is a T-context unifier of CÇL against with key set K[ { L } (2) K2:K (3) K is not T –contradictory with , but:K is T -contraditory with (4) does not contain a variant of K - T –Repair is the one-armed, disjoint variant of T –Split - T –Repair is not applicable if T is the „empty“ theory Context: :(f(a)=b) a=b P(a) f(u)=u Clause: :P(f(a)) T-Repair with :(a=f(a)) The Model Evolution Calculus with Built-in Theories
ME(T) – Derivation Rules (3) T-Close if (1) ; or C? (2) there is a T-context unifier of C against such that each literal of C is T-contraditory with Note: Condition (2) must be decidable! The Model Evolution Calculus with Built-in Theories
Interpretation Associated to a Context • Crucial to understand the working of the calculus • Basis of the completeness proof • Basis of feasible instantiation with theory reasonersE.g. Waldmeister for the theory of equality The Model Evolution Calculus with Built-in Theories
Interpretation Associated to a Context Literal set KT –produces a literal L in Literal set K: { K1 … Kn } No literals Li2such that Ki¶:Li&Ki Instances: { K1 … Kn } „Ki produces Ki in “ Theory Reasoning: { K1 … Kn }²TL Interpretation Associated to A ground atom Ais assigned true in viaK iff some set K of variants of literals from T –produces A The Model Evolution Calculus with Built-in Theories
Interpretation Associated to a Context Context T –produces a literal L Literal set K (as above):K1 … Kn Instances: K1 … Kn No literals Li2such that Ki¶:Li&Ki Theory Reasoning: K1 … Kn ²TL Examples { P(a), f(x)=x, :(f(a)=a) } does not E-produce P(f(a))=> P(f(a)) is assigned false in associated E-interpretation { P(a), f(x)=x, :P(f(a)) } E-produces P(f(a)) and :P(f(a)) => P(f(a)) is assigned true in associated E-interpretation The Model Evolution Calculus with Built-in Theories
ME(T) Calculus – Theory Reasoner RT • A lifting lemma cannot be proven „once and for all“, replace it by admissibility condition of theory reasoner RT • Theory reasonerRT • Input: a context and a clause C = L1Ç … ÇLn • Output: a n+1 -tuple (K1,…,Kn,) or undefinedwhere Ki is a set of variants of literals from and is a substitution • RT is sound iff Ki²T:Li (i.e. is a T –context unifier) • RT is complete iff the following holds:For every ground instance C and all sets K1,...,Kn (as above): If C is assigned false in via K1,...,Kn then RT(,C) = (K1,…,Kn,) for some substitution & • RT is admissible iff it is sound and complete The Model Evolution Calculus with Built-in Theories
Consequences and Properties • Associated interpretation should be total: easy, context contains :v • Associated interpretation should be a T –interpretationNeed further restrictions on allowed theories to guarantee this: • Non-negative theories: ²T9 (A1Æ … ÆAn)T = { :A } is not allowed • Theory must be ground convex: ²TB!A1Ç … ÇAn implies ²TB!Ai for some i (B conjunction of ground atoms, A ground atom)T = { A Ç B } is not allowed • PropertyIf limit context 1 assigns false to a (ground) clause C via K1,…,Knthen there is an i such that for all j > i j assigns false to C via K1,…,Kn • CompletenessFairness + admissible theory reasoner will detect this situation eventually and invalidate it The Model Evolution Calculus with Built-in Theories
Equality and Waldmeister • ProblemWaldmeister is a theorem prover for unit clauses{ s1=t1,...,sn=tn, :(s=t) }How to match it to contexts and arbitrary clauses?:(s1=t1) Ç … Ç:(sm=tm) Ç sm+1=tm+1Ç … Ç sn=tn • Context Problem = { a=f(a), P(u), :P(a), :P(f(a)), :P(f(f(a))) }Clause :P(a)Waldmeister has to discover instances P(f(f(f(a)))),...Solution (?) Convert context to equivalent set of atomsE.g. for signature {a/0, b/0, f/1} obtain = { a=f(a), P(b), P(f(b)), P(f(f(b))), P(f(f(f(x)))) }Resulting set can be infinite in case of non-linear literals! The Model Evolution Calculus with Built-in Theories
Equality and Waldmeister • ProblemWaldmeister is a theorem prover for unit clauses{ s1=t1,...,sn=tn, :(s=t) }How to match it to contexts and arbitrary clauses:(s1=t1) Ç … Ç:(sm=tm) Ç sm+1=tm+1Ç … Ç sn=tn • Arbitrary Clauses ProblemFrom definition of associated interpretation it follows: Context falsifies a positive literal A iff some negative literal :B2 produces :A in Consequently:Can resolve away positive clause literals against context literalsLeaves only rest clause (:(s1=t1) Ç … Ç:(sm=tm)) The Model Evolution Calculus with Built-in Theories
Equality and Waldmeister • ProblemWaldmeister is a theorem prover for unit clauses{ s1=t1,...,sn=tn, :(s=t) }How to match it to contexts and arbitrary clauses:(s1=t1) Ç … Ç:(sm=tm) Ç sm+1=tm+1Ç … Ç sn=tn • Arbitrary Clauses ProblemHow to treat rest clause (:(s1=t1) Ç … Ç:(sm=tm)) ?SolutionCode it as a negative unit clause (due to Thomas Hillenbrand)::(clause(s1,t1,...,sm,tm) = true)clause(x1,x1,...,xm,xm) = trueCan easily query Waldmeister with many clauses simultaneously • Thus have transformation for Waldmeister now But Waldmeister still has to be modifed to compute „all“ solutions! The Model Evolution Calculus with Built-in Theories
Conclusion • Presented simplified calculus, without universal variablese.g. \forall x P(x,u) • Universal variables crucial for performance • calculus instantiates to postive hyper-resolution for Horn case • One call to Waldmeister for unit theories • Should work out without greater difficulties • Is this all feasible? • Difference to Ganzinger/Korovin Calculus wrt.\ theory reasoning • Works for arbitrary universal non-negative convex theories • Does not need a term orderingBut using term orderings might be advantageous… The Model Evolution Calculus with Built-in Theories