SLIDE 1 Re Relational Con Constraint So Solving ng in in SMT SMT
Paul Meng, Andrew Reynolds, Cesare Tinelli, Clark Barrett
Midwest Verification Day September 2018
SLIDE 2 Re Relational Re Reasoning
Many problems can be modeled relationally
- Ontologies
- Network systems
- High-level system design
- โฆ
Relational logic is well suited for reasoning about structurally rich problems
SLIDE 3
A A Moti tivati ting g Examp mple
SLIDE 4 Mo Mode deling ng a To Toy File System
๐๐๐๐ข โ ๐ธ๐๐ c๐๐๐ข๐๐๐ข๐ก โ ๐ธ๐๐ ร ๐บ๐๐๐ โ ๐ธ๐๐
- ๐บ๐๐๐ โ ๐ธ๐๐
- โ
Root.*contents โ ๐: ๐ธ๐๐ | ยฌ(๐ โ ๐.^contents) There is a root directory The contents defines relations between directories and files or directories All directories and files are reachable from the root directory by following the contents Contents relation is acyclic
contents contents contents
Root
* โ reflexive-transitive closure ^ โ transitive closure
A Relational Solver
SLIDE 5
Tech chnical Pr Preliminaries Sa Satisfiability Mo Modul dulo T The heori ries ( (SMT MT)
SLIDE 6 Sa Satisfiability Mo Modul dulo T The heori ries ( (SMT MT)
Decide the satisfiability of many-sorted first-order logic formulas with respect to combinations of background theories
(a[i] > a[j] ) โง (str = โHello Worldโ) โง (len(str) + x = 3) โง (A โจ B) โง (x โ S) Arrays Arithmetic Strings Booleans Sets
SMT Solver
SAT UNSAT
SLIDE 7 Sa Satisfiability Mo Modul dulo T The heori ries ( (SMT MT)
A theory ๐ค = (ฮฃ, ๐ฑ) defines
- A signature ฮฃ: a set of non-logical symbols
- A class of ฮฃ-interpretations ๐ฑ
- Examples: integer arithmetic, strings, finite sets, โฆ
ร A simple theory: ฮฃ> = 0, 1, +, = ร A formula in the theory ๐ค>: ๐ฆ + 0 = 1
SLIDE 8
Re Related Work
SLIDE 9 Al Alloy
A declarative language based on first-order relational logic created at MIT Model and analyze structurally-rich systems SAT-based analysis by the Alloy Analyzer
- Checks the consistency of an Alloy Specification
- Can disprove but only prove a given property for an
Alloy specification within a given bounds
SLIDE 10
Analysis of Alloy Speci cifications via SMT
El Ghazi et al. [8, 9, 10] translates the Alloy kernel language to SMT-LIB language and solves using SMT solvers (AlloyPE) The resulting SMT formulas are difficult to solve due to heavy usage of quantifiers in the translation
SLIDE 11 Descr cription Logics cs (DLs)
Fragments of relational logic for efficient knowledge representation and reasoning Consider on purpose only unary and binary relations OWL: a standardized semantic web ontology language based on description logics
- Efficient solvers: KONCLUDE, HermiT, FaCT++ and etc.
SLIDE 12 A A Theo eory y of Fi Finite e Set t ๐ค๐ฃ in in SMT
A theory ๐ค๐ฃ of finite sets was introduced by Kshitij Bansal et al. [3] A modular set solver was implemented in CVC4
Signature ๐ต๐ฏ of ๐ค๐ฃ
- Singleton set constructor: [โ]: ๐ฝ โ Set ๐ฝ
- Subset: โ โถ Set ๐ฝ ร Set ๐ฝ โ Bool
- Membership: โ โถ ๐ฝ ร Set ๐ฝ โ Bool
- Union, intersection, set difference:
โ,โ, \ โถ Set ๐ฝ ร Set ๐ฝ โ Set ๐ฝ
SLIDE 13 A A Th Theor
Finite Re Relations ๐ค๐ข My My Research ch
SLIDE 14
Ty Type Notations
๐๐ฏ๐ช๐ ๐ท๐, โฆ , ๐ท๐ : a parametric tuple sort (n > 0) ๐๐๐ฎ(๐๐ฏ๐ช๐ ๐ท๐, โฆ , ๐ท๐ ): a relational sort abbreviated as ๐๐๐ฆ๐ ๐ท๐, โฏ , ๐ท๐
SLIDE 15 Re Relational Signature ๐ตโ of
Tuple constructor:
_ , โฆ , _ โถ ๐ฝiร โฏ ร ๐ฝjโ Tupj ๐ฝi, โฆ , ๐ฝj ร Example: โจ1, 2โฉ a binary integer tuple constant
Singleton relation constructor:
[q] โถ Tupj ๐ฝi, โฆ , ๐ฝj โ Rels ๐ฝi, โฆ , ๐ฝj ร Example: โจ1, โHelloโโฉ a singleton set of integer and string binary tuple
SLIDE 16 Re Relational Signature ๐ตโ of
Product: โ โถ Relx ๐ฝ ร Relj ๐พ โ Relxzj ๐ฝ, ๐พ
ร Example: R1 = โจ1, 2โฉ, โจ3, 4โฉ ; R2 = โจ5, 6โฉ R1 โ R2 = โจ1, 2, 5, 6โฉ, โจ3, 4, 5, 6โฉ
Join: โ โถ Relโฌzi ๐ฝ, ๐ฟ ร Relโzi ๐ฟ, ๐พ โ Relโฌzโ ๐ฝ, ๐พ
with ๐ + ๐ > 0 ร Example: R1 = โจ1, โHelloโโฉ, โจ2, โHiโโฉ ; R2 = โจโHelloโ, 3โฉ, โจโWorldโ, 4โฉ ; R1 โ R2 = โจ1, 3โฉ
SLIDE 17 Re Relational Signature ๐ตโ of
Transpose: _qi: Relx ๐ฝi, โฏ , ๐ฝx
โ Relx ๐ฝx, โฏ , ๐ฝi ร Example: R = โจ1, โHelloโโฉ, โจ2, โHiโโฉ ; R-1 = โจโHelloโ, 1โฉ, โจโHiโ, 2โฉ ;
Transitive Closure: _z: Relล ฮฑ, ฮฑ โ Relล ฮฑ, ฮฑ
ร Example: R = โจ1, 2โฉ, โจ2, 3โฉ R+ = โจ1, 2โฉ, โจ2, 3โฉ, โจ1, 3โฉ
SLIDE 18
A A Calcu culus ๐๐ข fo for ๐ค๐ข
SLIDE 19
A Compact ct Calcu culus for ๐ค๐ฃ
Derivation rules for intersection and union
SLIDE 20
A Compact ct Calcu culus for ๐ค๐ฃ
Derivation rules for set difference, singleton, disequality and contradiction
SLIDE 21
TR TRANSPO POSE Deriv ivation ion Rule le (_q๐)
SLIDE 22
JOIN JOIN Der Derivati tion Ru Rule e (โ)
๐ is a fresh variable
SLIDE 23
PR PRODUCT T Deriv ivation ion Rule le (โ)
SLIDE 24
TR TRANSITI TIVE CLOSURE Deriv ivation ion Rule le (_z)
๐, ๐i, ๐ล are fresh variables
SLIDE 25 An An Examp mple
๐ฏ = { ๐, ๐ โ ๐z, ๐, ๐ โ R, ๐, ๐ โ R โ R} ๐ฏ โถ= ๐ฏ โช { ๐, ๐ โ R}
JOIN UP UNSAT
๐, ๐ โ R โ R
EQ UNSAT
๐ฏ โถ= ๐ฏ โช { ๐, ๐ โ R, ๐ ๐ โ R}
๐, ๐ โ R TCLOS DOWN
๐ฏ โถ= ๐ฏ โช { ๐, ๐ โ R โ R}
EQ UNSAT UNSAT
๐ฏ โถ= ๐ฏ โช { ๐, ๐i โ R, ๐i, ๐ล โ R, ๐ล ๐ โ R, ๐i โ ๐ล}
NO RULES APPLY
(After exhaustively applying JOIN-UP)
SAT
SLIDE 26
Calcu culus ๐๐ข Correct ctness
SLIDE 27 Calcu culus ๐๐ข Correct ctness
Refutation Sound โ a closed derivation tree proves that input constraints are UNSAT Model Sound โ from a saturated branch of a derivation tree one can extract a model for input constraints
Detailed proof can be found in Meng et al. [21]
SLIDE 28 Te Termination fo for a a Frag agment of
Termination: If S is a finite set of constraints generated by the grammar above, then all derivation trees are finite.
Detailed proof can be found in Meng et al. [21]
SLIDE 29 A Re Relational Solver in CVC4
Prop Engine
Theory Engine
Relations Arithmetic Strings Sets Others
Uninterpreted Function
SLIDE 30 A Re Relational Solver in CVC4
- Allows us to solve constraints from a combination
- f relations and other domains
- Extend SMT-LIB/CVC4 native language with
support for relations
- Enables natural mappings from several relational
modeling languages to SMT
- Brings to those languages the power of SMT
solvers and their ability to reason efficiently about built-in types
SLIDE 31
Ap Applicati tions of ๐ค๐ข
SLIDE 32
Ap Applicati tion 1: 1: Al Alloy y to CV CVC4 C4
Support Alloy kernel language in SMT natively Finite model finding of CVC4 can efficiently reason about problems with presence of quantifiers Built a translator from Alloy kernel language to SMT Can disprove and prove properties with respect to Alloy specifications
SLIDE 33
ALLOY KERNEL LANGUAGE CVC4
Signature sig S S : Rel1(Atom) Field f : S1 โ โฏ โ Sn of a sig S f : Reln+1(Atom, โฆ, Atom) f โ S โ S1 โ โฏ โ Sn sig S1, โฆ , Sn extends S S1 โ S, โฆ , Sn โ S Si โ Sj = [ ] for 1 โค i < j โค n S1 โ โฏ โ Sn = S if S is abstract sig S1, โฆ , Sn in S, S1 โ S, โฆ , Sn โ S
SLIDE 34
ALLOY KERNEL LANGUAGE CVC4
Sets Operators: +, &, โ, =, in โ,โ โ, โ,โ Relational Operators: ~, โ
, โ, ^ _qi, โ, โ, _z Logical operators: and, or, not AND, OR, NOT Quantifiers: all, some FORALL, EXISTS
SLIDE 35 Evaluation on Alloy Bench chmarks
Evaluated CVC4 with two configurations
- CVC4: enables full native support for relational operators
- CVC4+AX: encodes all relational operators as
uninterpreted functions with axioms
Compared with Alloy Analyzer and AlloyPE on two sets of benchmarks:
- 1. From AlloyPE and
- 2. From an academic course
SLIDE 36 Evaluation on Alloy Bench chmarks
Compared to the Alloy Analyzer
- CVC4 is overall slower for SAT benchmarks
- CVC4 solves UNSAT benchmarks, whereas the Alloy Analyzer
can only answer bounded UNSAT
Compared to AlloyPE
- CVC4 solves SAT benchmarks, whereas AlloyPE solves none
- CVC4 solves most of AlloyPEโs benchmarks
Compared to CVC4+AX
- CVC4 solves SAT benchmarks, whereas CVC4+AX solves none
- CVC4 solves significantly more UNSAT benchmarks
SLIDE 37 Ev Evaluation on SA SAT Bench chmarks
0.1 1 10 100 1000
Seconds in Log Scale
CVC4 Alloy Analyzer
SLIDE 38 Ev Evaluation on UN UNSAT Bench chmarks
0.1 1 10 100 1000 mem-wr mem-wi ab-ai ab-dua abt-dua abt-ly-u gp-nsf gp-nsg com-1 com-3 com-4a com-4b fs-sd fs-nda gc-s1 academia_3 academia_4 family_1 family_2 birthday library gc-s2 gc-c com-2 social_3 social_4 social_2 lights INSLabel
Seconds in Log Scale
CVC4 CVC4+AX AlloyPE
SLIDE 39
Ap Applicati tion 2: 2: OWL L DL DL to SMT
OWL DL based on an expressive description logic fragment Built a translator from OWL DL to SMT in ๐ค๐ข Check logical consistency of OWL models using CVC4
SLIDE 40
OWL DL CVC4
Individual name a a : Atom Nominal {a} {<a>} Top concept T Bottom concept โฅ Univ, {โ a : Atom | <a> โ Univ} [ ] Atomic concept C Role R C : Rel1(Atom) R : Rel2(Atom, Atom) Union C โ D Intersection C โ D C โ D C โ D Inverse role Rโ Complement ยฌC R-1 Univ \ C
SLIDE 41
OWL DL CVC4
Concept, role assertion C(a), R(a; b) a โ C, <a, b> โ R Individual (dis)equality a โ b, a โ b a โ b, a โ b Concept, role inclusion C โ D, R โ S C โ D, R โ S Concept, role equiv. C โก D, R โก S C โ D, R โ S Complex role inclusion R1 โ R2 โ S R1 โ R2 โ S Role disjointness Disjoint(R, S) R โ S โ [ ]
SLIDE 42
OWL DL CVC4
Existential restriction โR.C R โ C Universal restriction โR.C [ x | x โ Univ โง [x] โ R โ C ] At-least restriction โฅjR.C [ x | x โ Univ โง (โ a1, โฆ , an: Atom [<a1>, โฆ , <an>] โ (([x] โ R) โ C) โง Dist(a1, โฆ , an))] At-most restriction โคjR.C [ x | x โ Univ โง (โ a1, โฆ , an: Atom (([x] โ R) โ C) โ [<a1>, โฆ , <an>] โง [<a1>, โฆ , <an>] โ C)] Local reflexivity โR.Self [<x, y> | <x, y> โ R x โ y]
SLIDE 43 Evaluation on OWL Bench chmarks
Evaluated on OWL models from 4th OWL Reasoner Evaluation competition Compared with a state of the art DL reasoner HermiT For the ones (4269) we both solved:
- CVC4 takes 2.62s per benchmark and solves faster on 1617
benchmarks
- HermiT takes 1.76s per benchmark and solves faster on
2652 benchmarks
SLIDE 44 Co Comp mparison wit with Her Hermi miT
0.1 1 10 100 10 20 30 40 50 60
X-Values: CVC4 Y-Values: HermiT (in Log Scale)
SLIDE 45 Su Summary
- Introduced a theory of finite relations in SMT
- Developed a refutation-sound and model-sound
calculus for the theory of relations
- Demonstrated useful applications in Alloy and OWL
- Shown promising experimental results on Alloy and
OWL benchmarks
SLIDE 46
Thank you!
SLIDE 47 References
- 1. F. Baader. The description logic handbook: Theory, implementation and
- applications. Cambridge university press, 2003.
- 2. F. Baader, I. Horrocks, and U. Sattler. Description logics. In V. L. Frank van
Harmelen and B. Porter, editors, Handbook of Knowledge Representation, volume 3 of Foundations of Artificial Intelligence, pages 135 โ 179. Elsevier, 2008.
- 3. K. Bansal, A. Reynolds, C. W. Barrett, and C. Tinelli. A new decision
procedure for finite sets and cardinality constraints in SMT. In Proceedings
- f IJCARโ16, volume 9706 of LNCS, pages 82โ98. Springer, 2016.
- 4. C. Barrett, C. L. Conway, M. Deters, L. Hadarean, D. Jovanoviยดc, T. King, A.
Reynolds, and C. Tinelli. CVC4. In Proceedings of CAVโ11, volume 6806 of LNCS, pages 171โ177. Springer, 2011.
- 5. C. Barrett, P. Fontaine, and C. Tinelli. The SMT-LIB standardโVersion
2.6. In A. Gupta and D. Kroening, editors, SMT 2010, 2010.
SLIDE 48 References
- 6. C. Barrett, R. Sebastiani, S. Seshia, and C. Tinelli. Satisfiability modulo
- theories. In A. Biere, M. J. H. Heule, H. van Maaren, and T. Walsh, editors,
Handbook of Satisfiability, volume 185, chapter 26, pages 825โ885. IOS Press, February 2009.
- 7. B. Dutertre and L. D. Moura. The YICES SMT solver. Technical report, SRI
International, 2006.
- 8. A. A. E. Ghazi and M. Taghdiri. Analyzing alloy constraints using an SMT
solver: a case study. In 5th International Workshop on Automated Formal Methods (AFM), 2010.
- 9. A. A. E. Ghazi and M. Taghdiri. Relational reasoning via SMT solving. In
Proceedings of FMโ11, volume 6664 of LNCS, pages 133โ148. Springer, 2011.
- 10. A. A. E. Ghazi, M. Taghdiri, and M. Herda. First-order transitive closure
axiomatization via iterative invariant injections. In Proceedings of NFMโ15, volume 9058 of LNCS. Springer, 2015.
SLIDE 49 References
- 11. I. Horrocks and U. Sattler. Decidability of shiq with complex role
inclusion axioms. Artificial Intelligence, 160(1-2):79โ104, 2004.
- 12. D. Jackson. Alloy: a lightweight object modelling notation. ACM Trans.
- Softw. Eng. Methodol., 11(2):256โ290, 2002.
- 13. D. Jackson. Software Abstractions - Logic, Language, and Analysis. MIT
Press, 2006.
- 14. R. Nieuwenhuis, A. Oliveras, and C. Tinelli. Solving SAT and SAT Modulo
Theories: from an abstract Davis-Putnam-Logemann-Loveland Procedure to DPLL(T). Journal of the ACM, 53(6):937โ977, Nov. 2006.
- 15. A. Reynolds, C. Tinelli, A. Goel, and S. Krstic. Finite model finding in
- SMT. In Proceedings of CAVโ13, volume 8044 of LNCS, pages 640โ655.
Springer, 2013.
SLIDE 50 References
- 16. A. Steigmiller, T. Liebig, and B. Glimm. Konclude: System description. Web
Semantics: Science, Services and Agents on the World Wide Web, 27(1), 2014.
- 17. E. Torlak and D. Jackson. Kodkod: a relational model finder. In Proceedings
- f TACASโ07, volume 4424 of LNCS, pages 632โ647. Springer, 2007.
- 18. D. Tsarkov and I. Horrocks. Fact++ description logic reasoner: system
- description. In Proceedings of IJCARโ06, volume 4130 of LNCS. Springer, 2006.
- 19. D. Tsarkov and I. Palmisano. Chainsaw: a metareasoner for large
- ntologies. In I. Horrocks, M. Yatskevich, and E. Jimยดenez-Ruiz, editors, ORE,
2012.
- 20. W3C. OWL 2 web ontology language,
https://www.w3.org/2007/OWL/wiki/Syntax.
- 21. Baoluo Meng, Andrew Reynolds, Cesare Tinelli, and Clark
- Barrett. Relational Constraint Solving in SMT. In Proceedings of the 26th
International Conference on Automated Deduction, Gothenburg, Sweden
SLIDE 51 A Toy File System Speci cification in Alloy
abstract sig FSO {} sig File extends FSO {} sig Dir extends FSO { contents: Set FSO }
- - contents relation is acyclic
fact {all d: Dir | not (d in d.^contents)}
- - Every file system object only has one location
assert oneLocation { all o : FSO | lone d : FSO | o in d.contents } check oneLocation for 7
SLIDE 52 An An Examp mple
๐ฏ = { ๐, ๐ โ Rqi, R โ Q, ๐ โ P, ๐ โ P, P โ P โ Q โ T} ๐ฏ โถ= ๐ฏ โช { ๐, ๐ โ P โ P, ๐, ๐ โ P โ P, ๐, ๐ โ P โ P, โฆ }
PROD UP TRANS UP
P โ P โ Q โ T
๐ฏ โถ= ๐ฏ โช { ๐, ๐ โ Rqi, โฆ }
INTER DOWN
๐, ๐ โ Rqi, R โ Q
๐ฏ โถ= ๐ฏ โช { ๐, ๐ โ Q, ๐, ๐ โ Q, ๐, ๐ โ Q, ๐, ๐ โ Q, โฆ }
UNSAT
๐, ๐ โ Rqi
EQ UNSAT
SLIDE 53 Sa Satisfiability Mo Modul dulo T The heori ries ( (SMT MT)
A theory ๐ค = (ฮฃ, ๐ฑ) defines
- A signature ฮฃ: a set of non-logical symbols
- A class of ฮฃ-interpretations ๐ฑ
- Examples: integer arithmetic, strings, finite sets, โฆ
ร A simple theory: ฮฃ> = 0, 1, +, = ร A formula in the theory ๐ค>: ๐ฆ + 0 = 1