solvers principles and architecture spa
play

Solvers Principles and Architecture (SPA) Part 2 SMT Solvers - PowerPoint PPT Presentation

Solvers Principles and Architecture (SPA) Part 2 SMT Solvers Master Sciences Informatique (Sif) September, 2019 Rennes Khalil Ghorbal k halil.ghorbal@inria.fr K. Ghorbal (INRIA) 1 SIF M2 1 / 17 Syntax Recall that logic is a pair of


  1. Solvers Principles and Architecture (SPA) Part 2 SMT Solvers Master Sciences Informatique (Sif) September, 2019 Rennes Khalil Ghorbal k halil.ghorbal@inria.fr K. Ghorbal (INRIA) 1 SIF M2 1 / 17

  2. Syntax Recall that logic is a pair of syntax and semantics . Syntax • Alphabet: set of symbols • Expressions: sequences of symbols • Rules: identifying well-formed expressions Semantics • Meaning : what is meant by well-formed expressions • Rules: infer the meaning from subexpressions K. Ghorbal (INRIA) 2 SIF M2 2 / 17

  3. Extended Alphabet Syntax In addition to Logical symbols: ¬ , ∧ , − → , etc. (alphabet of propositional logic) We will be adding: • variables symbols: x , y , etc. • parameters , or non-logical symbols: ∃ , f , ≤ , =, +, π , etc. K. Ghorbal (INRIA) 3 SIF M2 3 / 17

  4. Quantifiers and Functions Quantifiers • Exists: ∃ • Forall: ∀ Functions • Symbol (or name) • Output type (or kind) – (Co-domain) • Inputs arity (or cardinality) and their respective types – (Domain) K. Ghorbal (INRIA) 4 SIF M2 4 / 17

  5. Important Classes Predicates • Sets described by some relations • n -arity functions with co-domain { F , T } (False/True in PL) • Predicate symbols: =, < , ∈ , etc. Constants • Functions with arity zero • Usual symbols: π , 1, ∅ , etc. • Predicates with arity zero are the propositional constants ( F , T ). K. Ghorbal (INRIA) 5 SIF M2 5 / 17

  6. First-Order Logic First-order means quantifiers are only allowed over variables : Q i x i . • Each quantifier is necessarily related to a variable . • A variable is either free or bound by a quantifier. Examples • Function + : ( x , y ) �→ x + y • Predicate: f ( x ) = f ( y ) (for some function f ) • Predicate: x ≤ f ( y ) K. Ghorbal (INRIA) 6 SIF M2 6 / 17

  7. Example of First-order Languages Basic Set Language • Relationship predicate: R • Constant: ∅ Elementary Number Language • Constant: 0 • Function: Succ • Equality predicate: = K. Ghorbal (INRIA) 7 SIF M2 7 / 17

  8. Terms, Formulas Terms Built inductively from functions’ symbols applied to constants and variables. • A variable v is a term • A constant 0 is a term • The function f applied to terms t 1 and t 2 is a term named f ( t 1 , t 2 ) Atomic Formulas Built by applying predicates on terms . • F / T are atomic predicates • ≤ v 0 is an atomic predicate (prefix notation) • t 1 = t 2 is an atomic predicate (infix notation) K. Ghorbal (INRIA) 8 SIF M2 8 / 17

  9. Well-Formed Formulas Built inductively from atomic formulas with logic connectives and quantifiers. • ¬ φ is a formula • φ 1 − → φ 2 is a formula • Q 1 v 1 . Q 2 v 2 .φ ( t , g ( t )) is a formula • Terms t and g ( t ) may or may not contain the variables v 1 and v 2 K. Ghorbal (INRIA) 9 SIF M2 9 / 17

  10. Free and Bound Variables A variable in a wff is either free or bound to a quantifier. • ∃ v 1 . f ( v 1 ) < v 2 : v 2 is free • ∀ v 1 . ∃ v 2 . P ( v 1 , g ( v 1 , v 2 )): both variables are bound A wff with no free variables is called a sentence . K. Ghorbal (INRIA) 10 SIF M2 10 / 17

  11. Signature A signature (Σ) contains the parameters of the language, that is all its non-logical symbols : constants, functions, and predicates. Example: Elementary Numbers Signatures • (0 , Succ , =) • (0 , 1 , + , − , > ) K. Ghorbal (INRIA) 11 SIF M2 11 / 17

  12. Semantics An interpretation ( M ) of a signature is twofold: • An underlying domain D M (e.g. natural numbers) • An interpretation of all the symbols of Σ over D M Example: Σ := (0 , 1 , + , − , > ) • D is N or Z • 0 and 1 are the natural numbers zero and one • + : ( x , y ) �→ x + y , − : ( x , y ) �→ x − y • > : ( x , y ) �→ x > y • wff w : ∃ x . ∀ y . ¬ ( x > y ) (sentence) K. Ghorbal (INRIA) 12 SIF M2 12 / 17

  13. Satisfiability Let V denote the set of variables. Given an interpretation M , an assignement is a map σ : V → D M . The assignement σ depends on the interpretation M . The interpretation M associates • Functions’ symbols ( f ) of arity n to actual mathematical functions ( f M : D n M → D M ) • Terms to elements in D M • Predicates’ symbols ( P ) of arity n to subsets P M in D n M Inductive Interpretation of wff • � Pt 1 t 2 � M ,σ � ( � t 1 � σ , � t 2 � σ ) ∈ P M . • � ∀ v . w � M ,σ � ( ∀ m ∈ D M . � w [ v \ m ] � σ = 1) ( m is a fresh variable not appearing in w ). K. Ghorbal (INRIA) 13 SIF M2 13 / 17

  14. Definitions Let Σ be a signature. A Σ − Theory T is a set of sentences over Σ. The interpretation M is a model of T if M satisfies all the sentences of T . Let T denote a theory, and σ : V → D M an assignement. • σ satisfies w w.r.t. M (model of T ) if and only if � w � M ,σ = 1 • w is T - satisfiable w.r.t. M if there exist M (model of T ), σ such that σ satisfies w w.r.t. M • w is T - unsatisfiable if and only if for all models M of T ∀ σ. ( � w � M ,σ = 0) . K. Ghorbal (INRIA) 14 SIF M2 14 / 17

  15. Satisfiability Modulo Theory • The validity problem for T is the problem of deciding, for each Σ-formula w , if w is T -valid. • The satisfiability problem for T is the problem of deciding, for each Σ-formula w , if w is T -satisfiable. Proving Validity w is T -valid if and only if ¬ w is T -unsatisfiable. K. Ghorbal (INRIA) 15 SIF M2 15 / 17

  16. Examples • ∀ v 1 . Pv 1 | = Pv 2 • ∀ v 1 . Pv 1 | = ∃ v 2 . Pv 2 • ∃ v 1 . ∀ v 2 . Qv 1 v 2 | = ∀ v 2 . ∃ v 1 . Qv 1 v 2 • | = ∃ v 1 ( Pv 1 − → ∀ v 2 . Pv 2 ) • ∀ v 1 . ∃ v 2 . Qv 1 v 2 �| = ∃ v 2 . ∀ v 1 . Qv 1 v 2 • Pv 1 �| = ∀ v 1 . Pv 1 (Depends on M ) K. Ghorbal (INRIA) 16 SIF M2 16 / 17

  17. Examples • ∀ v 1 . Pv 1 | = Pv 2 • ∀ v 1 . Pv 1 | = ∃ v 2 . Pv 2 • ∃ v 1 . ∀ v 2 . Qv 1 v 2 | = ∀ v 2 . ∃ v 1 . Qv 1 v 2 • | = ∃ v 1 ( Pv 1 − → ∀ v 2 . Pv 2 ) • ∀ v 1 . ∃ v 2 . Qv 1 v 2 �| = ∃ v 2 . ∀ v 1 . Qv 1 v 2 • Pv 1 �| = ∀ v 1 . Pv 1 (Depends on M ) K. Ghorbal (INRIA) 16 SIF M2 16 / 17

  18. Examples • ∀ v 1 . Pv 1 | = Pv 2 • ∀ v 1 . Pv 1 | = ∃ v 2 . Pv 2 • ∃ v 1 . ∀ v 2 . Qv 1 v 2 | = ∀ v 2 . ∃ v 1 . Qv 1 v 2 • | = ∃ v 1 ( Pv 1 − → ∀ v 2 . Pv 2 ) • ∀ v 1 . ∃ v 2 . Qv 1 v 2 �| = ∃ v 2 . ∀ v 1 . Qv 1 v 2 • Pv 1 �| = ∀ v 1 . Pv 1 (Depends on M ) K. Ghorbal (INRIA) 16 SIF M2 16 / 17

  19. Examples • ∀ v 1 . Pv 1 | = Pv 2 • ∀ v 1 . Pv 1 | = ∃ v 2 . Pv 2 • ∃ v 1 . ∀ v 2 . Qv 1 v 2 | = ∀ v 2 . ∃ v 1 . Qv 1 v 2 • | = ∃ v 1 ( Pv 1 − → ∀ v 2 . Pv 2 ) • ∀ v 1 . ∃ v 2 . Qv 1 v 2 �| = ∃ v 2 . ∀ v 1 . Qv 1 v 2 • Pv 1 �| = ∀ v 1 . Pv 1 (Depends on M ) K. Ghorbal (INRIA) 16 SIF M2 16 / 17

  20. Examples • ∀ v 1 . Pv 1 | = Pv 2 • ∀ v 1 . Pv 1 | = ∃ v 2 . Pv 2 • ∃ v 1 . ∀ v 2 . Qv 1 v 2 | = ∀ v 2 . ∃ v 1 . Qv 1 v 2 • | = ∃ v 1 ( Pv 1 − → ∀ v 2 . Pv 2 ) • ∀ v 1 . ∃ v 2 . Qv 1 v 2 �| = ∃ v 2 . ∀ v 1 . Qv 1 v 2 • Pv 1 �| = ∀ v 1 . Pv 1 (Depends on M ) K. Ghorbal (INRIA) 16 SIF M2 16 / 17

  21. Examples • ∀ v 1 . Pv 1 | = Pv 2 • ∀ v 1 . Pv 1 | = ∃ v 2 . Pv 2 • ∃ v 1 . ∀ v 2 . Qv 1 v 2 | = ∀ v 2 . ∃ v 1 . Qv 1 v 2 • | = ∃ v 1 ( Pv 1 − → ∀ v 2 . Pv 2 ) • ∀ v 1 . ∃ v 2 . Qv 1 v 2 �| = ∃ v 2 . ∀ v 1 . Qv 1 v 2 • Pv 1 �| = ∀ v 1 . Pv 1 (Depends on M ) K. Ghorbal (INRIA) 16 SIF M2 16 / 17

  22. DPLL(T) – CDCL(T) Quantifier free formula: ( x ≤ 0 ∨ x + y ≤ 0) ∧ y ≥ 1 ∧ x ≥ 1 Translated into a CNF: ( a ∨ b ) ∧ c ∧ d SAT gives ( a , b , c , d ) = (1 , 0 , 1 , 1) But x ≤ 0 ∧ x ≥ 1 is a contradiction: a ∨ ¯ Learn ¯ d SAT gives ( a , b , c , d ) = (0 , 1 , 1 , 1) But x + y ≤ 0 ∧ y ≥ 1 ∧ x ≥ 1 is a contradiction: Learn ¯ c ∨ ¯ b ∨ ¯ d The problem is UNSAT. K. Ghorbal (INRIA) 17 SIF M2 17 / 17

Recommend


More recommend