0% found this document useful (0 votes)
131 views13 pages

SAT Solvers and Applications

The document discusses satisfiability (SAT) problems and how SAT solvers can be used to solve various problems. It explains that SAT is NP-complete, meaning any problem in NP can be reduced to SAT in polynomial time. Modern SAT solvers can efficiently solve problems with millions of variables and clauses. Examples are given of how vertex coloring, Boolean property checking, and Sudoku puzzles can be modeled as SAT problems and solved using a SAT solver.

Uploaded by

Raj Shekhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
131 views13 pages

SAT Solvers and Applications

The document discusses satisfiability (SAT) problems and how SAT solvers can be used to solve various problems. It explains that SAT is NP-complete, meaning any problem in NP can be reduced to SAT in polynomial time. Modern SAT solvers can efficiently solve problems with millions of variables and clauses. Examples are given of how vertex coloring, Boolean property checking, and Sudoku puzzles can be modeled as SAT problems and solved using a SAT solver.

Uploaded by

Raj Shekhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

SAT Solvers and Applications

Presented By:
Raj Shekhar
[email protected]
Satisfiability Problem/SAT
• Boolean Variables: Values ϵ {0, 1} or {TRUE, FALSE}
• Boolean operations: AND(^), OR(v), and NOT(~)
• Boolean formula: Expression with Boolean variables & operations.
For example: F = (~X ∧ Y) ∨ (X ∧ ~Z)
• Boolean formula Satisfiable: some assignment of 0/1s to the
variables makes the formula evaluate to 1.
• Satisfiability Problem: To test if a Boolean formula is satisfiable.
SAT ϵ NP
• Computers : Deterministic Turing Machine(TM)
• Can go to a single state from any state under any given condition
• Non-Deterministic Turing Machine(NTM)
• Can go to several states from a given state even under same conditions
• Also assume: They know which next state is optimal w.r.t Time Complexity
• NP = {Problems solvable by NTM in polynomial time}
• Equivalent Definition:
• Verifiable in Polynomial Time
• SAT ϵ NP
• Any claimed solution can be verified in Polynomial Time
SAT ϵ NP Complete
• Why?
• All problems in NP polynomial time reducible to SAT (Cook/Levin Theorem)
SAT Solvers : Current State
• Efficient SAT solver => Efficient solution to any NP problem
• No theoretically efficient solver known (P =? NP)
• But consistent development in SAT solvers since several years.
• 50+ competitive SAT solvers available
• Several competitions held for fastest SAT solvers.
• Many solvers do practically well. e.g. Minisat, Picosat, Lingeling*
• Problems as large as 1M variables, 5M clauses tractable
• Wise to leverage the developments to other Hard problem as well

* www.satisfiability.org
SAT Solver Interface
e.g. XOR(X,Y) = (~X V ~Y) ꓥ (X V Y)

c start with comments


c format #variables #clauses
p cnf 2 2
-1 -2 0
120
Vertex Coloring
• Graph G = (V, E)
• #Colors = K
• Color vertices using K colors s.t. no adjacent vertices have same color
• Variables: Xij, 1 ≤ i ≤ |V|, 1 ≤ j ≤ k
Xij = 1 if vertex #i is colored by color #j
• Clauses:
• Each vertex should have exactly one color
For each vertex v:
[(Vk Xvk ) ꓥ (ꓥk1≠k2 (~Xvk1 V ~Xvk2))]

• Each edge should have both vertices of different color


For each edge(u,v):
ꓥk(~Xuk V ~Xvk)
Boolean Property Checking
• Two Boolean Expressions X, Y
• A Property P to be checked
• Convert ~P(X,Y) to a CNF Boolean Expression E
• Use SAT Solver to find a satisfying assignment to E (counter-example)
• E not SAT => P(X,Y)
• Equivalence: X  Y
False if ~XNOR(X,Y) is SAT, else True
i.e. False if XOR(X,Y) is SAT, else True
• Implication: X => Y
False if ~(~X V Y) is SAT, else True
SUDOKU using SAT Solver
• Goal: To fill a partially filled 9×9 grid with
digits from 1 to 9
• Constraints:
• each column contains all from 1 to 9
• each row contains all from 1 to 9
• each 3×3 subgrid contains all from 1 to 9
• each cell contains exactly one digit (implicit)

• #Variables = 729
• #Clauses =~ 6000
SUDOKU using SAT Solver
• Variables:
• for 1 ≤ i,j,k ≤ 9, Xijk = 1 iff cell[i,j] contains digit k

• Encoding Constraints via Clauses


• Each cell contains exactly one digit
• for 1 ≤ i,j ≤ 9
• At least one of Xij1, …., Xij9 = 1 : (Vk:1-9 Xijk )
• No two are 1 at the same time : ꓥs≠t( ~Xijs V ~Xijt)
• ꓥ1≤i,j≤9 [(Vk:1-9 Xijk ) ꓥ (ꓥs≠t( ~Xijs V ~Xijt))]
SUDOKU using SAT Solver
• Each digit appears exactly once in a row
for each digit 1 ≤ k ≤ 9
for each row 1 ≤ i ≤ 9
At least one of Xi1k, …., Xi9k = 1 : (Vj:1-9 Xijk )
No two are 1 at the same time : ꓥs≠t( ~Xisk V ~Xitk)
ꓥ1≤i,k≤9 [(Vj:1-9 Xijk ) ꓥ (ꓥs≠t( ~Xijs V ~Xijt))]
• Each digit appears exactly once in a column
ꓥ1≤j,k≤9 [(Vi:1-9 Xijk ) ꓥ (ꓥs≠t( ~Xsjk V ~Xtjk))]
SUDOKU using SAT Solver
• Each digit appears exactly once in sub-grid
for each digit k
for each sub-grid G
for each row, column (i,j) ϵ subgrid G
At least one of Xijk = 1 : (VijϵG Xijk )
No two are 1 at same time: ꓥ(s,t)≠(p,q)( ~Xstk V ~Xpqk)
ꓥ1≤k≤9,{G} [(VijϵG Xijk ) ꓥ (ꓥ(s,t)≠(p,q)( ~Xstk V ~Xpqk))]

• Already filled cells


for each already filled cell[i,j] = k
Xijk = 1
Thank You

You might also like