1 boolean satisfiability (sat) class presentation by girish paladugu

37
1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Post on 22-Dec-2015

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

1

Boolean Satisfiability (SAT)

Class Presentation By

Girish Paladugu

Page 2: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

2

Overview

• Introduction• Conjunctive Normal Form (CNF)• DLL Procedure for solving SAT problems• Backtrack search algorithm• Eqvivalence Checking• Summary

Page 3: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

INTRODUCTION• SAT Given a Boolean formula (propositional logic formula), find a variable assignment such that the formula evaluates to 1, or prove that no such assignment exists.

• For a formula with n variables, there are 2n possible truth assignments to be checked.

a

b b

c c c c

0 1

0 0

00 001

1 1

1 1 1

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik3

( a +c ) ( b +c ) (¬a +¬b + ¬c )

Sharad Malik
get citation count for cook
Page 4: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

CNF

• Conjunctive Normal Form (CNF): A conjunctive normal form (CNF) formula ϕ on n binary variables x1, …, xn is the conjunction of m clauses ω1, …, ωm.

• Literal: Variable x or its complement x’.

• Clause: Disjunction of one or more literals.

• CNF formula is satisfiable if each clause is satisfiable ( or evaluate to true) else it is unsatisfiable.

4

( a +c ) ( b +c ) (¬a +¬b + ¬c )

Page 5: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

2- input AND Gate CNF

ab d

d= [d = ¬(a b)]= ¬[d ¬(a b)]

= ¬[¬(a b)¬d + a b d]

= ¬[¬a ¬d + ¬b ¬d + a b d]

= (a +d)(b +d)(¬a +¬b + ¬d)

a b d

0 0 1

0 1 1

1 0 1

1 1 0

Truth Table

This method can be applied to any number input gate.

5Boolean Satisfiability in Electronic Design Automation - joao marques silva, Karem A Sakellah

Page 6: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

CNF Formulas for simple gates

6

Page 7: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Circuit - CNF conversion

7

• The CNF formula for circuit is the set union of the CNF formulas of each gate.

Page 8: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

DLL Algorithm

• Davis, Logemann and Loveland

• Basic framework for many modern SAT solvers

• Complete Backtracking-based algorithm for solving the

CNF-SAT problem

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik8

Page 9: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik9

Page 10: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

a

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik10

Page 11: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

Decision

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

11

Page 12: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0 Decision

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

12

Page 13: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 Decision

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

13

Page 14: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0

d=1

c=0

(a + c + d)a=0

d=0(a + c + d’)

Conflict!Implication Graph

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

14

Page 15: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0

d=1

c=0

(a + c + d)a=0

d=0(a + c + d’)

Conflict!Implication Graph

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

15

Page 16: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0

Backtrack

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

16

Page 17: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0

d=1

c=1

(a + c’ + d)a=0

d=0(a + c’ + d’)

Conflict!

1 Forced Decision

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

17

Page 18: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 1

Backtrack

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

18

Page 19: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 1

1 Forced Decision

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

19

Page 20: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0

d=1

c=0

(a + c’ + d)a=0

d=0(a + c’ + d’)

Conflict!

1

c

0

1

Decision

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

20

Page 21: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 1

c

0

1

Backtrack

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik21

Page 22: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0

d=1

c=1

(a + c’ + d)a=0

d=0(a + c’ + d’)

Conflict!

1

c

0 1

1

Forced Decision

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

22

Page 23: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 1

c

0 1

1

Backtrack

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

23

Page 24: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 1

c

0 1

1

1 Forced Decision

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

24

Page 25: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 1

c

0 1

1

1

b

0 Decision

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik25

Page 26: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 1

c

0 1

1

1

b

0

c=1

b=0

(a’ + b + c)a=1

c=0(a’ + b + c’)

Conflict!

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik26

Page 27: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 1

c

0 1

1

1

b

0

Backtrack

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik27

Page 28: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a0

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 1

c

0 1

1

1

b

0 1

a=1

b=1

c=1(a’ + b’ + c)

Forced Decision

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik

28

Page 29: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 1

c

0 1

1

1

b

0 1

a=1

b=1

c=1(a’ + b’ + c) (b’ + c’ + d)

d=1

0

Adapted From ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik29

Page 30: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Basic DLL Procedure - DFS

a

(a + c + d)(a + c + d’)

(a + c’ + d)(a + c’ + d’)

(a’ + b + c)

(b’ + c’ + d)(a’ + b + c’)(a’ + b’ + c)

b

0

c

0 1

c

0 1

1

1

b

0 1

a=1

b=1

c=1(a’ + b’ + c) (b’ + c’ + d)

d=1

SAT

0

Adapted from ‘The Quest for Efficient Boolean Satisfiability Solvers’ – Sharad Malik30

Page 31: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Backtrack Search Algorithm

• Backtrack search has proven useful for solving instances of SAT from EDA applications, in particular for applications where the objective is to prove unsatisfiability.

• The algorithm conducts a search through the space of the possible assignments to the problem instance variables.

31

Page 32: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Backtrack Search SAT Algorithm

32

Page 33: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Backtrack Search Algorithm

• Decide( ) : Necessary assignments are identified.

• Deduce( ): Returns a conflict whenever a clause becomes unsatisfiable.

• Diagnose( ): Analyzes the conflict and returns a decision level to which the search process is required to backtrack to.

• Erase( ): Clears implied assignments that results from each assignment selection.

33

Page 34: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Handling Conflicts

• Assignments w=1, y3=0, x1=1, y1=0, y2=0

clearly results in a conflict.

• To prevent this conflict at least one of the assignments must be complemented.

• So the clause (¬x1 + ¬w + y3) is generated.

34

Page 35: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Equivalence Checking

If z = 1 is unsatisfiable, thetwo circuits are equivalent !

CB

CA

z = 1 ?

35

Page 36: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Summary

• So CNF representation of a problem is given as input to the SAT solvers• Core computation engine in many applications like verification and testing, logic synthesis, FPGA routing.• State of the art SAT solvers use DLL algorithm• The first established NP-Complete problem• If the number of variables increases its harder to solve SAT problems

36

Page 37: 1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu

Questions

References

[1]JP Marques-Silva, “Boolean Satisfiability in Electronic Design Automation,” 2000

[2] Lintao Zhang, Sharad Malik, “The Quest for Efficient Boolean Satisfiability Solvers”

37