Combining Data Structures with Arithmetic Constraints C. Ringeissen j.w.w. Enrica Nicolini and Michaël Rusinowitch LORIA & INRIA Nancy Grand Est Sophia, June 2010 inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 1 / 23
Outline Introduction 1 Applications (unions of theories) 2 Superpositions 3 Combinations 4 inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 2 / 23
Introduction Outline Introduction 1 Applications (unions of theories) 2 Superpositions 3 Combinations 4 inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 3 / 23
Introduction Building Decision Procedures Two approaches to obtain decision procedures in a uniform way: Rewrite based techniques ◮ successful when formalizing data-structures ◮ not directly applicable to Arithmetic Combination techniques ◮ the Nelson-Oppen method is currently implemented in many state of the art SMT tools inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 4 / 23
Introduction Building Decision Procedures Two approaches to obtain decision procedures in a uniform way: Rewrite based techniques ◮ successful when formalizing data-structures ◮ not directly applicable to Arithmetic Combination techniques ◮ the Nelson-Oppen method is currently implemented in many state of the art SMT tools ◮ limitation: the theories should be over disjoint signatures ❀ restricted expressiveness when writing constraints involving, e.g., both data-structures and arithmetical properties inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 4 / 23
Introduction Building Decision Procedures Two approaches to obtain decision procedures in a uniform way: Rewrite based techniques ◮ successful when formalizing data-structures ◮ not directly applicable to Arithmetic Combination techniques ◮ the Nelson-Oppen method is currently implemented in many state of the art SMT tools ◮ limitation: the theories should be over disjoint signatures ❀ cannot deal with axioms like ℓ ( cons ( x , y )) = ℓ ( y ) + 1 inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 4 / 23
Introduction Our approach Aim: to design decision procedures for data structures endowed with arithmetic constraints A superposition calculus modulo arithmetic axioms is turned into a rewrite-based decision procedure for interesting theories The calculus is plugged into a non-disjoint combination framework to enrich the expressiveness of the constraints to be checked inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 5 / 23
Applications (unions of theories) Outline Introduction 1 Applications (unions of theories) 2 Superpositions 3 Combinations 4 inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 6 / 23
Applications (unions of theories) (Unions of) Theories Data structures: lists, arrays, records, ... augmented with additional functions defined via arithmetic operators: incrementation 1 addition 2 Theories of arithmetic Linear arithmetic 1 Non-linear arithmetic 2 inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 7 / 23
Applications (unions of theories) Recursively defined data structures nil : DS , cons : ELEM × DS × · · · × DS → DS , car : DS → ELEM , cdr i : DS → DS car ( cons ( E , D 1 , . . . , D n )) = E cdr i ( cons ( E , D 1 , . . . , D n )) = D i Additional functions: Length : ℓ i : DS → NUM ℓ i ( nil ) = 0 ℓ i ( cons ( E , D 1 , . . . , D n )) = s ( ℓ i ( D i )) Increment : inc : DS → DS if ELEM = NUM inc ( cons ( E , D 1 , . . . , D n )) = cons ( s ( E ) , inc ( D 1 ) , . . . , inc ( D n )) Size : size : DS → NUM size ( nil ) = 0 size ( cons ( E , D 1 , . . . , D n )) = size ( D 1 )+ . . . + size ( D n )+ 1 inrialoria-logo 0 � = 1 C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 8 / 23
Applications (unions of theories) Possible shared theories Operators: s : NUM → NUM + : NUM × NUM → NUM Axioms: (Inj) ∀ x , y s ( x ) = s ( y ) → x = y ∀ x x � = s n ( x ) for all n ∈ N + (Acy) (S0) ∀ x s ( x ) � = 0 Theories: Theory of Integer Offsets [NRR09c]: T I = { Inj , Acy , S 0 } 1 Theory of Increment [NRR09b]: T S = { Inj , Acy } 2 Theory of Abelian Groups [NRR09a]: 3 AG = AC (+) ∪ { x + ( − x ) = 0 , x + 0 = x } inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 9 / 23
Superpositions Outline Introduction 1 Applications (unions of theories) 2 Superpositions 3 Combinations 4 inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 10 / 23
Superpositions Superposition Calculus as a Decision Procedure SP: an inference system to saturate a set of equational clauses Intuition: Abstract Congruence Closure Modulo ➼ The core of equational theorem provers: E, SPASS, Vampire, . . . A refutation-based semi-decision procedure SP is refutation complete [NR01]: If the input is unsatisfiable, then SP generates the empty clause. Otherwise, possible non-termination ... Theorem [ARR03] SP is a satisfiability procedure for some (theories of) data structures ➼ termination for the theory of equality EUF , Lists, Arrays, . . . inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 11 / 23
Superpositions Superposition Calculus l [ u ′ ] = r u = t Superposition ( i ) , ( ii ) , ( iii ) , ( iv ) ( l [ t ] = r ) σ l [ u ′ ] � = r u = t Paramodulation ( i ) , ( ii ) , ( iii ) , ( iv ) ( l [ t ] � = r ) σ u ′ � = u Reflection ( i ) ✷ where (i) σ is the most general unifier of u and u ′ , (ii) u ′ is not a variable , (iii) u σ �� t σ , (iv) l [ u ′ ] σ �� r σ . Figure: Expansion Inference Rules. inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 12 / 23
Superpositions Superposition Calculus Modulo Counting Arithmetic Ad hoc rules to be applied to ground terms: s ( u ) = s ( v ) R1 (for Inj) u = v s ( u ) = t , s ( v ) = t R2 (for Inj) if s ( u ) ≻ t , s ( v ) ≻ t and u ≻ v s ( v ) = t , u = v s n ( t ) = t C1 (for Acy) if n ∈ N ✷ s ( t ) = 0 C2 (for S 0 ) ✷ where ✷ is the empty clause Figure: Ground reduction Inference Rules. inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 13 / 23
Superpositions AG -Superposition Calculus l = r D [ t 1 + t 2 ] p Direct AG-superposition ( D [ r + t 2 ] p ) µ i l = r D [ t 1 + t 2 ] p Inverse AG-superposition ( D [ r + t 2 ] p ) µ i u ′ � = u Reflection ✷ where: a ) ✷ stands for the empty clause AG u ′ has a solution b ) u = ? c ) µ i is a most general solution of l = ? AG t 1 d ) l = r is a direct orientation and t 1 + t 2 is a splitting in the Direct AG-superposition rule e ) l = r is an inverse orientation and t 1 + t 2 is an inverse splitting in the Inverse AG-superposition rule inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 14 / 23
Superpositions AG -Superposition: A Bit of Intuition Let a , b , c be constants and ≻ an ordering s.t. a ≻ b ≻ c Direct AG -superposition Ex: 3 a + c = 0 and 5 a + 3 b + 2 c = 0 3 a = − c 3 a + 2 a + 3 b + 2 c = 0 ? Inverse AG -superposition Ex: 3 a + c = 0 and f ( − a + 3 b + 2 c ) = 0 − a = 2 a + c f ( − a + 3 b + 2 c ) = 0 ? inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 15 / 23
Superpositions AG -Superposition: A Bit of Intuition Let a , b , c be constants and ≻ an ordering s.t. a ≻ b ≻ c Direct AG -superposition Ex: 3 a + c = 0 and 5 a + 3 b + 2 c = 0 3 a = − c 3 a + 2 a + 3 b + 2 c = 0 ���� ���� ���� � �� � l r t 1 t 2 − c + 2 a + 3 b + 2 c = 0 ���� � �� � r t 2 Inverse AG -superposition Ex: 3 a + c = 0 and f ( − a + 3 b + 2 c ) = 0 − a = 2 a + c f ( − a + 3 b + 2 c ) = 0 ���� � �� � ���� � �� � r t 1 t 2 l f ( 2 a + c + 3 b + 2 c ) = 0 � �� � � �� � r t 2 inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 15 / 23
Superpositions Superposition-based Decision Procedures: Summary Our superposition calculi are refutation complete , and terminating with inputs of the form Ax ( T ) ∪ G such that Ax ( T ) is the set of axioms of T (including only unit clauses) G is a set of ground literals for some (useful) theories T : Superposition modulo T I or T S ➼ data structures such as Lists, Trees, Records with Length , Increment Superposition modulo AG ➼ data structures such as Lists, Trees, Records with Length , Increment , Size inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 16 / 23
Combinations Outline Introduction 1 Applications (unions of theories) 2 Superpositions 3 Combinations 4 inrialoria-logo C. Ringeissen (LORIA & INRIA Nancy) Combining Data Structures Sophia, June 2010 17 / 23
Recommend
More recommend