Decision Procedures and Verifjcation NAIL094 Petr Kuera Charles - - PowerPoint PPT Presentation

decision procedures and verifjcation
SMART_READER_LITE
LIVE PREVIEW

Decision Procedures and Verifjcation NAIL094 Petr Kuera Charles - - PowerPoint PPT Presentation

Decision Procedures and Verifjcation NAIL094 Petr Kuera Charles University 2019/20 (6th lecture) Petr Kuera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 1 / 42 Satisfjability Modulo Theories (SMT)


slide-1
SLIDE 1

Decision Procedures and Verifjcation

NAIL094 Petr Kučera

Charles University

2019/20 (6th lecture)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 1 / 42

slide-2
SLIDE 2

Satisfjability Modulo Theories (SMT)

slide-3
SLIDE 3

Propositional Satisfjability

We know how to decide if a propositional formula is satisfjable [(x1 ∧ x2 → x3) ∧ (x2 ∨ ¬x4) ∧ (x3 ↔ x2)] → (x1 ∨ x3 ∨ x4)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 3 / 42

slide-4
SLIDE 4

Satisfjability Modulo Theories

Satisfjability Modulo Theories (SMT)

Check satisfjability of quantifjer-free fjrst-order logic theories Examples: Real numbers with equality Linear arithmetic Formula over arrays

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 4 / 42

slide-5
SLIDE 5

Satisfjability Modulo Theories

Satisfjability Modulo Theories (SMT)

Check satisfjability of quantifjer-free fjrst-order logic theories Examples: Real numbers with equality (x1 = x2 ∨ x2 = x3) ∧ (x1 = x2 ∨ x1 = x4) ∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Linear arithmetic Formula over arrays

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 4 / 42

slide-6
SLIDE 6

Satisfjability Modulo Theories

Satisfjability Modulo Theories (SMT)

Check satisfjability of quantifjer-free fjrst-order logic theories Examples: Real numbers with equality (x1 = x2 ∨ x2 = x3) ∧ (x1 = x2 ∨ x1 = x4) ∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Linear arithmetic ((x1 + 2x3 < 5) ∨ ¬(x3 ≤ 1) ∧ (x1 ≥ 3)) Formula over arrays

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 4 / 42

slide-7
SLIDE 7

Satisfjability Modulo Theories

Satisfjability Modulo Theories (SMT)

Check satisfjability of quantifjer-free fjrst-order logic theories Examples: Real numbers with equality (x1 = x2 ∨ x2 = x3) ∧ (x1 = x2 ∨ x1 = x4) ∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Linear arithmetic ((x1 + 2x3 < 5) ∨ ¬(x3 ≤ 1) ∧ (x1 ≥ 3)) Formula over arrays ((i = j) ∧ a[j] = 1) ∧ ¬(a[i] = 1)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 4 / 42

slide-8
SLIDE 8

SMT-LIB Logics

Image source: http://smtlib.cs.uiowa.edu/logics.shtml Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 5 / 42

slide-9
SLIDE 9

First-Order Logic

First-order logic is based on Variables a set of variables Logical symbols connectives (e.g. ¬, ∧, ∨), quantifjers (∃, ∀), parentheses Signature set of function, predicate, and constant symbols Syntax describes how to write a well formed formula (with given signature)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 6 / 42

slide-10
SLIDE 10

Examples of Signatures

Equality logic (=) single binary predicate = derived inequality predicate ≠ Linear arithmetic (0, 1, +, −, =, <, ≤) Two constants (functions of arity 0): 0, 1 Two binary functions: +, − Binary predicates =, <, ≤

Derived predicates >, ≥

Arrays (read, write) Binary function read(a, i)

usually written as a[i]

Ternary function write(a, i, v)

updated array denoted as a{i ← v}

Combined with other theories (equality, linear arithmetic, …)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 7 / 42

slide-11
SLIDE 11

Examples of Signatures

Equality logic (=) single binary predicate = derived inequality predicate ≠ Linear arithmetic (0, 1, +, −, =, <, ≤) Two constants (functions of arity 0): 0, 1 Two binary functions: +, − Binary predicates =, <, ≤

Derived predicates >, ≥

Arrays (read, write) Binary function read(a, i)

usually written as a[i]

Ternary function write(a, i, v)

updated array denoted as a{i ← v}

Combined with other theories (equality, linear arithmetic, …)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 7 / 42

slide-12
SLIDE 12

Examples of Signatures

Equality logic (=) single binary predicate = derived inequality predicate ≠ Linear arithmetic (0, 1, +, −, =, <, ≤) Two constants (functions of arity 0): 0, 1 Two binary functions: +, − Binary predicates =, <, ≤

Derived predicates >, ≥

Arrays (read, write) Binary function read(a, i)

usually written as a[i]

Ternary function write(a, i, v)

updated array denoted as a{i ← v}

Combined with other theories (equality, linear arithmetic, …)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 7 / 42

slide-13
SLIDE 13

Σ-Literals

Σ-Atomic formula is defjned only using symbols in the signature Σ Σ-literal is a Σ-atomic formula or its negation Equality logic x1 = x2 ¬(x2 = x4) (or simply x2 ≠ x4) Linear arithmetic x1 > 0 2x2 − x5 = x1 + 2x4 3x5 ≤ 2x4 Arrays + Linear Arithmetic a[0] = 5 a{i ← v}[i] = v

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 8 / 42

slide-14
SLIDE 14

Σ-Literals

Σ-Atomic formula is defjned only using symbols in the signature Σ Σ-literal is a Σ-atomic formula or its negation Equality logic x1 = x2 ¬(x2 = x4) (or simply x2 ≠ x4) Linear arithmetic x1 > 0 2x2 − x5 = x1 + 2x4 3x5 ≤ 2x4 Arrays + Linear Arithmetic a[0] = 5 a{i ← v}[i] = v

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 8 / 42

slide-15
SLIDE 15

Σ-Literals

Σ-Atomic formula is defjned only using symbols in the signature Σ Σ-literal is a Σ-atomic formula or its negation Equality logic x1 = x2 ¬(x2 = x4) (or simply x2 ≠ x4) Linear arithmetic x1 > 0 2x2 − x5 = x1 + 2x4 3x5 ≤ 2x4 Arrays + Linear Arithmetic a[0] = 5 a{i ← v}[i] = v

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 8 / 42

slide-16
SLIDE 16

Σ-Literals

Σ-Atomic formula is defjned only using symbols in the signature Σ Σ-literal is a Σ-atomic formula or its negation Equality logic x1 = x2 ¬(x2 = x4) (or simply x2 ≠ x4) Linear arithmetic x1 > 0 2x2 − x5 = x1 + 2x4 3x5 ≤ 2x4 Arrays + Linear Arithmetic a[0] = 5 a{i ← v}[i] = v

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 8 / 42

slide-17
SLIDE 17

Interpretation

Is the following formula true in natural numbers ? ϕ = (∃x)[x + 0 = 1] Depends on the interpretation of the signature Interpretation of signature consists of

A domain Interpretation of the symbols in

defjnes semantic of functions, predicates, constants

An assignment of a domain element to each of the free (unquantifjed) variables

Formula is satisfjable there is a structure under which is true.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 9 / 42

slide-18
SLIDE 18

Interpretation

Is the following formula true in natural numbers ? ϕ = (∃x)[x + 0 = 1] Depends on the interpretation of the signature (0, 1, +, =) Interpretation of signature consists of

A domain Interpretation of the symbols in

defjnes semantic of functions, predicates, constants

An assignment of a domain element to each of the free (unquantifjed) variables

Formula is satisfjable there is a structure under which is true.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 9 / 42

slide-19
SLIDE 19

Interpretation

Is the following formula true in natural numbers ? ϕ = (∃x)[x + 0 = 1] Depends on the interpretation of the signature (0, 1, +, =) Interpretation of signature Σ consists of

A domain Interpretation of the symbols in

defjnes semantic of functions, predicates, constants

An assignment of a domain element to each of the free (unquantifjed) variables

Formula is satisfjable there is a structure under which is true.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 9 / 42

slide-20
SLIDE 20

Interpretation

Is the following formula true in natural numbers ? ϕ = (∃x)[x + 0 = 1] Depends on the interpretation of the signature (0, 1, +, =) Interpretation of signature Σ consists of

A domain Interpretation of the symbols in

defjnes semantic of functions, predicates, constants

An assignment of a domain element to each of the free (unquantifjed) variables

Formula is satisfjable there is a structure under which is true.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 9 / 42

slide-21
SLIDE 21

Interpretation

Is the following formula true in natural numbers ? ϕ = (∃x)[x + 0 = 1] Depends on the interpretation of the signature (0, 1, +, =) Interpretation of signature Σ consists of

A domain Interpretation of the symbols in Σ

defjnes semantic of functions, predicates, constants

An assignment of a domain element to each of the free (unquantifjed) variables

Formula is satisfjable there is a structure under which is true.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 9 / 42

slide-22
SLIDE 22

Interpretation

Is the following formula true in natural numbers ? ϕ = (∃x)[x + 0 = 1] Depends on the interpretation of the signature (0, 1, +, =) Interpretation of signature Σ consists of

A domain Interpretation of the symbols in Σ

defjnes semantic of functions, predicates, constants

An assignment of a domain element to each of the free (unquantifjed) variables

Formula is satisfjable there is a structure under which is true.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 9 / 42

slide-23
SLIDE 23

Interpretation

Is the following formula true in natural numbers ? ϕ = (∃x)[x + 0 = 1] Depends on the interpretation of the signature (0, 1, +, =) Interpretation of signature Σ consists of

A domain Interpretation of the symbols in Σ

defjnes semantic of functions, predicates, constants

An assignment of a domain element to each of the free (unquantifjed) variables

Formula is satisfjable there is a structure under which is true.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 9 / 42

slide-24
SLIDE 24

Interpretation

Is the following formula true in natural numbers ? ϕ = (∃x)[x + 0 = 1] Depends on the interpretation of the signature (0, 1, +, =) Interpretation of signature Σ consists of

A domain Interpretation of the symbols in Σ

defjnes semantic of functions, predicates, constants

An assignment of a domain element to each of the free (unquantifjed) variables

Formula is satisfjable there is a structure under which is true.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 9 / 42

slide-25
SLIDE 25

Interpretation

Is the following formula true in natural numbers ? ϕ = (∃x)[x + 0 = 1] Depends on the interpretation of the signature (0, 1, +, =) Interpretation of signature Σ consists of

A domain Interpretation of the symbols in Σ

defjnes semantic of functions, predicates, constants

An assignment of a domain element to each of the free (unquantifjed) variables

Formula ϕ is satisfjable ⇔ there is a structure under which ϕ is true.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 9 / 42

slide-26
SLIDE 26

Theory

Assume signature Σ. Σ-theory T puts restrictions on interpretations of symbols in Σ. Restricts the structures which are consistent with the theory

  • theory

consists of

  • sentences
  • sentence —
  • formula without free variables

all variables are quantifjed

  • theory is usually specifjed with a set of axioms from which

remaining sentences of can be derived by inference rules

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 10 / 42

slide-27
SLIDE 27

Theory

Assume signature Σ. Σ-theory T puts restrictions on interpretations of symbols in Σ. Restricts the structures which are consistent with the theory Σ-theory T consists of Σ-sentences Σ-sentence — Σ-formula without free variables

all variables are quantifjed

Σ-theory is usually specifjed with a set of axioms from which remaining sentences of T can be derived by inference rules

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 10 / 42

slide-28
SLIDE 28

Theory

Assume signature Σ. Σ-theory T puts restrictions on interpretations of symbols in Σ. Restricts the structures which are consistent with the theory Σ-theory T consists of Σ-sentences Σ-sentence — Σ-formula without free variables

all variables are quantifjed

Σ-theory is usually specifjed with a set of axioms from which remaining sentences of T can be derived by inference rules

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 10 / 42

slide-29
SLIDE 29

Theory

Assume signature Σ. Σ-theory T puts restrictions on interpretations of symbols in Σ. Restricts the structures which are consistent with the theory Σ-theory T consists of Σ-sentences Σ-sentence — Σ-formula without free variables

all variables are quantifjed

Σ-theory is usually specifjed with a set of axioms from which remaining sentences of T can be derived by inference rules

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 10 / 42

slide-30
SLIDE 30

T-Satisfjability and T-Validity

Assume signature Σ and Σ-theory T

Defjnition (T-satisfjability and validity)

A formula ϕ is T-satisfjable if there exists an interpretation which satisfjes both the formula ϕ and the sentences of T A formula ϕ is T-valid if every interpretation which satisfjes the sentences of T also satisfjes ϕ

Example

Consider formula in theory T of linear arithmetic

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 11 / 42

slide-31
SLIDE 31

T-Satisfjability and T-Validity

Assume signature Σ and Σ-theory T

Defjnition (T-satisfjability and validity)

A formula ϕ is T-satisfjable if there exists an interpretation which satisfjes both the formula ϕ and the sentences of T A formula ϕ is T-valid if every interpretation which satisfjes the sentences of T also satisfjes ϕ

Example

Consider formula in theory T of linear arithmetic ϕ = ( (x ≤ 5) ∨ (x > y) ) ∧ ( (x > 5) ∨ (x < y) )

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 11 / 42

slide-32
SLIDE 32

T-Satisfjability and T-Validity

Assume signature Σ and Σ-theory T

Defjnition (T-satisfjability and validity)

A formula ϕ is T-satisfjable if there exists an interpretation which satisfjes both the formula ϕ and the sentences of T A formula ϕ is T-valid if every interpretation which satisfjes the sentences of T also satisfjes ϕ

Example

Consider formula in theory T of linear arithmetic ϕ = ( (x ≤ 5) ∨ (x > y) ) ∧ ( (x > 5) ∨ (x < y) ) ϕ is T-satisfjable (e.g. set x = 4, y = 5) ϕ is not T-valid

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 11 / 42

slide-33
SLIDE 33

T-Satisfjability and T-Validity

Assume signature Σ and Σ-theory T

Defjnition (T-satisfjability and validity)

A formula ϕ is T-satisfjable if there exists an interpretation which satisfjes both the formula ϕ and the sentences of T A formula ϕ is T-valid if every interpretation which satisfjes the sentences of T also satisfjes ϕ

Example

Consider formula in theory T of linear arithmetic ϕ = (x < y) ∧ (y < z) ∧ (z < x) ϕ is not T-satisfjable …nor it is T-valid

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 11 / 42

slide-34
SLIDE 34

T-Satisfjability and T-Validity

Assume signature Σ and Σ-theory T

Defjnition (T-satisfjability and validity)

A formula ϕ is T-satisfjable if there exists an interpretation which satisfjes both the formula ϕ and the sentences of T A formula ϕ is T-valid if every interpretation which satisfjes the sentences of T also satisfjes ϕ

Example

Consider formula in theory T of linear arithmetic (∀x)(∀y)(∀z)[x < y ∧ y < z → x < z] ϕ is a T-valid Σ-sentence

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 11 / 42

slide-35
SLIDE 35

T-Satisfjability and T-Validity

Assume signature Σ and Σ-theory T

Defjnition (T-satisfjability and validity)

A formula ϕ is T-satisfjable if there exists an interpretation which satisfjes both the formula ϕ and the sentences of T A formula ϕ is T-valid if every interpretation which satisfjes the sentences of T also satisfjes ϕ

Example

Consider formula in theory T of linear arithmetic ϕ = (x ≤ x) ∧ ¬(x < x) ϕ is T-valid

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 11 / 42

slide-36
SLIDE 36

Equality

Assume a theory T which contains the following axioms of equality (∀x)[x = x] refmexivity (∀x)(∀y)[x = y → y = x] symmetry (∀x)(∀y)(∀z)[x = y ∧ y = z → x = z] transitivity Then the following is a

  • valid sentence

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 12 / 42

slide-37
SLIDE 37

Equality

Assume a theory T which contains the following axioms of equality (∀x)[x = x] refmexivity (∀x)(∀y)[x = y → y = x] symmetry (∀x)(∀y)(∀z)[x = y ∧ y = z → x = z] transitivity Then the following is a T-valid sentence (∀x)(∀y)(∀z)[(((x = y) ∧ ¬(y = z)) → ¬(x = z))]

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 12 / 42

slide-38
SLIDE 38

Problem to be Solved

Assume a signature Σ and a Σ-theory T SMT solvers aim to solve the following problem T-Satisfiability Instance: A quantifjer-free Σ-formula ϕ Question: Is ϕ a T-satisfjable formula?

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 13 / 42

slide-39
SLIDE 39

Conjunctive Fragment

Conjunctive fragment

Conjunctive fragment of theory T with signature Σ consists of formulas that are conjunctions of Σ-literals. Assume a fjxed signature Σ and a Σ-theory T Decision procedure DPT for the conjunctive fragment T

takes a conjunction ψ of Σ-literals as the input, decides if ψ is T-satisfjable, possibly returns a model (satisfying interpretation)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 14 / 42

slide-40
SLIDE 40

Example: Decision procedure for the theory of equality

Assume a conjunction ϕ of Σ-literals of form x = y and x ≠ y

Defjnition (Equality graph)

Equality graph for a formula ϕ is an undirected graph G(V, E=, E≠) where The nodes in V correspond to variables in ϕ Edge {x, y} ∈ E= if and only if ϕ contains Σ-literal x = y Edge {x, y} ∈ E≠ if and only if ϕ contains Σ-literal x ≠ y.

Decision procedure

is

  • unsatisfjable if and only if there exists an inequality edge

such that there is a path from to using only edges in .

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 15 / 42

slide-41
SLIDE 41

Example: Decision procedure for the theory of equality

Assume a conjunction ϕ of Σ-literals of form x = y and x ≠ y

Defjnition (Equality graph)

Equality graph for a formula ϕ is an undirected graph G(V, E=, E≠) where The nodes in V correspond to variables in ϕ Edge {x, y} ∈ E= if and only if ϕ contains Σ-literal x = y Edge {x, y} ∈ E≠ if and only if ϕ contains Σ-literal x ≠ y.

Decision procedure

ϕ is T-unsatisfjable if and only if there exists an inequality edge {x, y} ∈ E≠ such that there is a path from x to y using only edges in {x, y} ∈ E=.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 15 / 42

slide-42
SLIDE 42

Example: Decision procedure for the theory of equality

ϕ = (x1 ≠ x2) ∧ (x2 = x3) ∧ (x3 = x4) ∧ (x4 = x1) Formula is

  • unsatisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 16 / 42

slide-43
SLIDE 43

Example: Decision procedure for the theory of equality

ϕ = (x1 ≠ x2) ∧ (x2 = x3) ∧ (x3 = x4) ∧ (x4 = x1) x1 x2 x3 x4

x1 ≠ x2 x2 = x3 x3 = x4 x4 = x1

Formula is

  • unsatisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 16 / 42

slide-44
SLIDE 44

Example: Decision procedure for the theory of equality

ϕ = (x1 ≠ x2) ∧ (x2 = x3) ∧ (x3 = x4) ∧ (x4 = x1) x1 x2 x3 x4

x1 ≠ x2 x2 = x3 x3 = x4 x4 = x1

Formula ϕ is T-unsatisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 16 / 42

slide-45
SLIDE 45

Case Splitting

Consider formula ϕ defjned as ( x1 = x2 ∨ x1 = x3 )∧( x1 = x2 ∨ x1 = x4 )∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Checking T-satisfjability of ϕ can be split into the following four cases

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 17 / 42

slide-46
SLIDE 46

Case Splitting — Case 1

Consider formula ϕ defjned as ( x1 = x2 ∨ x1 = x3 )∧( x1 = x2 ∨ x1 = x4 )∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Case 1 ϕ1 =

x1 = x2 ∧ x1 = x2 ∧

x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Formula is not

  • satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 18 / 42

slide-47
SLIDE 47

Case Splitting — Case 1

Consider formula ϕ defjned as ( x1 = x2 ∨ x1 = x3 )∧( x1 = x2 ∨ x1 = x4 )∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Case 1 ϕ1 =

x1 = x2 ∧ x1 = x2 ∧

x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Formula ϕ1 is not T-satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 18 / 42

slide-48
SLIDE 48

Case Splitting — Case 2

Consider formula ϕ defjned as ( x1 = x2 ∨ x1 = x3 )∧( x1 = x2 ∨ x1 = x4 )∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Case 2 ϕ2 =

x1 = x2 ∧ x1 = x4 ∧

x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Formula is not

  • satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 19 / 42

slide-49
SLIDE 49

Case Splitting — Case 2

Consider formula ϕ defjned as ( x1 = x2 ∨ x1 = x3 )∧( x1 = x2 ∨ x1 = x4 )∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Case 2 ϕ2 =

x1 = x2 ∧ x1 = x4 ∧

x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Formula ϕ2 is not T-satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 19 / 42

slide-50
SLIDE 50

Case Splitting — Case 3

Consider formula ϕ defjned as ( x1 = x2 ∨ x1 = x3 )∧( x1 = x2 ∨ x1 = x4 )∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Case 3 ϕ3 = x1 = x3 ∧

x1 = x2 ∧

x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Formula is not

  • satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 20 / 42

slide-51
SLIDE 51

Case Splitting — Case 3

Consider formula ϕ defjned as ( x1 = x2 ∨ x1 = x3 )∧( x1 = x2 ∨ x1 = x4 )∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Case 3 ϕ3 = x1 = x3 ∧

x1 = x2 ∧

x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Formula ϕ3 is not T-satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 20 / 42

slide-52
SLIDE 52

Case Splitting — Case 4

Consider formula ϕ defjned as ( x1 = x2 ∨ x1 = x3 )∧( x1 = x2 ∨ x1 = x4 )∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Case 4 ϕ4 =

x1 = x3 ∧ x1 = x4 ∧ x1 ≠ x2 ∧

x1 ≠ x3 ∧ x1 ≠ x4 Formula is not

  • satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 21 / 42

slide-53
SLIDE 53

Case Splitting — Case 4

Consider formula ϕ defjned as ( x1 = x2 ∨ x1 = x3 )∧( x1 = x2 ∨ x1 = x4 )∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Case 4 ϕ4 =

x1 = x3 ∧ x1 = x4 ∧ x1 ≠ x2 ∧

x1 ≠ x3 ∧ x1 ≠ x4 Formula ϕ4 is not T-satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 21 / 42

slide-54
SLIDE 54

Case Splitting

Consider formula ϕ defjned as ( x1 = x2 ∨ x1 = x3 )∧( x1 = x2 ∨ x1 = x4 )∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Checking T-satisfjability of ϕ can be split into the following four cases

1 x1 = x2 ∧ x1 = x2 ∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 2 x1 = x2 ∧ x1 = x4 ∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 3 x1 = x3 ∧ x1 = x2 ∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 4 x1 = x3 ∧ x1 = x4 ∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4

None of these cases is

  • satisfjable, hence

is not

  • satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 22 / 42

slide-55
SLIDE 55

Case Splitting

Consider formula ϕ defjned as ( x1 = x2 ∨ x1 = x3 )∧( x1 = x2 ∨ x1 = x4 )∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 Checking T-satisfjability of ϕ can be split into the following four cases

1 x1 = x2 ∧ x1 = x2 ∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 2 x1 = x2 ∧ x1 = x4 ∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 3 x1 = x3 ∧ x1 = x2 ∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4 4 x1 = x3 ∧ x1 = x4 ∧ x1 ≠ x2 ∧ x1 ≠ x3 ∧ x1 ≠ x4

None of these cases is T-satisfjable, hence ϕ is not T-satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 22 / 42

slide-56
SLIDE 56

Case Splitting

Case splitting is ineffjcient Number of cases can be exponential in the size of the original formula Does not exploit the learning capabilities of CDCL solvers

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 23 / 42

slide-57
SLIDE 57

SMT Approach — Idea

Utilize the learning capabilities of SAT

Combination of and a SAT solver SAT solver fjnds a partial assignment satisfying the boolean structure of the formula checks if the conjunction of the corresponding

  • literals in the

partial assignment is

  • satisfjable.

Modular (and effjcient) solution

Avoids explicit case splitting

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 24 / 42

slide-58
SLIDE 58

SMT Approach — Idea

Utilize the learning capabilities of SAT

Combination of DPT and a SAT solver SAT solver fjnds a partial assignment satisfying the boolean structure of the formula checks if the conjunction of the corresponding

  • literals in the

partial assignment is

  • satisfjable.

Modular (and effjcient) solution

Avoids explicit case splitting

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 24 / 42

slide-59
SLIDE 59

SMT Approach — Idea

Utilize the learning capabilities of SAT

Combination of DPT and a SAT solver SAT solver fjnds a partial assignment satisfying the boolean structure of the formula checks if the conjunction of the corresponding

  • literals in the

partial assignment is

  • satisfjable.

Modular (and effjcient) solution

Avoids explicit case splitting

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 24 / 42

slide-60
SLIDE 60

SMT Approach — Idea

Utilize the learning capabilities of SAT

Combination of DPT and a SAT solver SAT solver fjnds a partial assignment satisfying the boolean structure of the formula DPT checks if the conjunction of the corresponding Σ-literals in the partial assignment is T-satisfjable.

Modular (and effjcient) solution

Avoids explicit case splitting

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 24 / 42

slide-61
SLIDE 61

SMT Approach — Idea

Utilize the learning capabilities of SAT

Combination of DPT and a SAT solver SAT solver fjnds a partial assignment satisfying the boolean structure of the formula DPT checks if the conjunction of the corresponding Σ-literals in the partial assignment is T-satisfjable.

Modular (and effjcient) solution

Avoids explicit case splitting

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 24 / 42

slide-62
SLIDE 62

SMT Approach — Idea

Utilize the learning capabilities of SAT

Combination of DPT and a SAT solver SAT solver fjnds a partial assignment satisfying the boolean structure of the formula DPT checks if the conjunction of the corresponding Σ-literals in the partial assignment is T-satisfjable.

Modular (and effjcient) solution

Avoids explicit case splitting

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 24 / 42

slide-63
SLIDE 63

Propositional Skeleton

Boolean encoder of an atom a is a unique boolean variable e(a). Propositional skeleton of a formula ϕ is denoted as e(ϕ) and is the result of replacing each atom with its boolean encoder.

Example

The encoder of atom is The encoder of atom is The propositional skeleton of formula is defjned as

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 25 / 42

slide-64
SLIDE 64

Propositional Skeleton

Boolean encoder of an atom a is a unique boolean variable e(a). Propositional skeleton of a formula ϕ is denoted as e(ϕ) and is the result of replacing each atom with its boolean encoder.

Example

The encoder of atom x = y is e(x = y) The encoder of atom is The propositional skeleton of formula is defjned as

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 25 / 42

slide-65
SLIDE 65

Propositional Skeleton

Boolean encoder of an atom a is a unique boolean variable e(a). Propositional skeleton of a formula ϕ is denoted as e(ϕ) and is the result of replacing each atom with its boolean encoder.

Example

The encoder of atom x = y is e(x = y) The encoder of atom x = z is e(x = z) The propositional skeleton of formula is defjned as

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 25 / 42

slide-66
SLIDE 66

Propositional Skeleton

Boolean encoder of an atom a is a unique boolean variable e(a). Propositional skeleton of a formula ϕ is denoted as e(ϕ) and is the result of replacing each atom with its boolean encoder.

Example

The encoder of atom x = y is e(x = y) The encoder of atom x = z is e(x = z) The propositional skeleton of formula ϕ = (x = y) ∨ (x = z) is defjned as e(ϕ) = e(x = y) ∨ e(x = z)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 25 / 42

slide-67
SLIDE 67

Integrating a SAT Solver With DPT

Assume a NNF formula ϕ = (x = y) ∧ ((y = z ∧ ¬(x = z)) ∨ (x = z)) Compute the propositional skeleton of Set initial propositional formula

SAT solver will be iteratively called with

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 26 / 42

slide-68
SLIDE 68

Integrating a SAT Solver With DPT

Assume a NNF formula ϕ = (x = y) ∧ ((y = z ∧ ¬(x = z)) ∨ (x = z)) Compute the propositional skeleton of ϕ e(ϕ) = e(x = y) ∧ ((e(y = z) ∧ ¬e(x = z)) ∨ e(x = z)) Set initial propositional formula

SAT solver will be iteratively called with

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 26 / 42

slide-69
SLIDE 69

Integrating a SAT Solver With DPT

Assume a NNF formula ϕ = (x = y) ∧ ((y = z ∧ ¬(x = z)) ∨ (x = z)) Compute the propositional skeleton of ϕ e(ϕ) = e(x = y) ∧ ((e(y = z) ∧ ¬e(x = z)) ∨ e(x = z)) Set initial propositional formula B = e(ϕ)

SAT solver will be iteratively called with B

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 26 / 42

slide-70
SLIDE 70

Integrating a SAT Solver With DPT

B = e(x = y) ∧ (( e(y = z) ∧ ¬e(x = z) ) ∨ e(x = z) ) Run a SAT solver on B Assume it returned a satisfying assignment: Run

  • n conjunction

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 27 / 42

slide-71
SLIDE 71

Integrating a SAT Solver With DPT

B = e(x = y) ∧ (( e(y = z) ∧ ¬e(x = z) ) ∨ e(x = z) ) Run a SAT solver on B Assume it returned a satisfying assignment: α = {e(x = y), e(y = z), ¬e(x = z)} Run

  • n conjunction

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 27 / 42

slide-72
SLIDE 72

Integrating a SAT Solver With DPT

B = e(x = y) ∧ (( e(y = z) ∧ ¬e(x = z) ) ∨ e(x = z) ) Run a SAT solver on B Assume it returned a satisfying assignment: α = {e(x = y), e(y = z), ¬e(x = z)} Run DPT on conjunction ̂ Th(α) = (x = y) ∧ (y = z) ∧ ¬(x = z)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 27 / 42

slide-73
SLIDE 73

Integrating a SAT Solver With DPT

̂ Th(α) = (x = y) ∧ (y = z) ∧ ¬(x = z) declares unsatisfjable Extend by adding clause blocking assignment

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 28 / 42

slide-74
SLIDE 74

Integrating a SAT Solver With DPT

̂ Th(α) = (x = y) ∧ (y = z) ∧ ¬(x = z) x y z

x ≠ z x = y y = z

declares unsatisfjable Extend by adding clause blocking assignment

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 28 / 42

slide-75
SLIDE 75

Integrating a SAT Solver With DPT

̂ Th(α) = (x = y) ∧ (y = z) ∧ ¬(x = z) x y z

x ≠ z x = y y = z

DPT declares ̂ Th(α) unsatisfjable Extend by adding clause blocking assignment

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 28 / 42

slide-76
SLIDE 76

Integrating a SAT Solver With DPT

̂ Th(α) = (x = y) ∧ (y = z) ∧ ¬(x = z) x y z

x ≠ z x = y y = z

DPT declares ̂ Th(α) unsatisfjable Extend B by adding clause ¬̂ Th(α) blocking assignment α B ← B ∧ (¬e(x = y) ∨ ¬e(y = z) ∨ e(x = z))

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 28 / 42

slide-77
SLIDE 77

Integrating a SAT Solver With DPT

B = e(x = y) ∧ (( e(y = z) ∧ ¬e(x = z) ) ∨ e(x = z) ) ∧ ( ¬e(x = y) ∨ ¬e(y = z) ∨ e(x = z) ) Run a SAT solver on B Assume it returned a satisfying assignment Run

  • n conjunction

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 29 / 42

slide-78
SLIDE 78

Integrating a SAT Solver With DPT

B = e(x = y) ∧ (( e(y = z) ∧ ¬e(x = z) ) ∨ e(x = z) ) ∧ ( ¬e(x = y) ∨ ¬e(y = z) ∨ e(x = z) ) Run a SAT solver on B Assume it returned a satisfying assignment α = {e(x = y), e(y = z), e(x = z)} Run

  • n conjunction

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 29 / 42

slide-79
SLIDE 79

Integrating a SAT Solver With DPT

B = e(x = y) ∧ (( e(y = z) ∧ ¬e(x = z) ) ∨ e(x = z) ) ∧ ( ¬e(x = y) ∨ ¬e(y = z) ∨ e(x = z) ) Run a SAT solver on B Assume it returned a satisfying assignment α = {e(x = y), e(y = z), e(x = z)} Run DPT on conjunction ̂ Th(α) = (x = y) ∧ (y = z) ∧ (x = z)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 29 / 42

slide-80
SLIDE 80

Integrating a SAT Solver With DPT

̂ Th(α) = (x = y) ∧ (y = z) ∧ (x = z) declares satisfjable The original formula is

  • satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 30 / 42

slide-81
SLIDE 81

Integrating a SAT Solver With DPT

̂ Th(α) = (x = y) ∧ (y = z) ∧ (x = z) x y z

x = z x = y y = z

declares satisfjable The original formula is

  • satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 30 / 42

slide-82
SLIDE 82

Integrating a SAT Solver With DPT

̂ Th(α) = (x = y) ∧ (y = z) ∧ (x = z) x y z

x = z x = y y = z

DPT declares ̂ Th(α) satisfjable The original formula is

  • satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 30 / 42

slide-83
SLIDE 83

Integrating a SAT Solver With DPT

̂ Th(α) = (x = y) ∧ (y = z) ∧ (x = z) x y z

x = z x = y y = z

DPT declares ̂ Th(α) satisfjable The original formula ϕ is T-satisfjable

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 30 / 42

slide-84
SLIDE 84

Integrating a SAT Solver With DPT

DPT SAT solver α ̂ Th(α) t e(t) SAT solver works with propositional skeleton B

If B is unsatisfjable, then ϕ is T-unsatisfjable If B is satisfjable, satisfying assignment α is passed to DPT as a conjunction ̂ Th(α)

DPT checks T-satisfjability of ̂ Th(α)

If ̂ Th(α) is T-satisfjable, then ϕ is T-satisfjable If ̂ Th(α) is not T-satisfjable, DPT returns blocking clauses t

also called lemma, e.g. t = ¬̂ Th(α)

e(t) is added to B

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 31 / 42

slide-85
SLIDE 85

Integrating a SAT Solver With DPT

DPT SAT solver α ̂ Th(α) t e(t) SAT solver works with propositional skeleton B

If B is unsatisfjable, then ϕ is T-unsatisfjable If B is satisfjable, satisfying assignment α is passed to DPT as a conjunction ̂ Th(α)

DPT checks T-satisfjability of ̂ Th(α)

If ̂ Th(α) is T-satisfjable, then ϕ is T-satisfjable If ̂ Th(α) is not T-satisfjable, DPT returns blocking clauses t

also called lemma, e.g. t = ¬̂ Th(α)

e(t) is added to B

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 31 / 42

slide-86
SLIDE 86

Integrating a SAT Solver With DPT

DPT SAT solver α ̂ Th(α) t e(t) SAT solver works with propositional skeleton B

If B is unsatisfjable, then ϕ is T-unsatisfjable If B is satisfjable, satisfying assignment α is passed to DPT as a conjunction ̂ Th(α)

DPT checks T-satisfjability of ̂ Th(α)

If ̂ Th(α) is T-satisfjable, then ϕ is T-satisfjable If ̂ Th(α) is not T-satisfjable, DPT returns blocking clauses t

also called lemma, e.g. t = ¬̂ Th(α)

e(t) is added to B

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 31 / 42

slide-87
SLIDE 87

Integrating a SAT Solver With DPT

DPT SAT solver α ̂ Th(α) t e(t) SAT solver works with propositional skeleton B

If B is unsatisfjable, then ϕ is T-unsatisfjable If B is satisfjable, satisfying assignment α is passed to DPT as a conjunction ̂ Th(α)

DPT checks T-satisfjability of ̂ Th(α)

If ̂ Th(α) is T-satisfjable, then ϕ is T-satisfjable If ̂ Th(α) is not T-satisfjable, DPT returns blocking clauses t

also called lemma, e.g. t = ¬̂ Th(α)

e(t) is added to B

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 31 / 42

slide-88
SLIDE 88

Integrating a SAT Solver With DPT

DPT SAT solver α ̂ Th(α) t e(t) SAT solver works with propositional skeleton B

If B is unsatisfjable, then ϕ is T-unsatisfjable If B is satisfjable, satisfying assignment α is passed to DPT as a conjunction ̂ Th(α)

DPT checks T-satisfjability of ̂ Th(α)

If ̂ Th(α) is T-satisfjable, then ϕ is T-satisfjable If ̂ Th(α) is not T-satisfjable, DPT returns blocking clauses t

also called lemma, e.g. t = ¬̂ Th(α)

e(t) is added to B

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 31 / 42

slide-89
SLIDE 89

Integrating a SAT Solver With DPT

DPT SAT solver α ̂ Th(α) t e(t) SAT solver works with propositional skeleton B

If B is unsatisfjable, then ϕ is T-unsatisfjable If B is satisfjable, satisfying assignment α is passed to DPT as a conjunction ̂ Th(α)

DPT checks T-satisfjability of ̂ Th(α)

If ̂ Th(α) is T-satisfjable, then ϕ is T-satisfjable If ̂ Th(α) is not T-satisfjable, DPT returns blocking clauses t

also called lemma, e.g. t = ¬̂ Th(α)

e(t) is added to B

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 31 / 42

slide-90
SLIDE 90

Integrating a SAT Solver With DPT

DPT SAT solver α ̂ Th(α) t e(t) SAT solver works with propositional skeleton B

If B is unsatisfjable, then ϕ is T-unsatisfjable If B is satisfjable, satisfying assignment α is passed to DPT as a conjunction ̂ Th(α)

DPT checks T-satisfjability of ̂ Th(α)

If ̂ Th(α) is T-satisfjable, then ϕ is T-satisfjable If ̂ Th(α) is not T-satisfjable, DPT returns blocking clauses t

also called lemma, e.g. t = ¬̂ Th(α)

e(t) is added to B

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 31 / 42

slide-91
SLIDE 91

Integrating a SAT Solver With DPT

DPT SAT solver α ̂ Th(α) t e(t) SAT solver works with propositional skeleton B

If B is unsatisfjable, then ϕ is T-unsatisfjable If B is satisfjable, satisfying assignment α is passed to DPT as a conjunction ̂ Th(α)

DPT checks T-satisfjability of ̂ Th(α)

If ̂ Th(α) is T-satisfjable, then ϕ is T-satisfjable If ̂ Th(α) is not T-satisfjable, DPT returns blocking clauses t

also called lemma, e.g. t = ¬̂ Th(α)

e(t) is added to B

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 31 / 42

slide-92
SLIDE 92

Integration of a SAT solver and DPT (1)

Function LAZY-BASIC(ϕ) Input: Formula ϕ Output: SAT if ϕ is T-satisfjable, UNSAT if not B ← e(ϕ) while true do (α, r) ← SAT-solver(B) if r = UNSAT then return UNSAT (t,r) ← Deduction(̂ Th(α)) // Calls DPT(α) if r = SAT then return SAT B ← B ∧ e(t)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 32 / 42

slide-93
SLIDE 93

Integration of a SAT solver and DPT (2)

Assume Deduction(̂ Th(α)) returns UNSAT and a formula t Formula t should satisfy the following requirements:

1 The formula t is T-valid 2 The atoms in t are restricted to those appearing in ϕ 3 The encoding of t contradicts α, i.e. e(t) is blocking

Requirement 1 guarantees soundness Requirements 2 and 3 guarantee termination The cooperation can be much more effjcient if DPT is integrated directly into the CDCL procedure of the SAT solver

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 33 / 42

slide-94
SLIDE 94

Integration of a SAT solver and DPT (2)

Assume Deduction(̂ Th(α)) returns UNSAT and a formula t Formula t should satisfy the following requirements:

1 The formula t is T-valid 2 The atoms in t are restricted to those appearing in ϕ 3 The encoding of t contradicts α, i.e. e(t) is blocking

Requirement 1 guarantees soundness Requirements 2 and 3 guarantee termination The cooperation can be much more effjcient if DPT is integrated directly into the CDCL procedure of the SAT solver

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 33 / 42

slide-95
SLIDE 95

Integration of a SAT solver and DPT (2)

Assume Deduction(̂ Th(α)) returns UNSAT and a formula t Formula t should satisfy the following requirements:

1 The formula t is T-valid 2 The atoms in t are restricted to those appearing in ϕ 3 The encoding of t contradicts α, i.e. e(t) is blocking

Requirement 1 guarantees soundness Requirements 2 and 3 guarantee termination The cooperation can be much more effjcient if DPT is integrated directly into the CDCL procedure of the SAT solver

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 33 / 42

slide-96
SLIDE 96

Integration of a SAT solver and DPT (2)

Assume Deduction(̂ Th(α)) returns UNSAT and a formula t Formula t should satisfy the following requirements:

1 The formula t is T-valid 2 The atoms in t are restricted to those appearing in ϕ 3 The encoding of t contradicts α, i.e. e(t) is blocking

Requirement 1 guarantees soundness Requirements 2 and 3 guarantee termination The cooperation can be much more effjcient if DPT is integrated directly into the CDCL procedure of the SAT solver

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 33 / 42

slide-97
SLIDE 97

Integration of a SAT solver and DPT (2)

Assume Deduction(̂ Th(α)) returns UNSAT and a formula t Formula t should satisfy the following requirements:

1 The formula t is T-valid 2 The atoms in t are restricted to those appearing in ϕ 3 The encoding of t contradicts α, i.e. e(t) is blocking

Requirement 1 guarantees soundness Requirements 2 and 3 guarantee termination The cooperation can be much more effjcient if DPT is integrated directly into the CDCL procedure of the SAT solver

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 33 / 42

slide-98
SLIDE 98

Integration of a SAT solver and DPT (2)

Assume Deduction(̂ Th(α)) returns UNSAT and a formula t Formula t should satisfy the following requirements:

1 The formula t is T-valid 2 The atoms in t are restricted to those appearing in ϕ 3 The encoding of t contradicts α, i.e. e(t) is blocking

Requirement 1 guarantees soundness Requirements 2 and 3 guarantee termination The cooperation can be much more effjcient if DPT is integrated directly into the CDCL procedure of the SAT solver

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 33 / 42

slide-99
SLIDE 99

Integration of a SAT solver and DPT (2)

Assume Deduction(̂ Th(α)) returns UNSAT and a formula t Formula t should satisfy the following requirements:

1 The formula t is T-valid 2 The atoms in t are restricted to those appearing in ϕ 3 The encoding of t contradicts α, i.e. e(t) is blocking

Requirement 1 guarantees soundness Requirements 2 and 3 guarantee termination The cooperation can be much more effjcient if DPT is integrated directly into the CDCL procedure of the SAT solver

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 33 / 42

slide-100
SLIDE 100

Integration of a SAT solver and DPT (2)

Assume Deduction(̂ Th(α)) returns UNSAT and a formula t Formula t should satisfy the following requirements:

1 The formula t is T-valid 2 The atoms in t are restricted to those appearing in ϕ 3 The encoding of t contradicts α, i.e. e(t) is blocking

Requirement 1 guarantees soundness Requirements 2 and 3 guarantee termination The cooperation can be much more effjcient if DPT is integrated directly into the CDCL procedure of the SAT solver

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 33 / 42

slide-101
SLIDE 101

Lazy-CDCL

Function Lazy-CDCL(ϕ) AddClauses(cnf(e(ϕ))) while true do while UnitPropagation() = CONFLICT do bl ← ConfmictAnalysis() if bl < 0 then return UNSAT Backtrack(bl) if Decide() fails then // Full satisfying assignment α found (t,r) ← Deduction(̂ Th(α)) if r = SAT then return SAT AddClauses(e(t))

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 34 / 42

slide-102
SLIDE 102

Improving Lazy-CDLC

Do not wait until a full satisfying assignment is found Call Deduction(̂ Th(α)) on partial assignments α

1 theory-level confmicts are detected earlier and stronger lemmas are

returned to the SAT solver,

2 theory can deduce a value for some literals ⇒ theory propagation.

If Deduction(̂ Th(α)) does not detect contradiction, then t and e(t) are equivalent to true (e.g. empty conjunction)

Example

Suppose that ϕ contains atoms x ≥ 10 and x < 0 No satisfying assignment can satisfy both e(x ≥ 10) and e(x < 0) Given e(x ≥ 10), linear arithmetic can deduce that ¬e(x < 0)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 35 / 42

slide-103
SLIDE 103

Improving Lazy-CDLC

Do not wait until a full satisfying assignment is found Call Deduction(̂ Th(α)) on partial assignments α

1 theory-level confmicts are detected earlier and stronger lemmas are

returned to the SAT solver,

2 theory can deduce a value for some literals ⇒ theory propagation.

If Deduction(̂ Th(α)) does not detect contradiction, then t and e(t) are equivalent to true (e.g. empty conjunction)

Example

Suppose that ϕ contains atoms x ≥ 10 and x < 0 No satisfying assignment can satisfy both e(x ≥ 10) and e(x < 0) Given e(x ≥ 10), linear arithmetic can deduce that ¬e(x < 0)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 35 / 42

slide-104
SLIDE 104

Improving Lazy-CDLC

Do not wait until a full satisfying assignment is found Call Deduction(̂ Th(α)) on partial assignments α

1 theory-level confmicts are detected earlier and stronger lemmas are

returned to the SAT solver,

2 theory can deduce a value for some literals ⇒ theory propagation.

If Deduction(̂ Th(α)) does not detect contradiction, then t and e(t) are equivalent to true (e.g. empty conjunction)

Example

Suppose that ϕ contains atoms x ≥ 10 and x < 0 No satisfying assignment can satisfy both e(x ≥ 10) and e(x < 0) Given e(x ≥ 10), linear arithmetic can deduce that ¬e(x < 0)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 35 / 42

slide-105
SLIDE 105

Improving Lazy-CDLC

Do not wait until a full satisfying assignment is found Call Deduction(̂ Th(α)) on partial assignments α

1 theory-level confmicts are detected earlier and stronger lemmas are

returned to the SAT solver,

2 theory can deduce a value for some literals ⇒ theory propagation.

If Deduction(̂ Th(α)) does not detect contradiction, then t and e(t) are equivalent to true (e.g. empty conjunction)

Example

Suppose that ϕ contains atoms x ≥ 10 and x < 0 No satisfying assignment can satisfy both e(x ≥ 10) and e(x < 0) Given e(x ≥ 10), linear arithmetic can deduce that ¬e(x < 0)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 35 / 42

slide-106
SLIDE 106

Improving Lazy-CDLC

Do not wait until a full satisfying assignment is found Call Deduction(̂ Th(α)) on partial assignments α

1 theory-level confmicts are detected earlier and stronger lemmas are

returned to the SAT solver,

2 theory can deduce a value for some literals ⇒ theory propagation.

If Deduction(̂ Th(α)) does not detect contradiction, then t and e(t) are equivalent to true (e.g. empty conjunction)

Example

Suppose that ϕ contains atoms x ≥ 10 and x < 0 No satisfying assignment can satisfy both e(x ≥ 10) and e(x < 0) Given e(x ≥ 10), linear arithmetic can deduce that ¬e(x < 0)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 35 / 42

slide-107
SLIDE 107

Improving Lazy-CDLC

Do not wait until a full satisfying assignment is found Call Deduction(̂ Th(α)) on partial assignments α

1 theory-level confmicts are detected earlier and stronger lemmas are

returned to the SAT solver,

2 theory can deduce a value for some literals ⇒ theory propagation.

If Deduction(̂ Th(α)) does not detect contradiction, then t and e(t) are equivalent to true (e.g. empty conjunction)

Example

Suppose that ϕ contains atoms x ≥ 10 and x < 0 No satisfying assignment can satisfy both e(x ≥ 10) and e(x < 0) Given e(x ≥ 10), linear arithmetic can deduce that ¬e(x < 0)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 35 / 42

slide-108
SLIDE 108

Improving Lazy-CDLC

Do not wait until a full satisfying assignment is found Call Deduction(̂ Th(α)) on partial assignments α

1 theory-level confmicts are detected earlier and stronger lemmas are

returned to the SAT solver,

2 theory can deduce a value for some literals ⇒ theory propagation.

If Deduction(̂ Th(α)) does not detect contradiction, then t and e(t) are equivalent to true (e.g. empty conjunction)

Example

Suppose that ϕ contains atoms x ≥ 10 and x < 0 No satisfying assignment can satisfy both e(x ≥ 10) and e(x < 0) Given e(x ≥ 10), linear arithmetic can deduce that ¬e(x < 0)

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 35 / 42

slide-109
SLIDE 109

Algorithm DPLL(T)

Function DPLL(T)(ϕ)

AddClauses(cnf(e(ϕ))) α is a new partial assignment, updated during search while true do repeat while UnitPropagation() = CONFLICT do bl ← ConfmictAnalysis() if bl < 0 then return UNSAT Backtrack(bl) (t,r) ← Deduction(̂ Th(α)) AddClauses(e(t)) until t ≡ true if α is a full assignment then return SAT Decide()

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 36 / 42

slide-110
SLIDE 110

DPLL(T) Components

Decide Backtrack Unit Propagation Confmict Analysis Deduction Add Clauses

SAT UNSAT

confmict α ̂ Th(α) t e(t) Theory propagation / confmict Nothing to propagate, no confmict α α all assigned bl < 0 bl ≥ 0

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 37 / 42

slide-111
SLIDE 111

Exhaustive theory propagation

Propagate all literals implied by ̂ Th(α) in T In practice, usually too expensive and only simple, cheap propagations are performed

Example (Equality logic)

For each unassigned atom xi = xj If the current assignment forms a path from xi to xj using edges in E=, then xi = xj is implied If current assignment forms a path from xi to xj with exactly one edge from E≠, then ¬(xi = xj) is implied.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 38 / 42

slide-112
SLIDE 112

Exhaustive theory propagation

Propagate all literals implied by ̂ Th(α) in T In practice, usually too expensive and only simple, cheap propagations are performed

Example (Equality logic)

For each unassigned atom xi = xj If the current assignment forms a path from xi to xj using edges in E=, then xi = xj is implied If current assignment forms a path from xi to xj with exactly one edge from E≠, then ¬(xi = xj) is implied.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 38 / 42

slide-113
SLIDE 113

Exhaustive theory propagation

Propagate all literals implied by ̂ Th(α) in T In practice, usually too expensive and only simple, cheap propagations are performed

Example (Equality logic)

For each unassigned atom xi = xj If the current assignment forms a path from xi to xj using edges in E=, then xi = xj is implied If current assignment forms a path from xi to xj with exactly one edge from E≠, then ¬(xi = xj) is implied.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 38 / 42

slide-114
SLIDE 114

Exhaustive theory propagation

Propagate all literals implied by ̂ Th(α) in T In practice, usually too expensive and only simple, cheap propagations are performed

Example (Equality logic)

For each unassigned atom xi = xj If the current assignment forms a path from xi to xj using edges in E=, then xi = xj is implied If current assignment forms a path from xi to xj with exactly one edge from E≠, then ¬(xi = xj) is implied.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 38 / 42

slide-115
SLIDE 115

Exhaustive theory propagation

Propagate all literals implied by ̂ Th(α) in T In practice, usually too expensive and only simple, cheap propagations are performed

Example (Equality logic)

For each unassigned atom xi = xj If the current assignment forms a path from xi to xj using edges in E=, then xi = xj is implied If current assignment forms a path from xi to xj with exactly one edge from E≠, then ¬(xi = xj) is implied.

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 38 / 42

slide-116
SLIDE 116

Blocking Clauses

Deduction(̂ Th(α)) returns blocking clause t If ̂ Th(α) implies a T-literal l, then t = (l ∨ ¬̂ Th(α)) e(t) = ⎛ ⎜ ⎝ e(l) ∨ ⋁

l′∈̂ Th(α)

¬e(l′) ⎞ ⎟ ⎠ The clause e(t) is used to derive e(l) by unit propagation and maybe never again

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 39 / 42

slide-117
SLIDE 117

Blocking Clauses

Deduction(̂ Th(α)) returns blocking clause t If ̂ Th(α) implies a T-literal l, then t = (l ∨ ¬̂ Th(α)) e(t) = ⎛ ⎜ ⎝ e(l) ∨ ⋁

l′∈̂ Th(α)

¬e(l′) ⎞ ⎟ ⎠ The clause e(t) is used to derive e(l) by unit propagation and maybe never again

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 39 / 42

slide-118
SLIDE 118

Blocking Clauses

Deduction(̂ Th(α)) returns blocking clause t If ̂ Th(α) implies a T-literal l, then t = (l ∨ ¬̂ Th(α)) e(t) = ⎛ ⎜ ⎝ e(l) ∨ ⋁

l′∈̂ Th(α)

¬e(l′) ⎞ ⎟ ⎠ The clause e(t) is used to derive e(l) by unit propagation and maybe never again

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 39 / 42

slide-119
SLIDE 119

Implied Assignments Instead of Blocking Clauses

Let Deduction(̂ Th(α)) return all T-literals implied by α DPLL(T)() adds the implied literals to the partial assignment These literals do not have antecedent

If any of them is used in ConfmictAnalysis(), DPT is asked for an explanation Clause explaining why the literal was implied The explanation clauses are added lazily on demand, not immediately when a literal is implied

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 40 / 42

slide-120
SLIDE 120

Implied Assignments Instead of Blocking Clauses

Let Deduction(̂ Th(α)) return all T-literals implied by α DPLL(T)() adds the implied literals to the partial assignment These literals do not have antecedent

If any of them is used in ConfmictAnalysis(), DPT is asked for an explanation Clause explaining why the literal was implied The explanation clauses are added lazily on demand, not immediately when a literal is implied

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 40 / 42

slide-121
SLIDE 121

Implied Assignments Instead of Blocking Clauses

Let Deduction(̂ Th(α)) return all T-literals implied by α DPLL(T)() adds the implied literals to the partial assignment These literals do not have antecedent

If any of them is used in ConfmictAnalysis(), DPT is asked for an explanation Clause explaining why the literal was implied The explanation clauses are added lazily on demand, not immediately when a literal is implied

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 40 / 42

slide-122
SLIDE 122

Implied Assignments Instead of Blocking Clauses

Let Deduction(̂ Th(α)) return all T-literals implied by α DPLL(T)() adds the implied literals to the partial assignment These literals do not have antecedent

If any of them is used in ConfmictAnalysis(), DPT is asked for an explanation Clause explaining why the literal was implied The explanation clauses are added lazily on demand, not immediately when a literal is implied

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 40 / 42

slide-123
SLIDE 123

Implied Assignments Instead of Blocking Clauses

Let Deduction(̂ Th(α)) return all T-literals implied by α DPLL(T)() adds the implied literals to the partial assignment These literals do not have antecedent

If any of them is used in ConfmictAnalysis(), DPT is asked for an explanation Clause explaining why the literal was implied The explanation clauses are added lazily on demand, not immediately when a literal is implied

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 40 / 42

slide-124
SLIDE 124

Implied Assignments Instead of Blocking Clauses

Let Deduction(̂ Th(α)) return all T-literals implied by α DPLL(T)() adds the implied literals to the partial assignment These literals do not have antecedent

If any of them is used in ConfmictAnalysis(), DPT is asked for an explanation Clause explaining why the literal was implied The explanation clauses are added lazily on demand, not immediately when a literal is implied

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 40 / 42

slide-125
SLIDE 125

Generating strong lemmas

Deduction (̂ Th(α)) returns a lemma to block current assignment α (in case of confmict). Stronger lemmas block more assignments. Identify a minimal set of literals in α causing the confmict (unsatisfjable core).

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 41 / 42

slide-126
SLIDE 126

Generating strong lemmas

Deduction (̂ Th(α)) returns a lemma to block current assignment α (in case of confmict). Stronger lemmas block more assignments. Identify a minimal set of literals in α causing the confmict (unsatisfjable core).

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 41 / 42

slide-127
SLIDE 127

Generating strong lemmas

Deduction (̂ Th(α)) returns a lemma to block current assignment α (in case of confmict). Stronger lemmas block more assignments. Identify a minimal set of literals in α causing the confmict (unsatisfjable core).

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 41 / 42

slide-128
SLIDE 128

Summary

Decision procedure for quantifjer-free theory can be obtained by a combination of a SAT solver and a decision procedure for the conjunctive fragment of the theory. More efgective if DPT

can generate strong explanations for confmict can derive values of yet unassigned literals (theory propagation) is incremental

Petr Kučera (Charles University) Decision Procedures and Verifjcation 2019/20 (6th lecture) 42 / 42