practical sat solving - kit · url: contains all the slides and homework assignments organization...
TRANSCRIPT
NSTITUTE FOR THEORETICAL COMPUTER SCIENCE
Practical SAT SolvingLecture 1
Carsten Sinz, Tomas Balyo | April 18, 2016
KIT – University of the State of Baden-Wuerttemberg and
National Laboratory of the Helmholtz Association
www.kit.edu
Events
LecturesRoom 236Every Monday at 14:00Please enroll to the lecture on http://campus.studium.kit.edu
ExercisesRoom 301Every second Thursday (starting 28.4.) at 14:00
Exams25.7. and 19.9.Oral examinationBonus points for homework improve the grade
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 2/32
Contact
Carsten Sinzemail: [email protected]: 028
Tomas Balyoemail: [email protected]: 210
Homepageurl: http://baldur.iti.kit.edu/sat/Contains all the slides and homework assignments
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 3/32
Goals of this lecture
How do SAT solvers workAlgorithms
How to make a SAT solverImplementation techniques
How to use a SAT solver efficientlyHow to encode stuff into CNF
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 4/32
Propositional Logic
A Boolean variable (x) is a variable with two possible values:True and False.
A literal is a Boolean variable x (positive literal)or its negation x (negative literal).
A clause is a disjunction (or = ∨) of literals.
A CNF1 formula is a conjunction (and = ∧) of clauses.
ExampleF = (x1 ∨ x2) ∧ (x1 ∨ x2 ∨ x3) ∧ (x1)Vars(F) = {x1, x2, x3}Lits(F) = {x1, x1, x2, x2, x3}Cls(F) = {(x1 ∨ x2), (x1 ∨ x2 ∨ x3), (x1)}
1Conjunctive Normal Form
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 5/32
Satisfiability
A truth assignment φ assigns a truth value (True or False) to eachBoolean variable x , i.e., φ(x) = True or φ(x) = False.We say that φ satisfies
a positive literal x if φ(x) = Truea negative literal x if φ(x) = Falsea clause if it satisfies at least one of its literalsa CNF formula if it satisfies all of its clauses
If φ satisfies a CNF F then we call φ a satisfying assignment of F .
A formula F is satisfiable if there is φ that satisfies F .
The Satisfiability Problem is to determine whether a given formula issatisfiable. If so, we would also like to see a satisfying assignment.
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 6/32
Satisfiability
A truth assignment φ assigns a truth value (True or False) to eachBoolean variable x , i.e., φ(x) = True or φ(x) = False.We say that φ satisfies
a positive literal x if φ(x) = Truea negative literal x if φ(x) = Falsea clause if it satisfies at least one of its literalsa CNF formula if it satisfies all of its clauses
If φ satisfies a CNF F then we call φ a satisfying assignment of F .
A formula F is satisfiable if there is φ that satisfies F .
The Satisfiability Problem is to determine whether a given formula issatisfiable. If so, we would also like to see a satisfying assignment.
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 6/32
Satisfiability - Examples
Satisfiable Formulas(x1)(x2 ∨ x8 ∨ x3)(x1 ∨ x2) ∧ (x1 ∨ x2 ∨ x3) ∧ (x1)
Unsatisfiable Formulas(x1) ∧ (x1)(x1) ∧ (x1) ∧ (x2 ∨ x8 ∨ x3)(x1 ∨ x2) ∧ (x1 ∨ x2) ∧ (x1 ∨ x2) ∧ (x1 ∨ x2)
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 7/32
Satisfiability - A Practical Example
Scheduling a meeting consider the following constraints
Adam can only meet on Monday or Wednesday
Bridget cannot meet on Wednesday
Charles cannot meet on Friday
Darren can only meet on Thursday or Friday
Expressed as SATF = (x1 ∨ x3) ∧ (x3) ∧ (x5) ∧ (x4 ∨ x5) ∧ AtMostOne(x1, x2, x3, x4, x5)
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 8/32
Satisfiability - A Practical Example
Scheduling a meeting consider the following constraints
Adam can only meet on Monday or Wednesday
Bridget cannot meet on Wednesday
Charles cannot meet on Friday
Darren can only meet on Thursday or Friday
Expressed as SATF = (x1 ∨ x3) ∧ (x3) ∧ (x5) ∧ (x4 ∨ x5)∧(x1 ∨ x2) ∧ (x1 ∨ x3) ∧ (x1 ∨ x4) ∧ (x1 ∨ x5)∧(x2 ∨ x3) ∧ (x2 ∨ x4) ∧ (x2 ∨ x5)∧(x3 ∨ x4) ∧ (x3 ∨ x5)∧(x4 ∨ x5)
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 9/32
Satisfiability - A Practical Example
Scheduling a meeting consider the following constraints
Adam can only meet on Monday or Wednesday
Bridget cannot meet on Wednesday
Charles cannot meet on Friday
Darren can only meet on Thursday or Friday
Expressed as SATF = (x1 ∨ x3) ∧ (x3) ∧ (x5) ∧ (x4 ∨ x5) ∧ AtMostOne(x1, x2, x3, x4, x5)
Solution: Unsatisfiable, i.e., it is impossible to schedule a meeting withthese constraints
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 10/32
Satisfiability - Hardness
Satisfiability is NP-Complete [1], proof idea:
SAT is in NP – easy, checking a solution can be done in linear time
SAT in NP-hard – encode the run of a non-deterministic Turingmachine on an input to a CNF formula.
Consequences:
We don’t have a polynomial algorithm for SAT (yet) :(
If P 6= NP then we won’t have a polynomial algorithm :’(
All the known complete algorithms have exponential runtime in theworst case.
Hardness, try it yourself: http://www.cs.utexas.edu/~marijn/game/
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 11/32
Satisfiability - History
1960 The first SAT solving algorithm DP (Davis, Putnam) [2]
1962 An improved version of DP – DPLL [3]
1971 SAT was the first NP-Complete problem [1]
1992 Local Search SAT solving [4]
1992 The First International SAT Competition, followed by 1993,1996, since 2002 every year
1996 Conflict Driven Clause Learning [5]
1996 The First International SAT Conference (Workshop), followedby 1998, since 2000 every year
Early 90’s: 100 variables, 200 clauses, Today: 1,000,000 variables and5,000,000 clauses.
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 12/32
SAT Conference 2015
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 13/32
Applications of SAT solving
Hardware Model CheckingAll major hardware companies (Intel, ...) use SAT sovler to verify theirchip desgins
Software VerificationSAT solver based SMT solvers are used to verify Microsoft softwareproductsEmbedded software in Cars, Aiplanes, Refrigerators, ...Unix utilities
Automated Planning and Scheduling in Artificial IntelligenceStill one of the best approaches for optimal planning
Solving other NP-hard problems (coloring, clique, ...)
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 14/32
SAT Tools – Resolution
The Resolution Rule
(l ∨ x1 ∨ x2 ∨ · · · ∨ xn) ∧ (l ∨ y1 ∨ y2 ∨ · · · ∨ ym)
(x1 ∨ x2 ∨ · · · ∨ xn ∨ y1 ∨ y2 ∨ · · · ∨ ym)
The upper two clauses are called Input Clauses the bottom clause iscalled the Resolvent
Examples(x1 ∨ x3 ∨ x7) ∧ (x1 ∨ x2) ` (x3 ∨ x7 ∨ x2)
(x4 ∨ x5) ∧ (x5) ` (x4)
(x1 ∨ x2) ∧ (x1 ∨ x2) `(x1) ∧ (x1) `
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 15/32
SAT Tools – Resolution
The Resolution Rule
(l ∨ x1 ∨ x2 ∨ · · · ∨ xn) ∧ (l ∨ y1 ∨ y2 ∨ · · · ∨ ym)
(x1 ∨ x2 ∨ · · · ∨ xn ∨ y1 ∨ y2 ∨ · · · ∨ ym)
The upper two clauses are called Input Clauses the bottom clause iscalled the Resolvent
Examples(x1 ∨ x3 ∨ x7) ∧ (x1 ∨ x2) ` (x3 ∨ x7 ∨ x2)
(x4 ∨ x5) ∧ (x5) ` (x4)
(x1 ∨ x2) ∧ (x1 ∨ x2) `(x1) ∧ (x1) `
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 15/32
SAT Tools – Resolution
The Resolution Rule
(l ∨ x1 ∨ x2 ∨ · · · ∨ xn) ∧ (l ∨ y1 ∨ y2 ∨ · · · ∨ ym)
(x1 ∨ x2 ∨ · · · ∨ xn ∨ y1 ∨ y2 ∨ · · · ∨ ym)
The upper two clauses are called Input Clauses the bottom clause iscalled the Resolvent
Examples(x1 ∨ x3 ∨ x7) ∧ (x1 ∨ x2) ` (x3 ∨ x7 ∨ x2)
(x4 ∨ x5) ∧ (x5) ` (x4)
(x1 ∨ x2) ∧ (x1 ∨ x2) `(x1) ∧ (x1) `
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 15/32
SAT Tools – Resolution
The Resolution Rule
(l ∨ x1 ∨ x2 ∨ · · · ∨ xn) ∧ (l ∨ y1 ∨ y2 ∨ · · · ∨ ym)
(x1 ∨ x2 ∨ · · · ∨ xn ∨ y1 ∨ y2 ∨ · · · ∨ ym)
The upper two clauses are called Input Clauses the bottom clause iscalled the Resolvent
Examples(x1 ∨ x3 ∨ x7) ∧ (x1 ∨ x2) ` (x3 ∨ x7 ∨ x2)
(x4 ∨ x5) ∧ (x5) ` (x4)
(x1 ∨ x2) ∧ (x1 ∨ x2) `(x1) ∧ (x1) `
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 15/32
SAT Tools – Resolution
The Resolution Rule
(l ∨ x1 ∨ x2 ∨ · · · ∨ xn) ∧ (l ∨ y1 ∨ y2 ∨ · · · ∨ ym)
(x1 ∨ x2 ∨ · · · ∨ xn ∨ y1 ∨ y2 ∨ · · · ∨ ym)
The upper two clauses are called Input Clauses the bottom clause iscalled the Resolvent
Examples(x1 ∨ x3 ∨ x7) ∧ (x1 ∨ x2) ` (x3 ∨ x7 ∨ x2)
(x4 ∨ x5) ∧ (x5) ` (x4)
(x1 ∨ x2) ∧ (x1 ∨ x2) `(x1) ∧ (x1) `
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 15/32
SAT Tools – Resolution
The Resolution Rule
(l ∨ x1 ∨ x2 ∨ · · · ∨ xn) ∧ (l ∨ y1 ∨ y2 ∨ · · · ∨ ym)
(x1 ∨ x2 ∨ · · · ∨ xn ∨ y1 ∨ y2 ∨ · · · ∨ ym)
Special CasesTautological Resolvent (x1 ∨ x2) ∧ (x1 ∨ x2) ` (x1 ∨ x1)
Usually forbidden, does no harm, will be useful later
Empty Clause (x1) ∧ (x1) `⊥The empty clause a.k.a conflict clause a.k.a ”⊥” is unsatisfiable
Notation
R((x1 ∨ x2), (x1 ∨ x3)) = (x2 ∨ x3)
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 16/32
SAT Tools – Resolution
Theorem: Resolution maintains satisfiabilityLet F be a CNF formula and C1 and C2 two of it’s clauses with a paircomplementary literals. Then F is satisfiable if and only if F ∧ R(C1,C2) issatisfiable.
Proof:
If F is not satisfiable then F ∧ C for any C is also not satisfiable.If F is satisfiable and φ is a satisfying assignment of F then we showthat φ also satisfies R(C1,C2).
If C1 = (l ∨ P1) and C2 = (l ∨ P2) then R(C1,C2) = (P1 ∨ P2)Since φ satisfies both C1 and C2 it must satisfy at least one of theliterals in P1 or P2.
if φ satisfies l then it satisfies some literal in P2
if φ satisfies l then it satisfies some literal in P1
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 17/32
SAT Tools – Resolution
Theorem: Resolution maintains satisfiabilityLet F be a CNF formula and C1 and C2 two of it’s clauses with a paircomplementary literals. Then F is satisfiable if and only if F ∧ R(C1,C2) issatisfiable.
Proof:
If F is not satisfiable then F ∧ C for any C is also not satisfiable.If F is satisfiable and φ is a satisfying assignment of F then we showthat φ also satisfies R(C1,C2).
If C1 = (l ∨ P1) and C2 = (l ∨ P2) then R(C1,C2) = (P1 ∨ P2)Since φ satisfies both C1 and C2 it must satisfy at least one of theliterals in P1 or P2.
if φ satisfies l then it satisfies some literal in P2
if φ satisfies l then it satisfies some literal in P1
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 17/32
SAT Tools – Resolution
Theorem: Resolution maintains satisfiabilityLet F be a CNF formula and C1 and C2 two of it’s clauses with a paircomplementary literals. Then F is satisfiable if and only if F ∧ R(C1,C2) issatisfiable.
Consequences
If we manage to resolve the empty clause (⊥) the original formula isunsatisfiable
UsageProof of unsatisfiability – Resolution Proof
A resolution proof is a sequence of clauses such that each clause iseither a clause of the original formula or a resolvent of two previousclauses ending with ⊥.
Example: (x1 ∨ x2), (x1 ∨ x2), (x1 ∨ x2), (x1 ∨ x2) , (x2), (x2),⊥
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 18/32
SAT Tools – Resolution
Theorem: Resolution maintains satisfiabilityLet F be a CNF formula and C1 and C2 two of it’s clauses with a paircomplementary literals. Then F is satisfiable if and only if F ∧ R(C1,C2) issatisfiable.
Consequences
If we manage to resolve the empty clause (⊥) the original formula isunsatisfiable
UsageProof of unsatisfiability – Resolution Proof
A resolution proof is a sequence of clauses such that each clause iseither a clause of the original formula or a resolvent of two previousclauses ending with ⊥.
Example: (x1 ∨ x2), (x1 ∨ x2), (x1 ∨ x2), (x1 ∨ x2) , (x2), (x2),⊥
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 18/32
SAT Tools – Resolution
Theorem: Resolution maintains satisfiabilityLet F be a CNF formula and C1 and C2 two of it’s clauses with a paircomplementary literals. Then F is satisfiable if and only if F ∧ R(C1,C2) issatisfiable.
Consequences
If we manage to resolve the empty clause (⊥) the original formula isunsatisfiable
UsageProof of unsatisfiability – Resolution Proof
A resolution proof is a sequence of clauses such that each clause iseither a clause of the original formula or a resolvent of two previousclauses ending with ⊥.
Example: (x1 ∨ x2), (x1 ∨ x2), (x1 ∨ x2), (x1 ∨ x2) , (x2), (x2),⊥
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 18/32
SAT Tools – Resolution
Theorem: Resolution maintains satisfiabilityLet F be a CNF formula and C1 and C2 two of it’s clauses with a paircomplementary literals. Then F is satisfiable if and only if F ∧ R(C1,C2) issatisfiable.
Consequences
If we manage to resolve the empty clause (⊥) the original formula isunsatisfiable
UsageProof of unsatisfiability – Resolution Proof
A resolution proof is a sequence of clauses such that each clause iseither a clause of the original formula or a resolvent of two previousclauses ending with ⊥.
Example: (x1 ∨ x2), (x1 ∨ x2), (x1 ∨ x2), (x1 ∨ x2) , (x2), (x2),⊥
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 18/32
SAT Tools – Saturation Algorithm
Saturation AlgorithmINPUT: CNF formula F
OUTPUT: {SAT ,UNSAT}
while (true) doR = resolveAll(F)if (R ∩ F 6= R) then F = F ∪ Relse break
if (⊥∈ F) then return UNSAT else return SAT
Properties of the saturation algorithm:
it is sound and complete – always terminates and answers correctly
has exponential time and space complexity
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 19/32
SAT Tools – Saturation Algorithm
Saturation AlgorithmINPUT: CNF formula F
OUTPUT: {SAT ,UNSAT}
while (true) doR = resolveAll(F)if (R ∩ F 6= R) then F = F ∪ Relse break
if (⊥∈ F) then return UNSAT else return SAT
Properties of the saturation algorithm:
it is sound and complete – always terminates and answers correctly
has exponential time and space complexity
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 19/32
SAT Tools – Unit Propagation
Unit Resolution= at least one of the resolved clauses is unit (has one literal).
Example:
R((x1 ∨ x7 ∨ x2 ∨ x4), (x2)) = (x1 ∨ x7 ∨ x4)
Unit Propagation= a process of applying unit resolution as long as we get new clauses.
Example:
(x1) ∧ (x7 ∨ x2 ∨ x3) ∧ (x1 ∨ x3)
(x1) ∧ (x7 ∨ x2 ∨ x3) ∧ (x1 ∨ x3) ∧ (x3)
(x1) ∧ (x7 ∨ x2 ∨ x3) ∧ (x1 ∨ x3) ∧ (x3) ∧ (x7 ∨ x2)
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 20/32
SAT Tools – Unit Propagation
Unit Resolution= at least one of the resolved clauses is unit (has one literal).
Example:
R((x1 ∨ x7 ∨ x2 ∨ x4), (x2)) = (x1 ∨ x7 ∨ x4)
Unit Propagation= a process of applying unit resolution as long as we get new clauses.
Example:
(x1) ∧ (x7 ∨ x2 ∨ x3) ∧ (x1 ∨ x3)
(x1) ∧ (x7 ∨ x2 ∨ x3) ∧ (x1 ∨ x3) ∧ (x3)
(x1) ∧ (x7 ∨ x2 ∨ x3) ∧ (x1 ∨ x3) ∧ (x3) ∧ (x7 ∨ x2)
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 20/32
Easy Cases
SAT is not always hard, in the following cases it is polynomially solvable
2-SAT
Horn-SAT
Hidden Horn-SAT
SLUR
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 21/32
2-SAT
2-SAT Formula= each clause has exactly 2 literals.
Example:
(x1 ∨ x3) ∧ (x7 ∨ x3) ∧ (x1 ∨ x3)
(x1 ∨ x2) ∧ (x1 ∨ x2) ∧ (x1 ∨ x2) ∧ (x1 ∨ x2)
Also called Binary SAT or Quadratic SATHow to solve 2-SAT?
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 22/32
How to solve 2-SAT?
Saturation AlgorithmThe resolution saturation algorithm is polynomial for 2-SAT
Proof:
Only 2-literal resolvents are possible
There are only O(n2) 2-literal clauses on n variables
Complexity:
Both time and space O(n2)
There exists a linear algorithm! [6]
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 23/32
Implication Graph
Implication graph of a formula F is anoriented graph that has:
a vertex for each literal of F2 edges for each clause (l1 ∨ l2)
l1 → l2l2 → l1
Example:(x1 ∨ x2) ∧ (x2 ∨ x3) ∧ (x3 ∨ x1) ∧(x2 ∨ x4) ∧ (x3 ∨ x4) ∧ (x1 ∨ x3)
X1
X3
X2
-X4
-X1
-X3
-X2
X4
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 24/32
Implication Graph
The next step is to analyse theStrongly Connected Components ofthe implication graphs
SCC = there is a path in eachdirection between each pair
Tarjan’s algorithm finds SCCs inO(|V |+ |E |)If any x and x literal pair is inthe same SCC then the formulais UNSAT
All the literals in an SCC mustbe all True or all False
X1
X3
X2
-X4
-X1
-X3
-X2
X4
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 25/32
How to find the solution?
Construct the Condensation ofthe implication graph
contract each SCC into onevertex
Topologically order the verticesof the condensation
In reverse topological order, ifthe variables do not alreadyhave truth assignments, set allthe terms to true.
-X4
-X1, -X2, -X3
X4
X1, X2, X3
Example: x1 = x2 = x3 = True, x4 = True, the rest is already assigned.
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 26/32
How to solve 2-SAT?
Linear AlgorithmConstruct the Implication Graph
Find all the SCCs
Check if any SCC contains a complementary pair
Construct a condensation of the implication graph
Run topological sort on the condensation
Construct the solution
Complexity:
All the steps can be done in linear time
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 27/32
HornSAT
Horn FormulaA CNF formula is a Horn formula is each of its clauses contains at mostone positive literal.
Example: (x1 ∨ x7 ∨ x3) ∧ (x2 ∨ x4) ∧ (x1)
Solving Horn FormulasPerform unit propagation on the input formula
If you resolve ⊥ then the formula is UNSAT otherwise it is SATGet the solution:
Assign the variables in unit clauses to satisfy themSet the rest of the variables to False
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 28/32
HornSAT
Horn FormulaA CNF formula is a Horn formula is each of its clauses contains at mostone positive literal.
Example: (x1 ∨ x7 ∨ x3) ∧ (x2 ∨ x4) ∧ (x1)
Solving Horn FormulasPerform unit propagation on the input formula
If you resolve ⊥ then the formula is UNSAT otherwise it is SATGet the solution:
Assign the variables in unit clauses to satisfy themSet the rest of the variables to False
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 28/32
Mixed Horn
Mixed Horn FormulaA CNF formula is Mixed Horn if it contains only quadratic and Hornclauses.
Example: (x1 ∨ x7 ∨ x3) ∧ (x2 ∨ x4) ∧ (x1 ∨ x5) ∧ (x3)
Questions:
How to solve a Mixed Horn formula?
How to hard is it to solve a Mixed Horn formula?
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 29/32
Mixed Horn Formula
Mixed Horn ComplexityMixed Horn SAT solving is NP-complete
Proof:
We will reduce SAT to Mixed Horn SATFor each non-Horn clause C = (l1 ∨ l2 ∨ . . . ) do
for each but one positive li ∈ C intruduce a new variable l ′ireplace li in C by l ′iadd (l ′i ∨ li) ∧ (l ′i ∨ li) to establish li = l ′i
Example: (x1 ∨ x7 ∨ x3) ∧ (x2 ∨ x4) ∧ (x1 ∨ x5) (x ′
1 ∨ x7 ∨ x3) ∧ (x2 ∨ x4) ∧ (x ′1 ∨ x5) ∧ (x ′
1 ∨ x1) ∧ (x ′1 ∨ x1)
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 30/32
Hidden/Renamable/Disguised Horn
Hidden Horn FormulasA CNF formula is Hidden Horn if it can be made Horn by renaming someof its variables.
Example:(x1 ∨ x2 ∨ x4) ∧ (x2 ∨ x4) ∧ (x1) (x1 ∨ x2 ∨ x4) ∧ (x2 ∨ x4) ∧ (x1)
Questions:
How to recongize a Hidden Horn formula?
How to hard is it to recognize and solve a Hidden Horn formula?
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 31/32
Recognizing Hidden Horn Formulas
Transalte into 2-SATLet F be original formula, RF contains the clause (l1 ∨ l2) if and only ifthere is a clause C ∈ F such that l1 ∈ C and l2 ∈ C.
Example: F = (x1 ∨ x2 ∨ x4) ∧ (x2 ∨ x4) ∧ (x1)RF = (x1 ∨ x2) ∧ (x1 ∨ x4) ∧ (x2 ∨ x4) ∧ (x2 ∨ x4)
Recognize Hidden HornIf RF is satisfiable, then F is a hidden Horn formula. Furthermore, thesatisfying assignment φ of RF identifies the variables to be renamed.
if xi = True in φ then xi needs to be renamed to x i
Organization Definition
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 32/32
References I
S. A. Cook, The complexity of theorem-proving procedures, in:Proceedings of the third annual ACM symposium on Theory ofcomputing, ACM, 1971, pp. 151–158.
M. Davis, H. Putnam, A computing procedure for quantificationtheory, J. ACM 7 (3) (1960) 201–215.doi:10.1145/321033.321034.URL http://doi.acm.org/10.1145/321033.321034
M. Davis, G. Logemann, D. Loveland, A machine program fortheorem-proving, Commun. ACM 5 (7) (1962) 394–397.doi:10.1145/368273.368557.URL http://doi.acm.org/10.1145/368273.368557
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 33/32
References II
B. Selman, H. J. Levesque, D. G. Mitchell, et al., A new method forsolving hard satisfiability problems., in: AAAI, Vol. 92, 1992, pp.440–446.
J. P. Marques-Silva, K. A. Sakallah, Grasp: A search algorithm forpropositional satisfiability, Computers, IEEE Transactions on 48 (5)(1999) 506–521.
B. Aspvall, M. F. Plass, R. E. Tarjan, A linear-time algorithm for testingthe truth of certain quantified boolean formulas, InformationProcessing Letters 8 (3) (1979) 121–123.
Carsten Sinz, Tomas Balyo – SAT Solving April 18, 2016 34/32