# The Model Evolution Calculus with Built-in Theories Peter Baumgartner MPI Informatik, Saarbrücken www.mpi-sb.mpg.de/~baumgart/

## Presentation on theme: "The Model Evolution Calculus with Built-in Theories Peter Baumgartner MPI Informatik, Saarbrücken www.mpi-sb.mpg.de/~baumgart/"— Presentation transcript:

The Model Evolution Calculus with Built-in Theories Peter Baumgartner MPI Informatik, Saarbrücken www.mpi-sb.mpg.de/~baumgart/

The Model Evolution Calculus with Built-in Theories2 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 Theories3 Model Evolution – Idea (1) A:A:A B:B:B C :C:C DPLL: Davis-Putnam-Logemann-Loveland Procedure (1960-63) Basis of some of the SAT solvers (Chaff, …) Input: Propositional clause set Output: Model or „unsatisfiable” No, split on C Algorithm components: - Simplification - Split - Backtracking

The Model Evolution Calculus with Built-in Theories4 Model Evolution – Idea (2) flight(sb,y ) :flight(sb,y ) train(sb,d):train(sb,d) ¼ First Order DPLL [Joint Work with Cesare Tinelli] No, split on train(sb,d) :flight(sb,d)flight(sb,d) Procedure components: - Simplification - Split - Backtracking Input: First-order clause set Output: Model or „unsatisfiable” if termination

The Model Evolution Calculus with Built-in Theories5 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 Calculus Context: A set of literals (same as branch on previous slide) Initially: { :v } Current Clause Set: Initally: input clauses

The Model Evolution Calculus with Built-in Theories6 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  Clause: :P(x,y) Ç :Q(a,z) Context: P(u,u) Q(v,b) Clause  : :P(x,x) Ç :Q(a,b)  = { x!u, y!u, v!a, z!b } contradictorynot contradictory :Q(a,b) is admissible for Split

The Model Evolution Calculus with Built-in Theories7 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  Clause: :P(x,y) Ç :Q(a,z) Context: P(u,u) Q(a,b) Clause  : :P(x,x) Ç :Q(a,b)  = { x!u, y!u, z!b } contradictory Close is applicable -  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 

The Model Evolution Calculus with Built-in Theories8 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 =  i>0  i –Close is not applicable to any  i –Roughly: if some ground instance C  of an input clause is falsified by  i then 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  1 constitutes a model for the input clause set

The Model Evolution Calculus with Built-in Theories9 Theories – Basic Definitions A Theory T 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 literal K ² T L iff K [ T ² L iff for every structure A and every valuation v: A,v ² K [ T implies A,v ² L Examples { P(u,a), u=f(u), a=f(a) } ² E P(f(u),f(a)) holds { P(u,a), u=f(u), v=f(v) } ² E P(f(u),f(a)) does not hold

The Model Evolution Calculus with Built-in Theories10 ME(T) – Derivation Rules (1) T -Split if (1)  is a T -context unifier of C Ç L against  with key set K [ { L } (2) K 2 :K (3) neither K  nor :K  is T -contraditory with   is a T -context unifier of clause L  Ç … Ç L iff there are sets K 1,…,K n of variants of literals from  s.th. K i  ² T :L i  Each set K i [ { L i } is called a key set Clause: :P(f(a),f(x)) Context: P(a,b) u=f(u)  = { u!a, v!b, x!b } Key set: { P(a,b), u=f(u), v=f(v), :P(f(a),f(x)) } T -Split on :(a=f(a))

The Model Evolution Calculus with Built-in Theories11 ME(T) – Derivation Rules (1) T -Split if (1)  is a T -context unifier of C Ç L against  with key set K [ { L } (2) K 2 :K (3) neither K  nor :K  is T -contraditory with  K  is T –contradictory with  iff there is a set K of variants of literals from  s.th. K ² T :K i  K  : :P(f(u),f (v)) Context: P(u,v) u=f(u) K = { P(u,v), u=f(u), v=f(v) } Example for T –contradictory:

The Model Evolution Calculus with Built-in Theories12 ME(T) – Derivation Rules (2) T -Repair if (1)  is a T -context unifier of C Ç L against  with key set K [ { L } (2) K 2 :K (3) K  is not T –contradictory with , but :K  is T -contraditory with  (4)  does not contain a variant of K  Clause: :P(f(a)) Context: :(f(a)=b) a=b P(a) f(u)=u T -Repair with :(a=f(a)) - T –Repair is the one-armed, disjoint variant of T –Split - T –Repair is not applicable if T is the „empty“ theory

The Model Evolution Calculus with Built-in Theories13 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 Theories14 Interpretation Associated to a Context Crucial to understand the working of the calculus Basis of the completeness proof Basis of feasible instantiation with theory reasoners E.g. Waldmeister for the theory of equality

The Model Evolution Calculus with Built-in Theories15 Interpretation Associated to a Context Literal set K T –produces a literal L in  Literal set K: { K 1 … K n } No literals L i 2  such that K i ¶ :L i & K i  Theory Reasoning: { K 1  … K n  } ² T L Interpretation Associated to  A ground atom A is assigned true in  via K iff some set K of variants of literals from  T –produces A Instances: { K 1  … K n  } „K i produces K i  in  “

The Model Evolution Calculus with Built-in Theories16 Interpretation Associated to a Context Context  T –produces a literal L Literal set K (as above): K 1 … K n Instances: K 1  … K n  No literals L i 2  such that K i ¶ :L i & K i  Theory Reasoning: K 1  … K n  ² T L 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 Theories17 ME(T) Calculus – Theory Reasoner R T A lifting lemma cannot be proven „once and for all“, replace it by admissibility condition of theory reasoner R T Theory reasoner R T –Input: a context  and a clause C = L 1 Ç … Ç L n –Output: a n+1 -tuple (K 1,…,K n,  ) or undefined where K i is a set of variants of literals from  and  is a substitution R T is sound iff K i  ² T :L i  (i.e.  is a T –context unifier) R T is complete iff the following holds: For every ground instance C  and all sets K 1,...,K n (as above): If C  is assigned false in  via K 1,...,K n then R T ( ,C) = (K 1,…,K n,  ) for some substitution  &  R T is admissible iff it is sound and complete

The Model Evolution Calculus with Built-in Theories18 Consequences and Properties Associated interpretation should be total: easy, context contains :v Associated interpretation should be a T –interpretation Need further restrictions on allowed theories to guarantee this: –Non-negative theories: ² T 9 (A 1 Æ … Æ A n ) T = { :A } is not allowed –Theory must be ground convex: ² T B ! A 1 Ç … Ç A n implies ² T B ! A i for some i (B conjunction of ground atoms, A ground atom) T = { A Ç B } is not allowed Property If limit context  1 assigns false to a (ground) clause C  via K 1,…,K n then there is an i such that for all j > i  j assigns false to C  via K 1,…,K n Completeness Fairness + admissible theory reasoner will detect this situation eventually and invalidate it

The Model Evolution Calculus with Built-in Theories19 Equality and Waldmeister Problem Waldmeister is a theorem prover for unit clauses { s 1 =t 1,...,s n =t n, :(s=t) } How to match it to contexts and arbitrary clauses? :(s 1 =t 1 ) Ç … Ç :(s m =t m ) Ç s m+1 =t m+1 Ç … Ç s n =t n 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 atoms E.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 Theories20 Equality and Waldmeister Problem Waldmeister is a theorem prover for unit clauses { s 1 =t 1,...,s n =t n, :(s=t) } How to match it to contexts and arbitrary clauses :(s 1 =t 1 ) Ç … Ç :(s m =t m ) Ç s m+1 =t m+1 Ç … Ç s n =t n Arbitrary Clauses Problem From definition of associated interpretation it follows: Context  falsifies a positive literal A iff some negative literal :B 2  produces :A in  Consequently: Can resolve away positive clause literals against context literals Leaves only rest clause (:(s 1 =t 1 ) Ç … Ç :(s m =t m )) 

The Model Evolution Calculus with Built-in Theories21 Equality and Waldmeister Problem Waldmeister is a theorem prover for unit clauses { s 1 =t 1,...,s n =t n, :(s=t) } How to match it to contexts and arbitrary clauses :(s 1 =t 1 ) Ç … Ç :(s m =t m ) Ç s m+1 =t m+1 Ç … Ç s n =t n Arbitrary Clauses Problem How to treat rest clause (:(s 1 =t 1 ) Ç … Ç :(s m =t m ))  ? Solution Code it as a negative unit clause (due to Thomas Hillenbrand): :(clause(s 1,t 1,...,s m,t m ) = true) clause(x 1,x 1,...,x m,x m ) = true Can 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 Theories22 Conclusion Presented simplified calculus, without universal variables e.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 ordering But using term orderings might be advantageous…

Similar presentations