214
SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani — ICT Graduate School Course — Trento, May 2002 SAT: Propositional Satisfiability and Beyond Roberto Sebastiani Dept. of Information and Communication Technologies University of Trento, Italy [email protected] http://www.dit.unitn.it/˜rseba c Roberto Sebastiani ICT Graduate School, Trento, May-June 2002 1

SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

— ICT Graduate School Course —Trento, May 2002

SAT: PropositionalSatisfiability and Beyond

Roberto SebastianiDept. of Information and Communication Technologies

University of Trento, [email protected] http://www.dit.unitn.it/˜rseba

c Roberto SebastianiICT Graduate School, Trento, May-June 2002 1

Page 2: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

PART 1:PROPOSITIONALSATISFIABILITY

ICT Graduate School, Trento, May-June 2002 2

Page 3: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Basics on SAT

ICT Graduate School, Trento, May-June 2002 3

Page 4: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Basic notation & definitions

Boolean formulaare formulas

A propositional atom is a formula;if and are formulas, then , , ,

, are formulas.Literal: a propositional atom (positive literal) or itsnegation (negative literal)

: the set of propositional atomsoccurring in .a boolean formula can be represented as a tree or asa DAG

ICT Graduate School, Trento, May-June 2002 4

Page 5: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Basic notation & definitions (cont)

Total truth assignment for :.

Partial Truth assignment for :, .

Set and formula representation of an assignment:can be represented as a set of literals:

EX:can be represented as a formula:

EX:

ICT Graduate School, Trento, May-June 2002 5

Page 6: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Basic notation & definitions (cont)

( satisfies ):

...is satisfiable iff for some

( entails ):iff for every

( is valid):iff for every

is valid is not satisfiableICT Graduate School, Trento, May-June 2002 6

Page 7: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Equivalence and equi-satisfiability

and are equivalent iff, for every ,iff

and are equi-satisfiable iffexists s.t. iff exists s.t.

, equivalent

, equi-satisfiable

EX: and , not in, are equi-satisfiable but not equivalent.

ICT Graduate School, Trento, May-June 2002 7

Page 8: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Complexity

The problem of deciding the satisfiability of apropositional formula is NP-complete [14].The most important logical problems (validity,inference, entailment, equivalence, ...) can bestraightforwardly reduced to satisfiability, and are thus(co)NP-complete.

No existing worst-case-polynomial algorithm.

ICT Graduate School, Trento, May-June 2002 8

Page 9: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

NNF, CNF and conversions

ICT Graduate School, Trento, May-June 2002 9

Page 10: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

POLARITY of subformulas

Polarity: the number of nested negations modulo 2.Positive/negative occurrences

occurs positively in ;if occurs positively [negatively] in ,then occurs negatively [positively] inif or occur positively [negatively] in ,then and occur positively [negatively] in ;if occurs positively [negatively] in ,then occurs negatively [positively] in andoccurs positively [negatively] in ;if occurs in ,then and occur positively and negatively in ;

ICT Graduate School, Trento, May-June 2002 10

Page 11: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Negative normal form (NNF)

is in Negative normal form iff it is given only byapplications of to literals.every can be reduced into NNF:1. substituting all ’s and ’s:

2. pushing down negations recursively:

The reduction is linear if a DAG representation is used.Preserves the equivalence of formulas.

ICT Graduate School, Trento, May-June 2002 11

Page 12: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conjunctive Normal Form (CNF)

is in Conjunctive normal form iff it is a conjunction ofdisjunctions of literals:

the disjunctions of literals are called clausesEasier to handle: list of lists of literals.

ICT Graduate School, Trento, May-June 2002 12

Page 13: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Classic CNF Conversion

Every can be reduced into CNF by, e.g.,1. converting it into NNF;2. applying recursively the DeMorgan’s Rule:

Worst-case exponential..

is equivalent to .Normal: if equivalent to , then identicalto modulo reordering.Rarely used in practice.

ICT Graduate School, Trento, May-June 2002 13

Page 14: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Labeling CNF conversion [43, 18]

Every can be reduced into CNF by, e.g.,1. converting it into NNF;2. applying recursively bottom-up the rules:

being literals and being a “new” variable.Worst-case linear.

.is equi-satisfiable w.r.t. .

Non-normal.More used in practice.

ICT Graduate School, Trento, May-June 2002 14

Page 15: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Labeling CNF conversion (improved)

As in the previous case, applying instead the rules:

Smaller in size.

ICT Graduate School, Trento, May-June 2002 15

Page 16: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

k-SAT and Phase Transition

ICT Graduate School, Trento, May-June 2002 16

Page 17: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

The satisfiability of k-CNF (k-SAT) [21]

k-CNF: CNF s.t. all clauses have literalsthe satisfiability of 2-CNF is polynomialthe satisfiability of k-CNF is NP-complete forevery k-CNF formula can be converted into 3-CNF:

ICT Graduate School, Trento, May-June 2002 17

Page 18: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Random K-CNF formulas generation

Random k-CNF formulas with variables and clauses:

DO

1. pick with uniform probability a set of atoms over

2. randomly negate each atom with probability

3. create a disjunction of the resulting literals

UNTIL different clauses have been generated;

ICT Graduate School, Trento, May-June 2002 18

Page 19: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Random k-SAT plots

fix andfor increasing , randomly generate and solve(500,1000,10000,...) problems with k, L, Nplot

satisfiability percentagesmedian/geometrical mean CPU time/# of steps

against

ICT Graduate School, Trento, May-June 2002 19

Page 20: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

The phase transition phenomenon: SAT % Plots [40, 38]

Increasing we pass from 100% satisfiable to100% unsatisfiable formulasthe decay becomes steeper withfor , the plot converges to a step in thecross-over point ( for k=3)Revealed for many other NP-complete problemsMany theoretical models [52, 22]

ICT Graduate School, Trento, May-June 2002 20

Page 21: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

0

0.2

0.4

0.6

0.8

1

3 3.5 4 4.5 5 5.5 6CLAUSE # / VAR #

SAT%

N=50N=100N=200

ICT Graduate School, Trento, May-June 2002 21

Page 22: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

The phase transition phenomenon: CPU times/step #

Using search algorithms (DPLL):

Increasing we pass from easy problems, to veryhard problems down to hard problemsthe peak is centered in the satisfiable pointthe decay becomes steeper withfor , the plot converges to an impulse in thecross-over point ( for k=3)easy problems ( ) increase polynomiallywith , hard problems increase exponentially withIncreasing , satisfiable problems get harder,unsatisfiable problems get easier.

ICT Graduate School, Trento, May-June 2002 22

Page 23: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

0

5000

10000

15000

20000

25000

30000

3 3.5 4 4.5 5 5.5 6CLAUSE # / VAR #

MEDIAN

N=50N=100N=200

ICT Graduate School, Trento, May-June 2002 23

Page 24: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

0

5000

10000

15000

20000

25000

3 3.5 4 4.5 5 5.5 6CLAUSE # / VAR #

GEOMEAN

N=50N=100N=200

ICT Graduate School, Trento, May-June 2002 24

Page 25: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Basic SAT techniques

ICT Graduate School, Trento, May-June 2002 25

Page 26: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Truth Tables

Exhaustive evaluation of all subformulas:

Requires polynomial space.Never used in practice.

ICT Graduate School, Trento, May-June 2002 26

Page 27: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Semantic tableaux [51]

Search for an assignment satisfyingapplies recursively elimination rules to the connectivesIf a branch contains and , ( and ) for some, the branch is closed, otherwise it is open.

if no rule can be applied to an open branch , then;

if all branches are closed, the formula is not satisfiable;

ICT Graduate School, Trento, May-June 2002 27

Page 28: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Tableau elimination rules

-elimination

-elimination

-elimination

ICT Graduate School, Trento, May-June 2002 28

Page 29: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Tableau algorithm

Tableau/* branch closed */

False;/* -elimination */

Tableau ;/* -elimination */

Tableau ;/* -elimination */

TableauTableau ;

...True; /* branch expanded */

ICT Graduate School, Trento, May-June 2002 29

Page 30: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Semantic Tableaux – summary

Branches on disjunctionsHandles all propositional formulas (CNF not required).Intuitive, modular, easy to extend

loved by logicians.Rather inefficient

avoided by computer scientists.Requires polynomial space

ICT Graduate School, Trento, May-June 2002 30

Page 31: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

DPLL [17, 16]

Davis-Putnam-Longeman-Loveland procedure (DPLL)Tries to build recursively an assignment satisfying ;At each recursive step assigns a truth value to (allinstances of) one atom.Performs deterministic choices first.

ICT Graduate School, Trento, May-June 2002 31

Page 32: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

DPLL rules

( is a pure literal in iff it occurs only positively).

ICT Graduate School, Trento, May-June 2002 32

Page 33: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

DPLL Algorithm

DPLL( )/* base */

True;/* backtrack */

False;a unit clause occurs in /* unit */

DPLL( );a literal occurs pure in /* pure */

DPLL( );l := choose-literal( ); /* split */

DPLL( )DPLL( );

ICT Graduate School, Trento, May-June 2002 33

Page 34: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

DPLL – summary

Branches on truth values.Postpones branching as much as possible.Handles CNF formulas (non-CNF variant known[3, 27]).Mostly ignored by logicians.Probably the most efficient SAT algorithm

loved by computer scientists.Requires polynomial spaceChoose literal() critical!Many very efficient implementations [55, 50, 7, 42].A library: SIM [26]

ICT Graduate School, Trento, May-June 2002 34

Page 35: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Ordered Binary Decision Diagrams (OBDDs) [11]

Normal representation of a boolean formula.variable ordering imposed a priory.Binary DAGs with two leaves: 1 and 0Paths leading to 1 represent modelsPaths leading to 0 represent counter-modelsOnce built, logical operations (satisfiability, validity,equivalence) immediate.Finds all models.

ICT Graduate School, Trento, May-June 2002 35

Page 36: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

(Implicit) OBDD structure

,,

ICT Graduate School, Trento, May-June 2002 36

Page 37: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

OBDD - Examples

FT

b3

a3

b3

b2

a2

b2

b1b1

a1 a1

a2

a3 a3 a3

a2

a3

b1 b1 b1 b1 b1 b1

b2 b2 b2 b2

b3 b3

b1 b1

T F

Figure 1: BDDS of with differentvariable orderings

ICT Graduate School, Trento, May-June 2002 37

Page 38: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Incrementally building an OBDD

,,

ICT Graduate School, Trento, May-June 2002 38

Page 39: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

OBDD – summary

(Implicitly) branch on truth values.Handle all propositional formulas (CNF not required).Find all models.Factorize common parts of the search tree (DAG)Require setting a variable ordering a priori (critical!)Very efficient for some problems (circuits, modelchecking).Require exponential space in worst-caseUsed by Hardware community, ignored by logicians,recently introduced in computer science.

ICT Graduate School, Trento, May-June 2002 39

Page 40: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Incomplete SAT techniques: GSAT [48]

Hill-Climbing techniques: GSATlooks for a complete assignment;starts from a random assignment;Greedy search: looks for a better “neighbor”assignmentAvoid local minima: restart & random walk

ICT Graduate School, Trento, May-June 2002 40

Page 41: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

GSAT algorithm

GSAT( )Max-tries

:= rand-assign( );Max-flips

( )True;

Best-flips := hill-climb( );:= rand-pick(Best-flips);

:= flip( );

“no satisfying assignment found”.

ICT Graduate School, Trento, May-June 2002 41

Page 42: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

GSAT – summary

Handle only CNF formulas.IncompleteExtremely efficient for some (satisfiable) problems.Require polynomial spaceUsed in Artificial Intelligence (e.g., planning)Variants: GSAT+random walk, WSATNon-CNF Variants: NC-GSAT [45], DAG-SAT [47]

ICT Graduate School, Trento, May-June 2002 42

Page 43: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

SAT for non-CNF formulas

ICT Graduate School, Trento, May-June 2002 43

Page 44: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Non-CNF DPLL [3]

NC DPLL( )/* base */

True;/* backtrack */

False;s.t. equivalent unit /* unit */

NC DPLL( );s.t. equivalent pure /* pure */

NC DPLL( );l := choose-literal( ); /* split */

NC DPLL( )NC DPLL( );

ICT Graduate School, Trento, May-June 2002 44

Page 45: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Non-CNF DPLL (cont.)

:

ICT Graduate School, Trento, May-June 2002 45

Page 46: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Non-CNF DPLL (cont.)

:

ICT Graduate School, Trento, May-June 2002 46

Page 47: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Applying DPLL to [27, 25]

inapplicable in most cases.introduces new variables

size of assignment space passes from toIdea: values of new variables derive deterministicallyfrom those of original variables.Realization: restrict to split first onoriginal variables

DPLL assigns the other variables deterministically.

ICT Graduate School, Trento, May-June 2002 47

Page 48: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Applying DPLL to (cont)

If basic is used:

then B is deterministicaly assigned by unit propagationif and are assigned.

ICT Graduate School, Trento, May-June 2002 48

Page 49: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

If the improved is used:

then B is deterministically assigned:by unit propagation if and are assigned to .by pure literal if one of and is assigned to .

ICT Graduate School, Trento, May-June 2002 49

Page 50: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Non-CNF GSAT [45]

NC GSAT( )Max-tries

:= rand-assign( );Max-flips

( )True;

Best-flips := hill-climb( );:= rand-pick(Best-flips);

:= flip( );

“no satisfying assignment found”.

ICT Graduate School, Trento, May-June 2002 50

Page 51: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Non-CNF GSAT (cont.)

computes directly in linear time.

ICT Graduate School, Trento, May-June 2002 51

Page 52: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

DPLL Heuristics &Optimizations

ICT Graduate School, Trento, May-June 2002 52

Page 53: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Techniques to achieve efficiency in DPLL

Preprocessing: preprocess the input formula so that tomake it easier to solveLook-ahead: exploit information about the remainingsearch space

unit propagationpure literalforward checking (splitting heuristics)

Look-back: exploit information about search which hasalready taken place

BackjumpingLearning

ICT Graduate School, Trento, May-June 2002 53

Page 54: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Variants of DPLL

DPLL is a family of algorithms.

different splitting heuristicspreprocessing: (subsumption, 2-simplification)backjumpinglearningrandom restarthorn relaxation...

ICT Graduate School, Trento, May-June 2002 54

Page 55: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Splitting heuristics - Choose literal()

Split is the source of non-determinism for DPLLChoose literal() critical for efficiencymany split heuristics conceived in literature.

ICT Graduate School, Trento, May-June 2002 55

Page 56: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Some example heuristics

MOM heuristics: pick the literal occurring most often inthe minimal size clauses

fast and simpleJeroslow-Wang: choose the literal with maximum

estimates ’s contribution to the satisfiability ofSatz: selects a candidate set of literals, perform unitpropagation, chooses the one leading to smallerclause set

maximizes teh effects of unit propagation

ICT Graduate School, Trento, May-June 2002 56

Page 57: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Some preprocessing techniques

Sorting+subsumption:

ICT Graduate School, Trento, May-June 2002 57

Page 58: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Some preprocessing techniques (cont.)

2-simplifying [9]: exploiting binary clauses.

1. build the implication graph induced by literals2. detect strongly connected cycles

equivalence classes of literals3. perform substitutions4. perform unit and pure.

no more simplification possible.Very suseful for many application domains.

ICT Graduate School, Trento, May-June 2002 58

Page 59: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking (backjumping) [7, 50]

Idea: when a branch fails,1. reveal the sub-assignment causing the failure

(conflict set)2. backtrack to the most recent branching point in the

conflict seta conflict set is constructed from the conflict clause bytracking backwards the unit-implications causing it andby keeping the branching literals.when a branching point fails, a conflict set is obtainedby resolving the two conflict sets of the two branches.may avoid lots of redundant search.

ICT Graduate School, Trento, May-June 2002 59

Page 60: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking – example

ICT Graduate School, Trento, May-June 2002 60

Page 61: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking – example (cont.)

(initial assignment)

ICT Graduate School, Trento, May-June 2002 61

Page 62: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking – example (cont.)

(branch on )

ICT Graduate School, Trento, May-June 2002 62

Page 63: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking – example (cont.)

(unit )ICT Graduate School, Trento, May-June 2002 63

Page 64: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking – example (cont.)

(unit )ICT Graduate School, Trento, May-June 2002 64

Page 65: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking – example (cont.)

(unit )ICT Graduate School, Trento, May-June 2002 65

Page 66: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking – example (cont.)

Conflict set: backtrack to

ICT Graduate School, Trento, May-June 2002 66

Page 67: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking – example (cont.)

(branch on )

ICT Graduate School, Trento, May-June 2002 67

Page 68: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking – example (cont.)

(unit )ICT Graduate School, Trento, May-June 2002 68

Page 69: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking – example (cont.)

conflict set: .

ICT Graduate School, Trento, May-June 2002 69

Page 70: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Conflict-directed backtracking – example (cont.)

conflict set:backtrack to .

ICT Graduate School, Trento, May-June 2002 70

Page 71: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Learning [7, 50]

Idea: When a conflict set is revealed, then canbe added to the clause set

DPLL will never again generate an assignmentcontaining .May avoid a lot of redundant search.Problem: may cause a blowup in space

techniques to control learning and to drop learnedclauses when necessary

ICT Graduate School, Trento, May-June 2002 71

Page 72: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Learning – example (cont.)

Conflict set:learn

ICT Graduate School, Trento, May-June 2002 72

Page 73: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

SOME APPLICATIONS

ICT Graduate School, Trento, May-June 2002 73

Page 74: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Many applications of SAT

Many successful applications of SAT:Boolean circuits(Bounded) Planning(Bounded) Model CheckingCryptographyScheduling...

All NP-complete problem can be (polynomially)converted to SAT.Key issue: find an efficient encoding.

ICT Graduate School, Trento, May-June 2002 74

Page 75: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Application #1:(Bounded) Planning

ICT Graduate School, Trento, May-June 2002 75

Page 76: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

The problem [37, 36]

Problem Given a set of action operators , (arepresentation of) an initial state I and goal state G,and a bound n, find a sequence of operatorapplications , leading from the initial state tothe goal state.Idea: Encode it into satisfiability problem of a booleanformula

ICT Graduate School, Trento, May-June 2002 76

Page 77: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Example

B B

GOAL

A C

A

INITIAL

C

T

ICT Graduate School, Trento, May-June 2002 77

Page 78: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Encoding

Initial states:

Goal states:

Action preconditions and effects:

ICT Graduate School, Trento, May-June 2002 78

Page 79: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Encoding: Frame axioms

Classic

“At least one action” axiom:

Explanatory

ICT Graduate School, Trento, May-June 2002 79

Page 80: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Planning strategy

Sequential for each pair of actions and , addaxioms of the form for each odd time step.For example, we will have:

parallel for each pair of actions and , add axioms ofthe form for each odd time step if effectscontradict preconditions. For example, we will have

ICT Graduate School, Trento, May-June 2002 80

Page 81: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Application #2:Bounded Model Checking

ICT Graduate School, Trento, May-June 2002 81

Page 82: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Bounded Planning

Incomplete techniquevery efficient: competitive with state-of-the-artplannerslots of enhancements [37, 36, 19, 25]

ICT Graduate School, Trento, May-June 2002 82

Page 83: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

The problem [8]

Ingredients:A system written as a Kripke structure

S: set of statesI: set of initial statesT: transition relation

: labeling functionA property written as a LTL formula:

a propositional literal, , , , , and ,

, , , , “next”, “globally”, “eventually”, “until”and “releases”

an integer (bound)ICT Graduate School, Trento, May-June 2002 83

Page 84: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

The problem (cont.)

Problem:Is there an execution path of of length satisfying thetemporal property ?:

ICT Graduate School, Trento, May-June 2002 84

Page 85: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

The encoding

Equivalent to the satisfiability problem of a booleanformula defined as follows:

ICT Graduate School, Trento, May-June 2002 85

Page 86: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

The encoding of and

ICT Graduate School, Trento, May-June 2002 86

Page 87: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Example: (reachability)

: is there a reachable state in which holds?is:

ICT Graduate School, Trento, May-June 2002 87

Page 88: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Example:

: is there a path where holds forever?is:

ICT Graduate School, Trento, May-June 2002 88

Page 89: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Example: (fair reachability)

: is there a reachable state in whichholds provided that q holds infinitely often?

is:

ICT Graduate School, Trento, May-June 2002 89

Page 90: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Bounded Model Checking

incomplete techniquevery efficient for some problemslots of enhancements [8, 1, 49, 53, 13]

ICT Graduate School, Trento, May-June 2002 90

Page 91: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

PART 2:BEYONDPROPOSITIONALSATISFIABILITY

ICT Graduate School, Trento, May-June 2002 91

Page 92: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Goal

Extending SAT procedures to moreexpressive domains [30, 46, 5]

Two viewpoints:

(SAT experts) Export the efficiency of SAT techniquesto other domains(Logicians) Provide a new “SAT based” generalframework from which to build efficient decisionprocedures(alternative, e.g., to semantic tableaux)

ICT Graduate School, Trento, May-June 2002 92

Page 93: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

FORMAL FRAMEWORK

ICT Graduate School, Trento, May-June 2002 93

Page 94: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Ingredients

A logic language extending boolean logic:Language-specific atomic expression are formulas(e.g., , , ,

)if and formulas, then , , ,

, are formulas.Nothing else is a formula(e.g., no external quantifiers!)

ICT Graduate School, Trento, May-June 2002 94

Page 95: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Ingredients (cont.)

A semantic for extending standard boolean one:[definition specific for ]

ICT Graduate School, Trento, May-June 2002 95

Page 96: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Ingredients (cont.)

A language-specific procedure able to decidethe satisfiability of lists of atomic expressions and theirnegationsE.g.:

( ) Sat( Unsat

( )Unsat

UnsatICT Graduate School, Trento, May-June 2002 96

Page 97: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Definitions: atoms, literals

An atom is every formula in whose main connectiveis not a boolean operator.A literal is either an atom (a positive literal) or itsnegation (a negative literal).Examples:

,,

, ,,

: the set of top-level atoms in .

ICT Graduate School, Trento, May-June 2002 97

Page 98: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Definitions: total truth assignment

We call a total truth assignment for a total function

We represent a total truth assignment either as a setof literals

or as a boolean formula

ICT Graduate School, Trento, May-June 2002 98

Page 99: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Definitions: partial truth assignment

We call a partial truth assignment for a partialfunction

Partial truth assignments can be represented as setsof literals or as boolean functions, as before.A partial truth assignment for is a subset of a totaltruth assignment for .If , then we say that extends and thatsubsumes .a conflict set for is an inconsistent subsets.t. no strict subset of is inconsistent.

ICT Graduate School, Trento, May-June 2002 99

Page 100: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Definitions: total and partial truth assignment (cont.)

Remark:Syntactically identical instances of the same atom inare always assigned identical truth values.E.g.,Equivalent but syntactically different atoms in maybe assigned different truth values.E.g.,

ICT Graduate School, Trento, May-June 2002 100

Page 101: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Definition: propositional satisfiability in

A truth assignment for propositionally satisfies in ,written , iff it makes evaluate to :

A partial assignment propositionally satisfies iff alltotal assignments extending propositionally satisfy .

ICT Graduate School, Trento, May-June 2002 101

Page 102: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Definition: propositional satisfiability in (cont)

Intuition: If is seen as a boolean combination of itsatoms, is standard propositional satisfiability.Atoms seen as (recognizable) blackboxesThe definitions of , is straightforward.

stronger than : if , then , but notvice versa.E.g., , but

.

ICT Graduate School, Trento, May-June 2002 102

Page 103: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Satisfiability and propositional satisfiability in

Proposition: is satisfiable in iff there exists a truthassignment for s.t.

, and

is satisfiable in .

Search decomposed into two orthogonal components:Purely propositional: search for a truth assignments

propositionally satisfyingPurely domain-dependent: verify the satisfiability in

of .ICT Graduate School, Trento, May-June 2002 103

Page 104: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Example

, but is unsatisfiable, as contains conflict sets:

, and is satisfiable ( ).ICT Graduate School, Trento, May-June 2002 104

Page 105: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Complete collection of assignments

A collection of (possibly partial)assignments propositionally satisfying is complete iff

for every total assignment s.t. , there iss.t. .

represents all assignments.“compact” representation of the whole set of total

assignments propositionally satisfying .

ICT Graduate School, Trento, May-June 2002 105

Page 106: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Complete collection of assignments and satisfiability in

Proposition. Let be a completecollection of truth assignments propositionally satisfying

. Then is satisfiable if and only if is satisfiable forsome .

Search decomposed into two orthogonal components:Purely propositional: generate (in a lazy way) acomplete collection of truthassignments propositionally satisfying ;Purely domain-dependent: check one by one thesatisfiability in of the ’s.

ICT Graduate School, Trento, May-June 2002 106

Page 107: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Redundancy of complete collection of assignments

A complete collection of assignmentspropositionally satisfying is

strongly non redundant iff, for every ,is propositionally unsatisfiable,

non redundant iff, for every , is nomore complete,redundant otherwise.

ICT Graduate School, Trento, May-June 2002 107

Page 108: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

If is redundant, then for some :

If is strongly non redundant, then is nonredundant:

ICT Graduate School, Trento, May-June 2002 108

Page 109: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Redundancy: example

Let , , , atoms. Then

1.is the set of all total

assignments propositionally satisfying ;

2.is complete but redundant;

3. is complete, non redundant but notstrongly non redundant;

4. is complete and strongly nonredundant.

ICT Graduate School, Trento, May-June 2002 109

Page 110: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

A GENERALIZEDSEARCH PROCEDURE

ICT Graduate School, Trento, May-June 2002 110

Page 111: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Truth assignment enumerator

A truth assignment enumerator is a total function() which takes as input a formula

in and returns a complete collection ofassignments propositionally satisfying .

A truth assignment enumerator isstrongly non-redundant ifis strongly non-redundant, for every ,non-redundant if isnon-redundant, for every ,redundant otherwise.

ICT Graduate School, Trento, May-June 2002 111

Page 112: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Truth assignment enumerator w.r.t. SAT solver

Remark. Notice the difference:

A SAT solver has to find only one satisfyingassignment —or to decide there is none;A Truth assignment enumerator has to find a completecollection of satisfying assignments.

ICT Graduate School, Trento, May-June 2002 112

Page 113: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

A generalized procedure

( )

( ) /* next in */( )

( );((satifiable = False) )

( False)True; /* a satisf. assignment found */

False; /* no satisf. assignment found */

ICT Graduate School, Trento, May-June 2002 113

Page 114: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

( ) terminating, correct and complete( ) terminating, correct and complete.

depends on only forrequires polynomial space iff

requires polynomial space andis lazy

ICT Graduate School, Trento, May-June 2002 114

Page 115: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Mandatory requirements for an assignment enumerator

An assignment enumerator must always:(Termination) terminate(Correctness) generate assignments propositionallysatisfying(Completeness) generate complete set of assignments

ICT Graduate School, Trento, May-June 2002 115

Page 116: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Mandatory requirements for ()

() must always:(Termination) terminate(Correctness & completeness) return if issatisfiable in , otherwise

ICT Graduate School, Trento, May-June 2002 116

Page 117: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Efficiency requirements for an assignent enumerator

To achieve the maximum efficiency, an assignentenumerator should:

(Laziness) generate the assignments one-at-a-time.(Polynomial Space) require only polynomial space(Strong Non-redundancy) be strongly non-redundant(Time efficiency) be fast[(Symbiosis with ) be able to tale benefitfrom failure & success information provided by

(e.g., conflict sets, inferred assignments)]

ICT Graduate School, Trento, May-June 2002 117

Page 118: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Benefits of (strongly) non-redundant generators

Non-redundant enumerators avoid generating partialassignments whose unsatisfiability is a propositionalconsequence of those already generated.Strongly non-redundant enumerators avoid generatingpartial assignments covering areas of the searchspace which are covered by already-generated ones.Strong non-redundancy provides a logical warrant thatan already generated assignment will never begenerated again.

no extra control required to avoid redundancy.

ICT Graduate School, Trento, May-June 2002 118

Page 119: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Efficiency requirements for ()

To achieve the maximum efficiency, () should:

(Time efficiency) be fast(Polynomial Space) require only polynomial space[(Symbiosis with ) be able toproduce failure & success information (e.g., conflictsets, inferred assignments)][(Incrementality) be incremental: ( )reuses computation of ( )]

ICT Graduate School, Trento, May-June 2002 119

Page 120: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

EXTENDING EXISTINGSAT PROCEDURES

ICT Graduate School, Trento, May-June 2002 120

Page 121: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

General ideas

Existing SAT procedures are natural candidates to beused as assignment enumerators.

Atoms labelled by propositional atomsSlight modifications(backtrack when assignment found)Completeness to be verified!(E.g., DPLL with Pure literal)Candidates: OBDDs, Semantic Tableaux, DPLL

ICT Graduate School, Trento, May-June 2002 121

Page 122: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

OBDDs

In an OBDDs, the set of paths from the root torepresent a complete collection of assignmentsSome may be inconsistent inReduction: [12, 41]1. inconsistent paths from the root to internal nodes

are detected2. they are redirected to the (0) node3. the resulting OBDD is simplified.

ICT Graduate School, Trento, May-June 2002 122

Page 123: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

OBDD: example

a

T F

F

{a}

{-a,b}

b

T

T F

(a) (a)

(b) (b)

OBDD

OBDD of .ICT Graduate School, Trento, May-June 2002 123

Page 124: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

OBDD reduction: example

T(b)F(b)

a

T F

F

{a}b

T (a) (a)a

T F

F

{a}

T (a) (a)a

T F

F

{a}

{-a,b}

b

T

T F

(a) (a)

(b) (b)

Reduced OBDD of ,, .

ICT Graduate School, Trento, May-June 2002 124

Page 125: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

OBDD: summary

strongly non-redundanttime-efficientfactor sub-graphsrequire exponential memorynon lazy[allow for early pruning][do not allow for backjumping or learning]

ICT Graduate School, Trento, May-June 2002 125

Page 126: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Generalized semantic tableaux

General rules = propositional rules + -specific rules

-specificRules

Widely used by logicians

ICT Graduate School, Trento, May-June 2002 126

Page 127: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Generalized tableau algorithm

-Tableau/* branch closed */

False;/* -elimination */

-Tableau ;/* -elimination */

-Tableau ;/* -elimination */

-Tableau-Tableau ;

...( ( )= satisfiable); /* branch expanded */

ICT Graduate School, Trento, May-June 2002 127

Page 128: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

General tableaux: example

Tableau Search Graph

a -g a -g a -g

a g

{a} {a,b}{a,-g} {a,b} {b} {b,-g} {a,g} {b,g}

b

b bb

Tableau search graph for .

ICT Graduate School, Trento, May-June 2002 128

Page 129: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Generalized tableaux: problems

Two main problems [15, 29, 30]

syntactic branchingbranch on disjunctionspossible many duplicate or subsumed branches

redundantduplicates search (both propositional anddomain-dependent)

no constraint violation detectionincapable to detect when current branches violate aconstraint

lots of redundant propositional search.ICT Graduate School, Trento, May-June 2002 129

Page 130: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Syntactic branching: example

T T

a

a a

-a -a -a

b b

-b

-b -b -b

G

Tableau search graph for .

ICT Graduate School, Trento, May-June 2002 130

Page 131: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Detecting constraints violations: example

-a -b -a -b -a -b

a

f

f

T

T1

1

2

2b

. . . . .

T3

G

Tableau search graph for

ICT Graduate School, Trento, May-June 2002 131

Page 132: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Generalized tableaux: summary

lazyrequire polynomial memoryredundanttime-inefficient[allow backjumping][do not allow learning]

ICT Graduate School, Trento, May-June 2002 132

Page 133: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Remark.The word “Tableau” is a bit overloaded in literature. Someexisting (and rather efficient) systems, like FacT and DLP[34], call themselves “Tableau” procedures, although theyuse a DPLL-like technique to perform boolean reasoning.Same discourse holds for the boolean system KE [15]and its derived systems.

ICT Graduate School, Trento, May-June 2002 133

Page 134: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Generalized DPLL

General rules = propositional rules + -specific rules

-specificRules

No Pure Literal Rule: Pure literal causes incompleteassignment sets!

ICT Graduate School, Trento, May-June 2002 134

Page 135: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Pure literal and Generalized DPLL: Example

A satisfiable assignment propositionally satisfying is:

No satisfiable assignment propositionally satisfyingcontainsPure literal may assign as first step

return unsatisfiable.ICT Graduate School, Trento, May-June 2002 135

Page 136: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Generalized DPLL algorithm

-DPLL( )/* base */

( ( )=satisfiable);/* backtrack */

False;a unit clause occurs in /* unit */

-DPLL( );l := choose-literal( ); /* split */

-DPLL( )-DPLL( );

ICT Graduate School, Trento, May-June 2002 136

Page 137: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

General DPLL: example

a -a

b -b{a}

{-a,b} g

DPLL search graph

DPLL search graph for .

ICT Graduate School, Trento, May-June 2002 137

Page 138: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Generalized DPLL vs. generalized tableaux

Two big advantages: [15, 29, 30]

semantic vs. syntactic branchingbranch on truth valuesno duplicate or subsumed branches

strongly non redundantno search duplicates

constraint violation detectionbacktracks as soon as the current branch violates aconstraint

no redundant propositional search.

ICT Graduate School, Trento, May-June 2002 138

Page 139: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Semantic branching: example

T

a -a

-b -b

Tableau search graph for .

ICT Graduate School, Trento, May-June 2002 139

Page 140: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Detecting constraints violations: example

T1

a -a

-b

T23

DPLL search graph for

ICT Graduate School, Trento, May-June 2002 140

Page 141: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Generalized DPLL: summary

lazyrequire polynomial memorystrongly non redundanttime-efficient[allow backjumping and learning]

ICT Graduate School, Trento, May-June 2002 141

Page 142: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Optimizations

ICT Graduate School, Trento, May-June 2002 142

Page 143: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Possible Improvements

Preprocessing atoms [28, 34, 5]Static learning [2]Early pruning [28, 12, 4]Enhanced Early pruning [4]Backjumping [34, 54]Memoizing [34, 24]Learning [34, 54]Triggering [54, 4]

ICT Graduate School, Trento, May-June 2002 143

Page 144: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Preprocessing atoms [28, 34, 5]

Source of inefficiency: semantically equivalent butsyntactically different atoms are not recognized to beidentical [resp. one the negation of the other] theymay be assigned different [resp. identical] truth values.

Solution: rewrite trivially equivalent atoms into one.

ICT Graduate School, Trento, May-June 2002 144

Page 145: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Preprocessing atoms (cont.)

Sorting: , ,);

Rewriting dual operators:, ,

Exploiting associativity:,

;Factoring , ,

;Exploiting properties of :

, if ;...

ICT Graduate School, Trento, May-June 2002 145

Page 146: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Preprocessing atoms: summary

Very efficient with DPLLPresumably very efficient with OBDDsScarcely efficient with semantic tableaux

ICT Graduate School, Trento, May-June 2002 146

Page 147: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Static learning [2]

Rationale: Many literals are mutually exclusive(e.g., )Preprocessing step: detect these literals and addbinary clauses to the input formula:(e.g., )(with DPLL) assignments including both literals arenever generated.requires steps.

ICT Graduate School, Trento, May-June 2002 147

Page 148: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Static learning (cont.)

Very efficient with DPLLPossibly very efficient with OBDDs (?)Completely ineffective with semantic tableaux

ICT Graduate School, Trento, May-June 2002 148

Page 149: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Early pruning [28, 12, 4]

rationale: if an assignment is unsatisfiable, then allits extensions are unsatisfiable.the unsatisfiability of detected during itsconstruction,

avoids checking the satisfiability of all the up toassignments extending .

Introduce a satisfiability test on incompleteassignments just before every branching step:

Likely-Unsatisfiable( ) /* early pruning */( ( ) )

False;

ICT Graduate School, Trento, May-June 2002 149

Page 150: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

DPLL+Early pruning

-DPLL( )/* base */

( ( )=satisfiable);/* backtrack */

False;a unit clause occurs in /* unit */

-DPLL( );Likely-Unsatisfiable( ) /* early pruning */

( ( ) )False;

l := choose-literal( ); /* split */-DPLL( )-DPLL( );

ICT Graduate School, Trento, May-June 2002 150

Page 151: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Early pruning: example

Suppose it is built the intermediate assignment:

If is invoked on , it returns , andbacktracks without exploring any extension

of .ICT Graduate School, Trento, May-June 2002 151

Page 152: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Early pruning: drawback

Reduces drastically the searchDrawback: possibly lots of useless calls to

to be used with care when callsrecursively (e.g., with modal logics)Roughly speaking, worth doing when each branchsaves at leastPossible solutions:

introduce a selective heuristic Likely-unsatisfiableuse incremental versions of

one split.

ICT Graduate School, Trento, May-June 2002 152

Page 153: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Early pruning: Likely-unsatisfiable

Rationale: if no literal which may likely cause conflictwith the previous assignment has been added sincelast call, return false.Examples: return false if they are added only

boolean literalsdisequalitiesatoms introducing new variables...

ICT Graduate School, Trento, May-June 2002 153

Page 154: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Early pruning: incrementality of

With early pruning, lots of incremental calls to:

( ) satisfiable( ) satisfiable( ) satisfiable

...incremental: ( ) reuses

computation of ( ) without restarting fromscratch lots of computation savedrequires saving the status of

ICT Graduate School, Trento, May-June 2002 154

Page 155: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Early pruning: summary

Very efficient with DPLL & OBDDsPossibly very efficient with semantic tableaux (?)In some cases may introduce big overhead(e.g., modal logics)Benefits if is incremental

ICT Graduate School, Trento, May-June 2002 155

Page 156: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Enhanced Early Pruning [4]

In early pruning, is not effective if it returns“satisfiable”.

( ) may be able to derive deterministically asub-assignment s.t. , and return it.The literals in are then unit-propagated away.

ICT Graduate School, Trento, May-June 2002 156

Page 157: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Enhanced Early Pruning: Examples

(We assume that all the following literals occur in .)

If and , thencan derive from .

If and ,then can derive from .

ICT Graduate School, Trento, May-June 2002 157

Page 158: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Enhanced Early Pruning: summary

Further improves efficiency with DPLLPresumably scarcely effective with semantic tableauxEffective with OBDDs?Requires a sophisticated

ICT Graduate School, Trento, May-June 2002 158

Page 159: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Backjumping (driven by ) [34, 54]

Similar to SAT backjumpingRationale: same as for early pruningIdea: when a branch is found unsatisfiable in ,1. returns the conflict set causing the failure2. backtracks to the most recent branching

point in the conflict set

ICT Graduate School, Trento, May-June 2002 159

Page 160: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Backjumping: Example

( ) returns false with the conflict set:

can jump back directly to the branching point, without branching on .

ICT Graduate School, Trento, May-June 2002 160

Page 161: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Backjumping vs. Early Pruning

Backjumping requires no extra calls toEffectiveness depends on the conflict set , i.e., onhow recent the most recent branching point in is.Example: no pruning effect with the conflict set:

Same pruning effect as with Early Pruning only withthe best conflict setMore effective than Early Pruning only when theoverhead compensates the pruning effect (e.g., modallogics with high depths).

ICT Graduate School, Trento, May-June 2002 161

Page 162: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Backjumping: summary

Very efficient with DPLLNever applied to OBDDsVery efficient with semantic tableauxAlternative to but less effective than early pruning.No significant overhead

must be able to detect conflict sets.

ICT Graduate School, Trento, May-June 2002 162

Page 163: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Memoizing [34, 24]

Idea 1:When a conflict set is revealed, then can becached into an ad hoc data structure

( ) checks first if (any subset of) iscached. If yes, returns unsatisfiable.

Idea 2:When a satisfying (sub)-assignment is found,then can be cached into an ad hoc data structure

( ) checks first if (any superset of) iscached. If yes, returns satisfiable.

ICT Graduate School, Trento, May-June 2002 163

Page 164: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Memoizing (cont.)

Can dramatically prune search.May cause a blowup in memory.Applicable also to semantic tableaux.Idea 1 subsumed by learning.

ICT Graduate School, Trento, May-June 2002 164

Page 165: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Learning (driven by ) [34, 54]

Similar to SAT learningIdea: When a conflict set is revealed, then canbe added to the clause set

DPLL will never again generate an assignmentcontaining .May avoid a lot of redundant search.Problem: may cause a blowup in space

techniques to control learning and to drop learnedclauses when necessary

ICT Graduate School, Trento, May-June 2002 165

Page 166: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Learning: example

returns the conflict set:

it is added the clause

Prunes up to assignmentsthe smaller the conflict set, the better.

ICT Graduate School, Trento, May-June 2002 166

Page 167: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Learning: summary

Very efficient with DPLLNever applied to OBDDsCompletely ineffective with semantic tableauxMay cause memory blowup

must be able to detect conflict sets.

ICT Graduate School, Trento, May-June 2002 167

Page 168: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Triggering [54, 4]

Proposition Let be a non-boolean atom occurring onlypositively [resp. negatively] in . Let be a completeset of assignments for , and let

Then is satisfiable if and only if there exist a satisfiables.t. .

ICT Graduate School, Trento, May-June 2002 168

Page 169: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Triggering (cont.)

If we have non-boolean atoms occurring only positively[negatively] in , we can drop any negative [positive]occurrence of them from the assignment to bechecked byParticularly useful when we deal with equality atoms(e.g., ), as handling negative equalitieslike forces splitting:

.

ICT Graduate School, Trento, May-June 2002 169

Page 170: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Application Fields

Modal LogicsDescription LogicsTemporal LogicsBoolean+Mathematical reasoning (Temporalreasoning, Resource Planning, Verification of TimedSystems, Verification of systems with arithmeticaloperators, verification of hybrid systems)QBF...

ICT Graduate School, Trento, May-June 2002 170

Page 171: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

CASE STUDY:MODAL LOGIC(S)

ICT Graduate School, Trento, May-June 2002 171

Page 172: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Satisfiability in Modal logics

Propositional logics enhanced with modal operators, , etc.

Used to represent complex concepts like knowledge,necessity/possibility, etc.Based on Kripke’s possible worlds semantics [39]Very hard to decide [32, 31](typically PSPACE-complete or worse)Strictly related to Description Logics [44](ex: )Various fields of application: AI, formal verification,knowledge bases, etc.

ICT Graduate School, Trento, May-June 2002 172

Page 173: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Syntax

Given a non-empty set of primitive propositionsand a set of modal operators, the modal language is the least set

of formulas containing , closed under the set ofpropositional connectives and the set ofmodal operators in .

depth( ) is the maximum number of nested modaloperators in .“ ” can be interpreted as “Agent knows ”

ICT Graduate School, Trento, May-June 2002 173

Page 174: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Semantics

A Kripke structure for is a tuple, where

is a set of statesis a function ,

each is a binary relation on the states of .

ICT Graduate School, Trento, May-June 2002 174

Page 175: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Semantics (cont)

Given s.t. , is defined as follows:

for everys.t. holds in .

for somes.t. holds in .

ICT Graduate School, Trento, May-June 2002 175

Page 176: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Semantics (cont)

The (normal) modal logics vary with the properties of :

Axiom Property of DescriptionB symmetricD serialT reflexive4 transitive5 euclidean

ICT Graduate School, Trento, May-June 2002 176

Page 177: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Normal Modal Logic Properties ofK —KB symmetricKD serialKT = KDT (T) reflexiveK4 transitiveK5 euclideanKBD symmetric and serialKBT = KBDT (B) symmetric and reflexiveKB4 = KB5 = KB45 symmetric and transitiveKD4 serial and transitiveKD5 serial and euclideanKT4 = KDT4 (S4) reflexive and transitiveKT5 = KBD4 = KBD5 = KBT4 = KBT5 = KDT5 =KT45 = KBD45 = KBT45 = KDT45 = KBDT4 =KBDT5 = KBDT45 (S5)

reflexive, transitive and symmetric(equivalence)

K45 transitive and euclideanKD45 serial, transitive and euclidean

ICT Graduate School, Trento, May-June 2002 177

Page 178: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Axiomatic framework

Basic Axioms:

Specific Axioms:

ICT Graduate School, Trento, May-June 2002 178

Page 179: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Axiomatic framework (cont.)

Inference rules:

modus ponens

necessitation

Correctness & completeness:is valid can be deduced

ICT Graduate School, Trento, May-June 2002 179

Page 180: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Tableaux for modal K(m)/ [20]

Rules = tableau rules + -specific rules

ICT Graduate School, Trento, May-June 2002 180

Page 181: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

DPLL for K(m)/ : K-SAT [28, 29]

Rules = DPLL rules + -specific rules

ICT Graduate School, Trento, May-June 2002 181

Page 182: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

The K-SAT algorithm [28, 29]

( )( );

( )/* base */

( );/* backtrack */

False;a unit clause occurs in /* unit */

( );Likely-Unsatisfiable( ) /* early pruning */

( )False;

l := choose-literal( ); /* split */( )( );

ICT Graduate School, Trento, May-June 2002 182

Page 183: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

The K-SAT algorithm (cont.)

( )box index

(False;

True;

(conjunct “ ”

( )False;

True;

ICT Graduate School, Trento, May-June 2002 183

Page 184: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

: Example

ICT Graduate School, Trento, May-June 2002 184

Page 185: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

: Example (cont.)

ICT Graduate School, Trento, May-June 2002 185

Page 186: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

: Example (cont.)

ICT Graduate School, Trento, May-June 2002 186

Page 187: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Example

Resulting Kripke Model:

11

11

( A v A v A ) 5 4 3( A v A v A ) 2 1 4

( A v A v A ) 3 1 2( A v A v A ) 4 2 3

2

A 2

2

1

1 1

3 1 2 A , A , A 4 2 A , A , A , A , A 5 13

4 5( A v A v A )

ICT Graduate School, Trento, May-June 2002 187

Page 188: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Search in modal logic:

Two alternating orthogonal components of search:Modal search: model spanning

jumping among statesconjunctive branchingup to linearly many successors

Propositional search: local searchreasoning within the single statesdisjunctive branchingup to exponentially many successors

ICT Graduate School, Trento, May-June 2002 188

Page 189: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

ff41

42

mm

m

411412

413

f

mm

m

m

m

12

3

4

5

SearchDepth

ModalViewPropositionalView

ICT Graduate School, Trento, May-June 2002 189

Page 190: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Some Systems

Kris [6], CRACK [10],Logics: & many description logicsBoolean reasoning technique: semantic tableauOptimizations: preprocessing

K-SAT [28, 23]Logics: K(m),Boolean reasoning technique: DPLLOptimizations: preprocessing, early pruning

ICT Graduate School, Trento, May-June 2002 190

Page 191: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Some Systems (cont.)

FaCT & DLP [34]Logics: & many description logicsBoolean reasoning technique: DPLL-likeOptimizations: preprocessing, memoizing,backjumping + optimizations for description logics

ESAT &*SAT [24]Logics: non-normal modal logics, K(m),Boolean reasoning technique: DPLLOptimizations: preprocessing, early pruning,memoizing, backjumping, learning

ICT Graduate School, Trento, May-June 2002 191

Page 192: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Some empirical results [23]

0 20 40 60 80 100 12010−2

10−1

100

101

102

103MEDIAN CPU TIME [SECS] (N=4, d=1, 100 samples/point)

# OF CLAUSES (L)

Kris (Tableau based)TA (Transl. based)KsatLisp (Sat based)KsatC (Sat based)% satisfiable

0 20 40 60 80 100 1200

1000

2000

3000

4000

5000

6000DPLL CALLS − PS1 (N=4, d=1, %p=0)

# OF CLAUSES (L)#

CALL

S

KsatLispKsatC% satisf

Left: KRIS, TA, K-SAT (LISP), K-SAT (C) median CPUtime, 100 samples/point.Right: K-SAT (LISP), K-SAT (C) median number ofconsistency checks, 100 samples/point.Background: satisfiability percentage.

ICT Graduate School, Trento, May-June 2002 192

Page 193: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Some empirical results (cont.)

020

4060

80100

120

5060

7080

90100

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

# OF CLAUSES (L)

KsatC CPU TIME − PS2 (N=4, d=1, %p=0)

percentiles

CPU

TIM

E [S

EC]

050

100150

200

5060

7080

90100

0

5

10

15

20

25

30

35

# OF CLAUSES (L)

KsatC CPU TIME − PS3 (N=5, d=1, %p=0)

percentiles

CPU

TIM

E [S

EC]

0100

200300

400

5060

7080

90100

0

200

400

600

800

1000

# OF CLAUSES (L)

KsatC CPU TIME − PS4 (N=6, d=1, %p=0)

percentiles

CPU

TIM

E [S

EC]

020

4060

80100

120

5060

7080

90100

0

100

200

300

400

500

600

700

# OF CLAUSES (L)

TA CPU TIME − PS2 (N=4, d=1, %p=0)

percentiles

CPU

TIM

E [S

EC]

050

100150

200

5060

7080

90100

0

200

400

600

800

1000

# OF CLAUSES (L)

TA CPU TIME − PS3 (N=5, d=1, %p=0)

percentiles

CPU

TIM

E [S

EC]

0100

200300

400

5060

7080

90100

0

200

400

600

800

1000

# OF CLAUSES (L)

TA CPU TIME − PS4 (N=6, d=1, %p=0)

percentilesCP

U TI

ME

[SEC

]

K-SAT (up) versus TA (down) CPU times.

ICT Graduate School, Trento, May-June 2002 193

Page 194: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Some empirical results [35]

Formulas of Tableau’98 competition [33]branch d4 dum grz lin path ph poly t4p

K p n p n p n p n p n p n p n p n p nleanK 2.0 1 0 1 1 0 0 0 21 21 4 2 0 3 1 2 0 0 0

KE 13 3 13 3 4 4 3 1 21 2 17 5 4 3 17 0 0 3LWB 1.0 6 7 8 6 13 19 7 13 11 8 12 10 4 8 8 11 8 7TA 9 9 21 18 21 21 21 21 21 21 20 20 6 9 16 17 21 19*SAT 1.2 21 12 21 21 21 21 21 21 21 21 21 21 8 12 21 21 21 21Crack 1.0 2 1 2 3 3 21 1 21 5 2 2 6 2 3 21 21 1 1Kris 3 3 8 6 15 21 13 21 6 9 3 11 4 5 11 21 7 5Fact 1.2 6 4 21 8 21 21 21 21 21 21 7 6 6 7 21 21 21 21DLP 3.1 19 13 21 21 21 21 21 21 21 21 21 21 7 9 21 21 21 21

ICT Graduate School, Trento, May-June 2002 194

Page 195: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

45 branch dum grz md path ph poly t4pKT p n p n p n p n p n p n p n p n p n

TA 17 6 13 9 17 9 21 21 16 20 21 16 5 12 21 1 11 0Kris 4 3 3 3 3 14 0 5 3 4 1 13 3 3 2 2 1 7FaCT 1.2 21 21 6 4 11 21 21 21 4 5 5 3 6 7 21 7 4 2DLP 3.1 21 21 19 12 21 21 21 21 3 21 16 14 7 21 21 12 21 21

45 branch dum grz md path ph poly t4pS4 p n p n p n p n p n p n p n p n p n

KT4 1 6 2 3 0 17 5 8 21 18 1 2 2 2 2 2 0 3leanS4 2.0 0 0 0 0 0 0 1 1 2 2 1 0 1 0 1 1 0 0

KE 8 0 21 21 0 21 6 4 3 3 9 6 4 3 1 21 3 1LWB 1.0 3 5 11 7 9 21 8 7 8 6 8 6 4 8 4 9 9 12TA 9 0 21 4 14 0 6 21 9 10 15 21 5 5 21 1 11 0FaCT 1.2 21 21 4 4 2 21 5 4 8 4 2 1 5 4 21 2 5 3DLP 3.1 21 21 18 12 21 21 10 21 3 21 15 15 7 21 21 21 21 21

ICT Graduate School, Trento, May-June 2002 195

Page 196: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

SAT techniques for modal logics: summary

SAT techniques have been successfully applied tomodal/description logicsMany optimizations applicable.Currently at the State-of-the-art.

ICT Graduate School, Trento, May-June 2002 196

Page 197: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

CASE STUDY:(LINEAR) MATHEMATICALREASONING

ICT Graduate School, Trento, May-June 2002 197

Page 198: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

MATH-SAT

Boolean combinations of mathematical propositions onthe reals or integers.Typically NP-completeVarious fields of application: temporal reasoning,scheduling, formal verification, resource planning, etc.

ICT Graduate School, Trento, May-June 2002 198

Page 199: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Syntax

Let be the domain of either reals or integers withits set of arithmetical operators.Given a non-empty set of primitive propositions

and a set of (linear) mathematicalexpressions over , the mathematical language is theleast set of formulas containing and closed underthe set of propositional connectives .

ICT Graduate School, Trento, May-June 2002 199

Page 200: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Syntax: math-terms and math-formulas

a constant is a math-term;a variable over is a math-term;

is a math-term, and being a constantand a variable over ;if and are math-terms, then and aremath-terms, .a boolean proposition over is amath-formula;if , are math-terms, then is amath-formula, ;if , are math-formulas, then , ,

, and , are math-formulas.ICT Graduate School, Trento, May-June 2002 200

Page 201: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Interpretations

Interpretation: a map assigning real [integer] andboolean values to math-terms and math-formulasrespectively and preserving constants and operators:

, for every ;, for every constant ;, for every variable over ;

, for all math-terms , and;

, for all math-terms , and;

, for every math-formula ;, for all math-formulas , .

ICT Graduate School, Trento, May-June 2002 201

Page 202: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

DPLL for math-formulas [54, 2, 4, 5]

( )( );

( )/* base */

( );/* backtrack */

False;a unit clause occurs in /* unit */

( );Likely-Unsatisfiable( ) /* early pruning */

( )False;

l := choose-literal( ); /* split */( )( );

ICT Graduate School, Trento, May-June 2002 202

Page 203: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

: different algorithms for different kinds ofmath-atoms:

Difference expressions : Belman-Fordminimal path algorithm with negative cycle detectionEqualities : equivalent class building andrewriting.General linear expressions ( ): linearprogramming techniques (Symplex, etc.)Disequalities : postpone at the end. Expand( ) only if indispensable!

ICT Graduate School, Trento, May-June 2002 203

Page 204: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Some SystemsTsat [2]

Logics: disjunctions of difference expressions(positive math-atoms only)Applications: temporal reasoningBoolean reasoning technique: DPLLOptimizations: preprocessing, static learning,forward checking

LPsat [54]Logics: MATH-SAT (positive math-atoms only)Applications: resource planningBoolean reasoning technique: DPLLOptimizations: preprocessing, backjumping,learning, triggering

ICT Graduate School, Trento, May-June 2002 204

Page 205: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

Some systems (cont.)

DDD [41]Logics: boolean + difference expressionsApplications: formal verification of timed systemsBoolean reasoning technique: OBDDOptimizations: preprocessing, early pruning

[4]Logics: MATH-SATApplications: resource planning, formal verificationof timed systemsBoolean reasoning technique: DPLLOptimizations: preprocessing, enhanced earlypruning, backjumping, learning, triggering

ICT Graduate School, Trento, May-June 2002 205

Page 206: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

SAT techniques for modal logics: summary

SAT techniques have been successfully applied toMATH-SATMany optimizations applicable.Currently competitive with state-of-the-art applicationsfor temporal reasoning, resource planning, formalverification of timed systems.

ICT Graduate School, Trento, May-June 2002 206

Page 207: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

[1] P. A. Abdullah, P. Bjesse, and N. Een. Symbolic Reachability Analysis based onSAT-Solvers. In Sixth Int.nl Conf. on Tools and Algorithms for the Constructionand Analysis of Systems (TACAS’00), 2000.

[2] A. Armando, C. Castellini, and E. Giunchiglia. SAT-based procedures fortemporal reasoning. In Proc. European Conference on Planning, CP-99, 1999.

[3] A. Armando and E. Giunchiglia. Embedding Complex Decision Proceduresinside an Interactive Theorem Prover. Annals of Mathematics and ArtificialIntelligence, 8(3–4):475–502, 1993.

[4] G. Audemard, P. Bertoli, A. Cimatti, A. Korniłowicz, and R. Sebastiani. A SATBased Approach for Solving Formulas over Boolean and Linear MathematicalPropositions. In Proc. CADE’2002., LNAI. Springer Verlag, February 2002. Toappear.

[5] G. Audemard, P. Bertoli, A. Cimatti, A. Korniłowicz, and R. Sebastiani.Integrating Boolean and Mathematical Solving: Foundations, Basic Algorithmsand Requirements. In Proc. CALCULEMUS’2002., LNAI. Springer Verlag, 2002.To appear.

[6] F. Baader, E. Franconi, B. Hollunder, B. Nebel, and H.J. Profitlich. An EmpiricalAnalysis of Optimization Techniques for Terminological Representation Systems

ICT Graduate School, Trento, May-June 2002 207

Page 208: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

or: Making KRIS get a move on. Applied Artificial Intelligence. Special Issue onKnowledge Base Management, 4:109–132, 1994.

[7] R. J. Bayardo, Jr. and R. C. Schrag. Using CSP Look-Back Techniques to SolveReal-World SAT instances. In American Association for Artificial Intelligence,pages 203–208. AAAI Press, 1997.

[8] A. Biere, A. Cimatti, E. M. Clarke, and Yunshan Zhu. Symbolic Model Checkingwithout BDDs. In Proc. TACAS’99, pages 193–207, 1999.

[9] R. Brafman. A simplifier for propositional formulas with many binary clauses. InProc. IJCAI01, 2001.

[10] P. Bresciani, E. Franconi, and S. Tessaris. Implementing and testing expressiveDescription Logics: a preliminary report. In Proc. International Workshop onDescription Logics, Rome, Italy, 1995.

[11] R. E. Bryant. Graph-Based Algorithms for Boolean Function Manipulation. IEEETransactions on Computers, C-35(8):677–691, August 1986.

[12] W. Chan, R. J. Anderson, P. Beame, and D. Notkin. Combining constraint solvingand symbolic model checking for a class of systems with non-linear constraints.In Proc. CAV’97, volume 1254 of LNCS, pages 316–327, Haifa, Israel, June1997. Springer-Verlag.

[13] A. Cimatti, M. Pistore, M. Roveri, and R. Sebastiani. Improving the Encoding ofLTL Model Checking into SAT. In Proc. VMCAI’02, volume 2294 of LNCS.Springer Verlag, january 2002.ICT Graduate School, Trento, May-June 2002 208

Page 209: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

[14] S. A. Cook. The complexity of theorem proving procedures. In 3rd Annual ACMSymposium on the Theory of Computation, pages 151–158, 1971.

[15] M. D’Agostino and M. Mondadori. The Taming of the Cut. Journal of Logic andComputation, 4(3):285–319, 1994.

[16] M. Davis, G. Longemann, and D. Loveland. A machine program for theoremproving. Journal of the ACM, 5(7), 1962.

[17] M. Davis and H. Putnam. A computing procedure for quantification theory.Journal of the ACM, 7:201–215, 1960.

[18] T. Boy de la Tour. Minimizing the Number of Clauses by Renaming. In Proc. ofthe 10th Conference on Automated Deduction, pages 558–572. Springer-Verlag,1990.

[19] M. Ernst, T. Millstein, and D. Weld. Automatic SAT-compilation of planningproblems. In Proc. IJCAI-97, 1997.

[20] M. Fitting. First-Order Modal Tableaux. Journal of Automated Reasoning,4:191–213, 1988.

[21] M. R. Garey and D. S. Johnson. Computers and Intractability. Freeman andCompany, New York, 1979.

[22] I. P. Gent, E. MacIntyre, P. Prosser, and T. Walsh. The constrainedness ofsearch. In Proceedings of AAAI-96, pages 246–252, Menlo Park, 1996. AAAIPress / MIT Press.

ICT Graduate School, Trento, May-June 2002 209

Page 210: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

[23] E. Giunchiglia, F. Giunchiglia, R. Sebastiani, and A. Tacchella. SAT vs.Translation based decision procedures for modal logics: a comparativeevaluation. Journal of Applied Non-Classical Logics, 10(2):145–172, 2000.

[24] E. Giunchiglia, F. Giunchiglia, and A. Tacchella. SAT Based Decision Proceduresfor Classical Modal Logics. Journal of Automated Reasoning. Special Issue:Satisfiability at the start of the year 2000, 2001.

[25] E. Giunchiglia, A. Massarotto, and R. Sebastiani. Act, and the Rest Will Follow:Exploiting Determinism in Planning as Satisfiability. In Proc. AAAI’98, pages948–953, 1998.

[26] E. Giunchiglia, M. Narizzano, A. Tacchella, and M. Vardi. Towards an EfficientLibrary for SAT: a Manifesto. In Proc. SAT 2001, Electronics Notes in DiscreteMathematics. Elsevier Science., 2001.

[27] E. Giunchiglia and R. Sebastiani. Applying the Davis-Putnam procedure tonon-clausal formulas. In Proc. AI*IA’99, number 1792 in LNAI. Springer Verlag,1999.

[28] F. Giunchiglia and R. Sebastiani. Building decision procedures for modal logicsfrom propositional decision procedures - the case study of modal K. In Proc.CADE’13, LNAI, New Brunswick, NJ, USA, August 1996. Springer Verlag.

[29] F. Giunchiglia and R. Sebastiani. A SAT-based decision procedure for ALC. InProc. of the 5th International Conference on Principles of KnowledgeRepresentation and Reasoning - KR’96, Cambridge, MA, USA, November 1996.

ICT Graduate School, Trento, May-June 2002 210

Page 211: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

[30] F. Giunchiglia and R. Sebastiani. Building decision procedures for modal logicsfrom propositional decision procedures - the case study of modal K(m).Information and Computation, 162(1/2), October/November 2000.

[31] J. Y. Halpern. The effect of bounding the number of primitive propositions and thedepth of nesting on the complexity of modal logic. Artificial Intelligence,75(3):361–372, 1995.

[32] J.Y. Halpern and Y. Moses. A guide to the completeness and complexity formodal logics of knowledge and belief. Artificial Intelligence, 54(3):319–379, 1992.

[33] A. Heuerding and S. Schwendimann. A benchmark method for the propositionalmodal logics K, KT, S4. Technical Report IAM-96-015, University of Bern,Switzerland, 1996.

[34] I. Horrocks and P. F. Patel-Schneider. FaCT and DLP. In Proc. Tableaux’98,pages 27–30, 1998.

[35] I. Horrocks, P. F. Patel-Schneider, and R. Sebastiani. An Analysis of EmpiricalTesting for Modal Decision Procedures. Logic Journal of the IGPL,8(3):293–323, May 2000.

[36] H. Kautz, D. McAllester, and B. Selman. Encoding Plans in Propositional Logic.In Proceedings International Conference on Knowledge Representation andReasoning. AAAI Press, 1996.

[37] H. Kautz and B. Selman. Planning as Satisfiability. In Proc. ECAI-92, pages359–363, 1992.ICT Graduate School, Trento, May-June 2002 211

Page 212: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

[38] S. Kirkpatrick and B. Selman. Critical behaviour in the satisfiability of randomboolean expressions. Science, 264:1297–1301, 1994.

[39] S. A. Kripke. Semantical considerations on modal logic. In Proc. A colloquium onModal and Many-Valued Logics, Helsinki, 1962.

[40] D. Mitchell, B. Selman, and H. Levesque. Hard and Easy Distributions of SATProblems. In Proc. of the 10th National Conference on Artificial Intelligence,pages 459–465, 1992.

[41] J. Moeller, J. Lichtenberg, H. R. Andersen, and H. Hulgaard. Fully symbolicmodel checking of timed systems using difference decision diagrams. In Proc.Workshop on Symbolic Model Checking (SMC), Federated Logic Conference(FLoC), Trento, Italy, July 1999.

[42] M. W. Moskewicz, C. F. Madigan, Y. Z., L. Zhang, and S. Malik. Chaff:Engineering an efficient SAT solver. In Design Automation Conference, 2001.

[43] D.A. Plaisted and S. Greenbaum. A Structure-preserving Clause FormTranslation. Journal of Symbolic Computation, 2:293–304, 1986.

[44] K. D. Schild. A correspondence theory for terminological logics: preliminaryreport. In Proc. of the 12th International Joint Conference on ArtificialIntelligence, pages 466–471, Sydney, Australia, 1991.

[45] R. Sebastiani. Applying GSAT to Non-Clausal Formulas. Journal of ArtificialIntelligence Research, 1:309–314, 1994. Also DIST-Technical Report 94-0018,DIST, University of Genova, Italy.ICT Graduate School, Trento, May-June 2002 212

Page 213: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

[46] R. Sebastiani and A. Villafiorita. SAT-based decision procedures for normalmodal logics: a theoretical framework. In Proc. 6th International Conference onArtificial Intelligence: Methodology, Systems, Applications - AIMSA’98, number1480 in LNAI, Sozopol, Bulgaria, September 1998. Springer Verlag.

[47] B. Selman and H. Kautz. Domain-Independent Extension to GSAT: SolvingLarge Structured Satisfiability Problems. In Proc. of the 13th International JointConference on Artificial Intelligence, pages 290–295, 1993.

[48] B. Selman, H. Levesque., and D. Mitchell. A New Method for Solving HardSatisfiability Problems. In Proc. of the 10th National Conference on ArtificialIntelligence, pages 440–446, 1992.

[49] Ofer Shtrichmann. Tuning SAT checkers for bounded model checking. In Proc.CAV00, volume 1855 of LNCS, pages 480–494, Berlin, 2000. Springer.

[50] J. P. M. Silva and K. A. Sakallah. GRASP - a new search algorithm forsatisfiability. Technical report, University of Michigan, 1996.

[51] R. M. Smullyan. First-Order Logic. Springer-Verlag, NY, 1968.

[52] C. P. Williams and T. Hogg. Exploiting the deep structure of constraint problems.Artificial Intelligence, 70:73–117, 1994.

[53] P. F. Williams, A. Biere, E. M. Clarke, and A. Gupta. Combining DecisionDiagrams and SAT Procedures for Efficient Symbolic Model Checking. In Proc.CAV2000, volume 1855 of LNCS, pages 124–138, Berlin, 2000. Springer.

ICT Graduate School, Trento, May-June 2002 213

Page 214: SA T : Pr opositional SatisÞability and Be y ond · SA T : Pr opositional SatisÞability and Be y ond Rober to Sebastiani Dept. of Inf or mation and Comm unication T echnologies

SAT: Propositional Satisfiability and Beyond c Roberto Sebastiani

[54] S. Wolfman and D. Weld. The LPSAT Engine & its Application to ResourcePlanning. In Proc. IJCAI, 1999.

[55] H. Zhang and M. Stickel. Implementing the Davis-Putnam algorithm by tries.Technical report, University of Iowa, August 1994.

The papers (co)authored by Roberto Sebastiani are availlable at:

.

ICT Graduate School, Trento, May-June 2002 214