Using SMT Solvers in Finding Finite Models and Cores for Relational - - PowerPoint PPT Presentation

using smt solvers in finding finite models and cores for
SMART_READER_LITE
LIVE PREVIEW

Using SMT Solvers in Finding Finite Models and Cores for Relational - - PowerPoint PPT Presentation

First-order Relational Logic Research Road-map Relational Specification Evaluation Using SMT Solvers in Finding Finite Models and Cores for Relational Logic Ferhat Erata 1 , 2 Ruzica Piskac 1 1 Yale University, Computer Science, New Haven, CT,


slide-1
SLIDE 1

First-order Relational Logic Research Road-map Relational Specification Evaluation

Using SMT Solvers in Finding Finite Models and Cores for Relational Logic

Ferhat Erata1,2 Ruzica Piskac1

1Yale University, Computer Science, New Haven, CT, USA 2UNIT Information Technologies Ltd., Izmir, Turkey

The 27th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Tallinn, Estonia 26–30 August, 2019

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-2
SLIDE 2

First-order Relational Logic Research Road-map Relational Specification Evaluation

Information Technology for European Advancement (ITEA)

ITEA-ModelWriter: Synchronized Document Engineering Platform https://itea3.org/project/modelwriter.html ITEA-ASSUME: Affordable Safe & Secure Mobility Evolution https://itea3.org/project/assume.html ITEA-XIVT: eXcellence In Variant Testing https://itea3.org/project/xivt.html

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-3
SLIDE 3

First-order Relational Logic Research Road-map Relational Specification Evaluation

European Cooperation in Science and Technology (COST)

IC1404 Multi-Paradigm Modelling for Cyber-Physical Systems http://www.cost.eu/COST_Actions/ict/IC1404 IC1402 Runtime Verification beyond Monitoring http://www.cost.eu/COST_Actions/ict/IC1402

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-4
SLIDE 4

First-order Relational Logic Research Road-map Relational Specification Evaluation

Outline

1

First-order Relational Logic Applications of Alloy Alloy Demonstration

2

Research Road-map

3

Relational Specification Universe and Bounds Constraints Outcome

4

Evaluation

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-5
SLIDE 5

First-order Relational Logic Research Road-map Relational Specification Evaluation Applications of Alloy Grammar Alloy Demonstration

Applications of Alloy

Access Control and Security Policies. Feature Modeling and Analysis Domain Specific Languages and Modeling. Testing and Automated Test Case Generation Software Architecture Configuration and Reconfiguration, Data Structure Repair Program verification. Databases. Model-Driven Development. Network Protocols Requirements

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-6
SLIDE 6

First-order Relational Logic Research Road-map Relational Specification Evaluation Applications of Alloy Grammar Alloy Demonstration

Front-end

Universe and Bounds problem ::= universe relDecl∗formula∗ universe ::= {atom∗} relDecl ::= relation :arity [constant, constant] constant ::= {tuple∗} tuple ::= atom∗ arity ::= positiveinteger relation ::= identifier atom ::= identifier

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-7
SLIDE 7

formula ::= expr ⊂ expr (subset) | expr = expr (equality) | some expr (at least one) | one expr (exactly one) | lone expr (at most one) | no expr (empty) | ¬formula (negation) | formula ∧ formula (conjuction) | formula ∨ formula (disjunction) | formula ⇒ formula (implication) | formula ⇔ formula (biimplication) | (∀ | ∃ | ∃! | ∄) varDecls | formula (universal) | intexpr { < | ≤ | = | > | ≥ } intexpr (comparison)

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-8
SLIDE 8

formula ::= expr in expr (subset) | expr = expr (equality) | some expr (at least one) | one expr (exactly one) | lone expr (at most one) | no expr (empty) | !formula (negation) | formula and formula (conjuction) | formula or formula (disjunction) | formula implies formula (implication) | formula iff formula (biimplication) | (all | some | one | no) varDecls | formula (universal) | intexpr { < | ≤ | = | > | ≥ } intexpr (comparison)

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-9
SLIDE 9

expr ::= var (variable) | expr = expr (equality) | ∼ expr (transpose) | ˆexpr (clousure) | expr ∪ expr (union) | expr ∩ expr (intersection) | expr \ expr (difference) | expr expr (join) | expr × expr (product) | {varDecls | formula} (comprehension) | univ (universal set) | none (empty set) | iden (identity)

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-10
SLIDE 10

expr ::= var (variable) | expr = expr (equality) | ∼ expr (transpose) | ˆexpr (clousure) | expr + expr (union) | expr & expr (intersection) | expr − expr (difference) | expr · expr (join) | expr → expr (product) | {varDecls | formula} (comprehension) | univ (universal set) | none (empty set) | iden (identity)

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-11
SLIDE 11

intexpr ::= integer (literal) | #expr (cardinality) | sum (expr) (sum) | intexpr {+ | − | × | ÷} intexpr (arithmetic) varDecls ::= (variable : expr)∗ variable ::= identifier

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-12
SLIDE 12

First-order Relational Logic Research Road-map Relational Specification Evaluation Applications of Alloy Grammar Alloy Demonstration

Alloy Demonstration

A Lisp-like List

datatype L i s t = N i l | Cons of Element ∗ L i s t

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-13
SLIDE 13

Research Road-map

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-14
SLIDE 14

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

KodKod Walktrough

A Lisp-like List

datatype L i s t = N i l | Cons of Element ∗ L i s t

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-15
SLIDE 15

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Universe {o0, o1, l0, l1, l2, l3, l4, l5} Bounds List :1 [{l0, l1, l2, l3, l4, l5}] Object :1 [{o0, o1}] Nil :1 [{}, {l0, l1, l2, l3, l4, l5}] car :2 [{l4, o1, l3, o0, l2, o0, l1, o1}, {x, y | x : List ∧ y : Object}] cdr :2 [{l4, l3, l3, l0, l2, l0, l1, l2}, {x, y | x : List ∧ y : List}] eq :2 [{}, {x, y | x : List ∧ y : List}]

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-16
SLIDE 16

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Universe {o0, o1, l0, l1, l2, l3, l4, l5}

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-17
SLIDE 17

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Universe {o0, o1, l0, l1, l2, l3, l4, l5} KodKod API

1 String L i s t 0 = " L i s t 0 "; String L i s t 1 = " L i s t 1 "; 2 String L i s t 2 = " L i s t 2 "; String L i s t 3 = " L i s t 3 "; 3 String L i s t 4 = " L i s t 4 "; String L i s t 5 = " L i s t 5 "; 4 String Object0 = " Object0 "; 5 String Object1 = " Object1 "; 6 7 Universe u n i v e r s e = new Universe ( List0 , List1 , 8 List2 , List3 , List4 , List5 , Object0 , Object1 ) ;

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-18
SLIDE 18

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Translation

( declare−datatypes () (( univ ( Object !1) ( Object !1) ( L i s t !0) ( L i s t !1) . . . ( L i s t !4) ( L i s t ! 5 ) ) ) ( declare−fun Object ( univ ) Bool ) ( declare−fun L i s t ( univ ) Bool ) . . . ( declare−fun eq ( univ univ ) Bool ) ( assert ( Object Object0 )) ( assert ( Object Object1 )) ( assert ( L i s t L i s t 0 )) . . . ( assert ( cdr L i s t 1 L i s t 2 ))

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-19
SLIDE 19

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Axioms 1. Nil is a List. 2. Nil is a singleton. 3. Nil list has neither car nor cdr. 4. A Non-nil List has some car and cdr. 5. Nil is always reachable from any List. 6. Two lists are equal iff the objects they point to are same and the Lists they point are equal. 7. car relation is a partial function.

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-20
SLIDE 20

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Axioms 1. Nil ⊆ List 2.

  • ne Nil

3. no (Nil.cdr ∪ Nil.car) 4. ∀l : List − Nil | some (l.cdr) ∧ some (l.car) 5. ∀l : List | Nil ⊆ (l.∗cdr) 6. ∀a, b : List | a ⊆ b.eq iff (a.car = b.car) ∧ (a.cdr ⊆ (b.cdr).eq) 7. ∀l : List | lone (l.car) (constraints)

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-21
SLIDE 21

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Alloy

( a l l l :

  • ne

L i s t | lone ( l . car ))

KodKod API

1 Relation L i s t = Relation . unary (" L i s t " ) ; 2 Relation car = Relation . b inary (" car " ) ; 3 Variable l = Variable . unary (" l " ) ; 4 Formula f1 = l . join ( car ) . lone () 5 . f o r A l l ( l . oneOf( L i s t ) ) ;

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-22
SLIDE 22

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Alloy

( a l l l :

  • ne

L i s t | lone ( l . car ))

SMTLIB

( f o r a l l (( l univ )) (= > ( L i s t l ) ( f o r a l l (( x !1 univ ) ( x !2 univ )) (= > (and ( cdr l x !1) ( cdr l x ! 2 ) ) (= x !1 x ! 2 ) ) ) ) )

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-23
SLIDE 23

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Alloy

(one N i l )

KodKod API

6 Relation N i l = Relation . unary (" N i l " ) ; 7 Formula f2 = N i l . one ( ) ;

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-24
SLIDE 24

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Alloy

(one N i l )

SMTLIB

(and ( e x i s t s (( x !0 univ ) ( N i l x ! 0 ) ) ( f o r a l l (( x !0 univ ) ( x !1 univ )) (= > (and ( N i l x !0) ( N i l x ! 1 ) ) (and (= x !0 x ! 1 ) ) ) ) )

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-25
SLIDE 25

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Alloy

( a l l l :

  • ne ( L i s t − N i l )

| (some ( l . cdr ) and some ( l . car ) ) )

KodKod API

8 Relation car = Relation . b inary (" cdr " ) ; 9 Formula f3 = l . join ( cdr ) . some () 10 . and( l . join ( car ) . some ( ) ) 11 . f o r A l l ( 12 l . oneOf( L i s t . difference ( N i l ) ) ) ;

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-26
SLIDE 26

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Alloy

( a l l l :

  • ne ( L i s t − N i l )

| (some ( l . cdr ) and some ( l . car ) ) )

SMTLIB

( f o r a l l (( l univ )) (= > (and ( L i s t l ) ( not ( N i l l ) ) ) (and ( e x i s t s (( x !1 univ )) ( cdr l x ! 1 ) ) ( e x i s t s (( x !1 univ )) ( car l x ! 1 ) ) ) ) )

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-27
SLIDE 27

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Outcome

SAT List → {l0, l1, l2, l3, l4, l5} Object → {o0, o1} Nil → {l5} car → {l4, o1, l3, o0, l2, o0, l1, o1, l0, o1} cdr → {l4, l3, l3, l0, l2, l0, l1, l2, l0, l5} eq → {l5, l5, l4, l4, l3, l3, l2, l2, l1, l1, l0, l0, l4, l1, l1, l4, l3, l4, l2, l3} (model)

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-28
SLIDE 28

First-order Relational Logic Research Road-map Relational Specification Evaluation Theory of Lists Universe and Bounds Constraints Outcome

Outcome

  • F. Erata et. al.

Using SMT Solvers in Relational Logic

slide-29
SLIDE 29

First-order Relational Logic Research Road-map Relational Specification Evaluation

Comparison with Z3’s MBQI

1 2 3 4 5 6 7 8 9 2 4 6 8 10 ×103 scope s. KodKod Z3

  • F. Erata et. al.

Using SMT Solvers in Relational Logic