Minimal Unsatisfiability: Theory, Algorithms and
Applications
Anton Belov
Complex and Adaptive Systems Laboratory
School of Computer Science and Informatics
University College Dublin, Ireland
EPCL Basic Training Camp
December 10-21, 2012
Dresden, Germany
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#1
Abstract
Minimal unsatisfiability and minimally unsatisfiable subformulas (MUSes)
find a wide range of practical applications, including hardware and software
design and verification, product configuration and knowledge-based
validation. This course provides an introduction to the topic of minimal
unsatisfiability in classical propositional logic and some of its extensions.
The course covers the basic theory of minimal unsatisfiability and related
concepts, algorithms and optimization techniques for computing and
approximating MUSes, and some of the concrete applications of minimal
unsatisfiability. The course assumes familiarity with classical propositional
logic, propositional satisfiability (SAT) and the basics of SAT solving.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#2
Introduction
F = {C1 , . . . , C6 }
A. Belov
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#3
Introduction
F = {C1 , . . . , C6 }
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
Can we narrow down the source(s) of F’s inconsistency ?
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#3
Introduction
F = {C1 , . . . , C6 }
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
Can we narrow down the source(s) of F’s inconsistency ?
The set {C1 , C2 , C3 } ∈ UNSAT, and is minimal w.r.t. to UNSAT.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#3
Introduction
F = {C1 , . . . , C6 }
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
Can we narrow down the source(s) of F’s inconsistency ?
The set {C1 , C2 , C3 } ∈ UNSAT, and is minimal w.r.t. to UNSAT.
{C1 , C2 , C3 } is minimally unsatisfiable subformula (MUS) of F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#3
Introduction
F = {C1 , . . . , C6 }
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
Can we narrow down the source(s) of F’s inconsistency ?
The set {C1 , C2 , C3 } ∈ UNSAT, and is minimal w.r.t. to UNSAT.
{C1 , C2 , C3 } is minimally unsatisfiable subformula (MUS) of F.
{C1 , C2 , C4 , C6 } is another MUS of F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#3
Introduction
Why do we care about minimal unsatisfiability (MU) and MUSes ?
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#4
Introduction
Why do we care about minimal unsatisfiability (MU) and MUSes ?
Theory
I Proof complexity (e.g. known hard examples for resolution are MU).
I MU-decision problem is DP -complete (related to various “criticality”
problems).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#4
Introduction
Why do we care about minimal unsatisfiability (MU) and MUSes ?
Theory
I Proof complexity (e.g. known hard examples for resolution are MU).
I MU-decision problem is DP -complete (related to various “criticality”
problems).
Applications
I Identification and repair of sources of inconsistency:
I
I
I
circuit error diagnosis;
type debugging in programming languages;
error localization in (automotive) product configuration.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#4
Introduction
Why do we care about minimal unsatisfiability (MU) and MUSes ?
Theory
I Proof complexity (e.g. known hard examples for resolution are MU).
I MU-decision problem is DP -complete (related to various “criticality”
problems).
Applications
I Identification and repair of sources of inconsistency:
I
I
I
I
circuit error diagnosis;
type debugging in programming languages;
error localization in (automotive) product configuration.
Identification of relevant/important features of systems:
I
I
I
I
abstraction in model checking;
environmental assumptions in formal equivalence checking;
interpolation-based model checking;
logic synthesis (Boolean function decomposition).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#4
Introduction
Why do we care about minimal unsatisfiability (MU) and MUSes ?
Theory
I Proof complexity (e.g. known hard examples for resolution are MU).
I MU-decision problem is DP -complete (related to various “criticality”
problems).
Applications
I Identification and repair of sources of inconsistency:
I
I
I
I
circuit error diagnosis;
type debugging in programming languages;
error localization in (automotive) product configuration.
Identification of relevant/important features of systems:
I
I
I
I
abstraction in model checking;
environmental assumptions in formal equivalence checking;
interpolation-based model checking;
logic synthesis (Boolean function decomposition).
Interesting and difficult problem
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#4
Course outline
1. Preliminaries: CNF formulas, notation, SAT solvers.
2. Minimal Unsatisfiability: example, definition.
3. Structure of UNSAT formulas: MUSes, MCSes, hitting sets duality,
MaxSAT.
4. Minimal Unsatisfiability and MUSes: complexity results, related
problems.
5. Towards the algorithms: categorization of clauses.
6. Algorithms for MUS computation.
7. Applications.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#5
Preliminaries
Propositional variables: Vars = {p, q, r , . . . }.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#6
Preliminaries
Propositional variables: Vars = {p, q, r , . . . }.
Literal : l — a variable (e.g. p) or its negation (e.g. ¬p).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#6
Preliminaries
Propositional variables: Vars = {p, q, r , . . . }.
Literal : l — a variable (e.g. p) or its negation (e.g. ¬p).
Clause : C — a disjunction of literals (e.g. C = (p ∨ ¬q)); empty clause
⊥; tautological clause — contains a literal and its negation.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#6
Preliminaries
Propositional variables: Vars = {p, q, r , . . . }.
Literal : l — a variable (e.g. p) or its negation (e.g. ¬p).
Clause : C — a disjunction of literals (e.g. C = (p ∨ ¬q)); empty clause
⊥; tautological clause — contains a literal and its negation.
CNF formula : F — a conjunction of clauses; written/treated as a set of
clauses (e.g. F = {C1 , C2 , C3 }).
I Assume no tautologies.
I |F| — number of clauses.
I Var (F) — the set of variables that occur in F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#6
Preliminaries
Propositional variables: Vars = {p, q, r , . . . }.
Literal : l — a variable (e.g. p) or its negation (e.g. ¬p).
Clause : C — a disjunction of literals (e.g. C = (p ∨ ¬q)); empty clause
⊥; tautological clause — contains a literal and its negation.
CNF formula : F — a conjunction of clauses; written/treated as a set of
clauses (e.g. F = {C1 , C2 , C3 }).
I Assume no tautologies.
I |F| — number of clauses.
I Var (F) — the set of variables that occur in F.
Assignment : τ : Vars * {0, 1}; assume complete assignments, i.e. for a
formula F, τ : Var (F) 7→ {0, 1}.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#6
Preliminaries
Propositional variables: Vars = {p, q, r , . . . }.
Literal : l — a variable (e.g. p) or its negation (e.g. ¬p).
Clause : C — a disjunction of literals (e.g. C = (p ∨ ¬q)); empty clause
⊥; tautological clause — contains a literal and its negation.
CNF formula : F — a conjunction of clauses; written/treated as a set of
clauses (e.g. F = {C1 , C2 , C3 }).
I Assume no tautologies.
I |F| — number of clauses.
I Var (F) — the set of variables that occur in F.
Assignment : τ : Vars * {0, 1}; assume complete assignments, i.e. for a
formula F, τ : Var (F) 7→ {0, 1}.
Assignments are extended to literals, clauses and formulas according to the
semantics of classical propositional logic.
Note: τ (⊥) is always 0, τ (∅) is always 1.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#6
Preliminaries
Def: τ is a model of CNF formula F if τ (F) = 1.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#7
Preliminaries
Def: τ is a model of CNF formula F if τ (F) = 1.
Def: F is satisfiable if it has a model, unsatisfiable otherwise.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#7
Preliminaries
Def: τ is a model of CNF formula F if τ (F) = 1.
Def: F is satisfiable if it has a model, unsatisfiable otherwise.
SAT (resp. UNSAT) — the set of all satisfiable (resp. unsatisfiable) CNF
formulas.
Theorem
: SAT is NP-complete.
[cf Cook’71]
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#7
Preliminaries
Def: τ is a model of CNF formula F if τ (F) = 1.
Def: F is satisfiable if it has a model, unsatisfiable otherwise.
SAT (resp. UNSAT) — the set of all satisfiable (resp. unsatisfiable) CNF
formulas.
Theorem
: SAT is NP-complete.
[cf Cook’71]
Notation: Unsat(F, τ ) = {C ∈ F | τ (C ) = 0} — clauses of F falsified by
the assignment τ .
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#7
Preliminaries
Def: τ is a model of CNF formula F if τ (F) = 1.
Def: F is satisfiable if it has a model, unsatisfiable otherwise.
SAT (resp. UNSAT) — the set of all satisfiable (resp. unsatisfiable) CNF
formulas.
Theorem
: SAT is NP-complete.
[cf Cook’71]
Notation: Unsat(F, τ ) = {C ∈ F | τ (C ) = 0} — clauses of F falsified by
the assignment τ .
Despite NP-completeness of SAT, SAT solvers are capable of handling
very large practical instances.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#7
Preliminaries: SAT solvers
Best-performing SAT solvers for practical applications are CDCL-based.
I
CDCL
A. Belov
[Marques Silva and Sakallah, ’96]
— conflict-driven clause learning algorithm.
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#8
Preliminaries: SAT solvers
Best-performing SAT solvers for practical applications are CDCL-based.
I
CDCL
[Marques Silva and Sakallah, ’96]
— conflict-driven clause learning algorithm.
Important features of modern CDCL-based SAT solvers:
1. When F ∈ UNSAT, solvers can produce an unsatisfiable core — a
sub-formula U ⊆ F, s.t. U ∈ UNSAT. Note: U is the support of a
resolution refutation of F implicitly built by a CDCL-based SAT solver.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#8
Preliminaries: SAT solvers
Best-performing SAT solvers for practical applications are CDCL-based.
I
CDCL
[Marques Silva and Sakallah, ’96]
— conflict-driven clause learning algorithm.
Important features of modern CDCL-based SAT solvers:
1. When F ∈ UNSAT, solvers can produce an unsatisfiable core — a
sub-formula U ⊆ F, s.t. U ∈ UNSAT. Note: U is the support of a
resolution refutation of F implicitly built by a CDCL-based SAT solver.
2. SAT solvers are incremental — solvers allow for multiple
invocations, on the same, or larger, formula, and re-use previously
learned information.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#8
Preliminaries: SAT solvers
Best-performing SAT solvers for practical applications are CDCL-based.
I
CDCL
[Marques Silva and Sakallah, ’96]
— conflict-driven clause learning algorithm.
Important features of modern CDCL-based SAT solvers:
1. When F ∈ UNSAT, solvers can produce an unsatisfiable core — a
sub-formula U ⊆ F, s.t. U ∈ UNSAT. Note: U is the support of a
resolution refutation of F implicitly built by a CDCL-based SAT solver.
2. SAT solvers are incremental — solvers allow for multiple
invocations, on the same, or larger, formula, and re-use previously
learned information.
3. SAT solving with assumptions [Eén and Sörensson, ’03]: let A ⊆ Vars(F), and
let τ : A 7→ {0, 1}. SAT solvers determine satisfiability of F|A
directly, i.e. without modifying the input formula.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#8
Preliminaries: SAT solvers
Best-performing SAT solvers for practical applications are CDCL-based.
I
CDCL
[Marques Silva and Sakallah, ’96]
— conflict-driven clause learning algorithm.
Important features of modern CDCL-based SAT solvers:
1. When F ∈ UNSAT, solvers can produce an unsatisfiable core — a
sub-formula U ⊆ F, s.t. U ∈ UNSAT. Note: U is the support of a
resolution refutation of F implicitly built by a CDCL-based SAT solver.
2. SAT solvers are incremental — solvers allow for multiple
invocations, on the same, or larger, formula, and re-use previously
learned information.
3. SAT solving with assumptions [Eén and Sörensson, ’03]: let A ⊆ Vars(F), and
let τ : A 7→ {0, 1}. SAT solvers determine satisfiability of F|A
directly, i.e. without modifying the input formula.
4. Incrementality and assumptions allow to program SAT solvers:
adding/removing and enabling/disabling clauses.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#8
Course outline
1. Preliminaries: CNF formulas, notation, SAT solvers.
2. Minimal Unsatisfiability: example, definition.
3. Structure of UNSAT formulas: MUSes, MCSes, hitting sets duality,
MaxSAT.
4. Minimal Unsatisfiability and MUSes: complexity results, related
problems.
5. Towards the algorithms: categorization of clauses.
6. Algorithms for MUS computation.
7. Applications.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
#9
Minimal Unsatisfiability
Def: A CNF formula F is minimally unsatisfiable (MU) if F ∈ UNSAT,
and ∀C ∈ F, F \ {C } ∈ SAT.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 10
Minimal Unsatisfiability
Def: A CNF formula F is minimally unsatisfiable (MU) if F ∈ UNSAT,
and ∀C ∈ F, F \ {C } ∈ SAT.
C1 = (p)
C2 = (¬p ∨ q)
C3 = (¬p ∨ ¬q)
UNSAT
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 10
Minimal Unsatisfiability
Def: A CNF formula F is minimally unsatisfiable (MU) if F ∈ UNSAT,
and ∀C ∈ F, F \ {C } ∈ SAT.
C1 = (p)
C2 = (¬p ∨ q)
C3 = (¬p ∨ ¬q)
UNSAT
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 10
Minimal Unsatisfiability
Def: A CNF formula F is minimally unsatisfiable (MU) if F ∈ UNSAT,
and ∀C ∈ F, F \ {C } ∈ SAT.
C1 = (p)
C2 = (¬p ∨ q)
C3 = (¬p ∨ ¬q)
SAT
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 10
Minimal Unsatisfiability
Def: A CNF formula F is minimally unsatisfiable (MU) if F ∈ UNSAT,
and ∀C ∈ F, F \ {C } ∈ SAT.
C1 = (p)
C2 = (¬p ∨ q)
C3 = (¬p ∨ ¬q)
SAT
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 10
Minimal Unsatisfiability
Def: A CNF formula F is minimally unsatisfiable (MU) if F ∈ UNSAT,
and ∀C ∈ F, F \ {C } ∈ SAT.
C1 = (p)
C2 = (¬p ∨ q)
C3 = (¬p ∨ ¬q)
SAT
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 10
Minimal Unsatisfiability
Def: A CNF formula F is minimally unsatisfiable (MU) if F ∈ UNSAT,
and ∀C ∈ F, F \ {C } ∈ SAT.
C1 = (p)
C2 = (¬p ∨ q)
C3 = (¬p ∨ ¬q)
UNSAT
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 10
Minimal Unsatisfiability
Def: A CNF formula F is minimally unsatisfiable (MU) if F ∈ UNSAT,
and ∀C ∈ F, F \ {C } ∈ SAT.
C1 = (p)
C2 = (¬p ∨ q)
C3 = (¬p ∨ ¬q)
UNSAT
Notation: MU — class of all minimally unsatisfiable CNF formulas.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 10
Minimal Unsatisfiability
Def: A CNF formula F is minimally unsatisfiable (MU) if F ∈ UNSAT,
and ∀C ∈ F, F \ {C } ∈ SAT.
C1 = (p)
C2 = (¬p ∨ q)
C3 = (¬p ∨ ¬q)
UNSAT
Notation: MU — class of all minimally unsatisfiable CNF formulas.
F1 = {(p), (¬p ∨ q), (¬p ∨ ¬q)} ∈ MU
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 10
Minimal Unsatisfiability
Def: A CNF formula F is minimally unsatisfiable (MU) if F ∈ UNSAT,
and ∀C ∈ F, F \ {C } ∈ SAT.
C1 = (p)
C2 = (¬p ∨ q)
C3 = (¬p ∨ ¬q)
UNSAT
Notation: MU — class of all minimally unsatisfiable CNF formulas.
F1 = {(p), (¬p ∨ q), (¬p ∨ ¬q)} ∈ MU
F2 = {(p), (¬p ∨ q)} ∈
/ MU (because ∈
/ UNSAT)
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 10
Minimal Unsatisfiability
Def: A CNF formula F is minimally unsatisfiable (MU) if F ∈ UNSAT,
and ∀C ∈ F, F \ {C } ∈ SAT.
C1 = (p)
C2 = (¬p ∨ q)
C3 = (¬p ∨ ¬q)
UNSAT
Notation: MU — class of all minimally unsatisfiable CNF formulas.
F1 = {(p), (¬p ∨ q), (¬p ∨ ¬q)} ∈ MU
F2 = {(p), (¬p ∨ q)} ∈
/ MU (because ∈
/ UNSAT)
F3 = {(p), (¬p ∨ q), (¬p ∨ ¬q), (p ∨ q)} ∈
/ MU (because
F3 \ {(p ∨ q)} ∈ UNSAT)
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 10
Structure of UNSAT Formulas: MUSes
Claim: For every F ∈ UNSAT, ∃M ⊆ F, such that M ∈ MU.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 11
Structure of UNSAT Formulas: MUSes
Claim: For every F ∈ UNSAT, ∃M ⊆ F, such that M ∈ MU.
Pf:
1. Let M = F.
2. If M ∈
/ MU, ∃C ∈ M such that M \ {C } ∈ UNSAT.
3. Let M = M \ {C }, goto 2.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 11
Structure of UNSAT Formulas: MUSes
Claim: For every F ∈ UNSAT, ∃M ⊆ F, such that M ∈ MU.
Pf:
1. Let M = F.
2. If M ∈
/ MU, ∃C ∈ M such that M \ {C } ∈ UNSAT.
3. Let M = M \ {C }, goto 2.
Def: M is minimally unsatisfiable subformula (MUS) of F if M ⊆ F and
M ∈ MU.
Notation: MUS(F) — the set of all MUSes of F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 11
Structure of UNSAT Formulas: MUSes
Claim: For every F ∈ UNSAT, ∃M ⊆ F, such that M ∈ MU.
Pf:
1. Let M = F.
2. If M ∈
/ MU, ∃C ∈ M such that M \ {C } ∈ UNSAT.
3. Let M = M \ {C }, goto 2.
Def: M is minimally unsatisfiable subformula (MUS) of F if M ⊆ F and
M ∈ MU.
Notation: MUS(F) — the set of all MUSes of F.
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 11
Structure of UNSAT Formulas: MUSes
Claim: For every F ∈ UNSAT, ∃M ⊆ F, such that M ∈ MU.
Pf:
1. Let M = F.
2. If M ∈
/ MU, ∃C ∈ M such that M \ {C } ∈ UNSAT.
3. Let M = M \ {C }, goto 2.
Def: M is minimally unsatisfiable subformula (MUS) of F if M ⊆ F and
M ∈ MU.
Notation: MUS(F) — the set of all MUSes of F.
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
{C1 , C2 , C3 } and {C1 , C2 , C4 , C6 } are the (only) MUSes.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 11
Structure of UNSAT Formulas: MUSes
Point 1: MUSes of F characterize the sources of inconsistency of F.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 12
Structure of UNSAT Formulas: MUSes
Point 1: MUSes of F characterize the sources of inconsistency of F.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 12
Structure of UNSAT Formulas: MUSes
Point 1: MUSes of F characterize the sources of inconsistency of F.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
Which clauses should be removed from F to restore its consistency ?
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 12
Structure of UNSAT Formulas: MUSes
Point 1: MUSes of F characterize the sources of inconsistency of F.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
Which clauses should be removed from F to restore its consistency ?
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 12
Structure of UNSAT Formulas: MUSes
Point 1: MUSes of F characterize the sources of inconsistency of F.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
Which clauses should be removed from F to restore its consistency ?
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 12
Structure of UNSAT Formulas: MUSes
Point 1: MUSes of F characterize the sources of inconsistency of F.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
SAT
Which clauses should be removed from F to restore its consistency ?
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 12
Structure of UNSAT Formulas: MUSes
Point 1: MUSes of F characterize the sources of inconsistency of F.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
SAT
Which clauses should be removed from F to restore its consistency ?
Point 2: To restore consistency of F, one must “break” all of its MUSes.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 12
Structure of UNSAT Formulas: MCSes
Def: M is minimal correction subset (MCS) of F if F \ M ∈ SAT and
∀C ∈ F, F \ (M \ {C }) ∈ UNSAT.
Notation: MCS(F) — the set of all MCSes of F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 13
Structure of UNSAT Formulas: MCSes
Def: M is minimal correction subset (MCS) of F if F \ M ∈ SAT and
∀C ∈ F, F \ (M \ {C }) ∈ UNSAT.
Notation: MCS(F) — the set of all MCSes of F.
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 13
Structure of UNSAT Formulas: MCSes
Def: M is minimal correction subset (MCS) of F if F \ M ∈ SAT and
∀C ∈ F, F \ (M \ {C }) ∈ UNSAT.
Notation: MCS(F) — the set of all MCSes of F.
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
SAT
{C1 } ∈ MCS(F)
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 13
Structure of UNSAT Formulas: MCSes
Def: M is minimal correction subset (MCS) of F if F \ M ∈ SAT and
∀C ∈ F, F \ (M \ {C }) ∈ UNSAT.
Notation: MCS(F) — the set of all MCSes of F.
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
{C1 } ∈ MCS(F)
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 13
Structure of UNSAT Formulas: MCSes
Def: M is minimal correction subset (MCS) of F if F \ M ∈ SAT and
∀C ∈ F, F \ (M \ {C }) ∈ UNSAT.
Notation: MCS(F) — the set of all MCSes of F.
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
SAT
{C1 } ∈ MCS(F)
{C3 , C4 } ∈ MCS(F) — note: minimal 6= smallest (minimum).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 13
Structure of UNSAT Formulas: MCSes
Def: M is minimal correction subset (MCS) of F if F \ M ∈ SAT and
∀C ∈ F, F \ (M \ {C }) ∈ UNSAT.
Notation: MCS(F) — the set of all MCSes of F.
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
{C1 } ∈ MCS(F)
{C3 , C4 } ∈ MCS(F) — note: minimal 6= smallest (minimum).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 13
Structure of UNSAT Formulas: MCSes
Def: M is minimal correction subset (MCS) of F if F \ M ∈ SAT and
∀C ∈ F, F \ (M \ {C }) ∈ UNSAT.
Notation: MCS(F) — the set of all MCSes of F.
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
SAT
{C1 } ∈ MCS(F)
{C3 , C4 } ∈ MCS(F) — note: minimal 6= smallest (minimum).
{C2 , C4 } ∈
/ MCS(F), because it is not minimal.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 13
Structure of UNSAT Formulas: Hitting Sets Duality
Let S be a collection of arbitrary sets.
Def: A set H is a hitting set of S if for all S ∈ S , H ∩ S 6= ∅.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 14
Structure of UNSAT Formulas: Hitting Sets Duality
Let S be a collection of arbitrary sets.
Def: A set H is a hitting set of S if for all S ∈ S , H ∩ S 6= ∅.
Def: A hitting set H is irreducible if no H 0 ⊂ H is a hitting set of S .
Another often-used term: hyper-graph transversal.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 14
Structure of UNSAT Formulas: Hitting Sets Duality
Let S be a collection of arbitrary sets.
Def: A set H is a hitting set of S if for all S ∈ S , H ∩ S 6= ∅.
Def: A hitting set H is irreducible if no H 0 ⊂ H is a hitting set of S .
Another often-used term: hyper-graph transversal.
A
a
A. Belov
b
B
c
C
d
e
MU and MUSes: Theory, Algorithms and Applications
f
EPCL Training Camp, 2012
# 14
Structure of UNSAT Formulas: Hitting Sets Duality
Let S be a collection of arbitrary sets.
Def: A set H is a hitting set of S if for all S ∈ S , H ∩ S 6= ∅.
Def: A hitting set H is irreducible if no H 0 ⊂ H is a hitting set of S .
Another often-used term: hyper-graph transversal.
A
a
b
B
c
C
d
e
f
{a, c, e, f } is a hitting set of {A, B, C }, but not irreducible.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 14
Structure of UNSAT Formulas: Hitting Sets Duality
Let S be a collection of arbitrary sets.
Def: A set H is a hitting set of S if for all S ∈ S , H ∩ S 6= ∅.
Def: A hitting set H is irreducible if no H 0 ⊂ H is a hitting set of S .
Another often-used term: hyper-graph transversal.
A
a
b
B
c
C
d
e
f
{a, c, e, f } is a hitting set of {A, B, C }, but not irreducible.
{a, d, e} is an irreducible hitting set, so is {c, e}.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 14
Structure of UNSAT Formulas: Hitting Sets Duality
To restore consistency of F ∈ UNSAT one must “break” each of the
MUSes of F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 15
Structure of UNSAT Formulas: Hitting Sets Duality
To restore consistency of F ∈ UNSAT one must “break” each of the
MUSes of F.
A correction subset of F must be a hitting set of MUS(F).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 15
Structure of UNSAT Formulas: Hitting Sets Duality
To restore consistency of F ∈ UNSAT one must “break” each of the
MUSes of F.
A correction subset of F must be a hitting set of MUS(F).
A minimal correction subset (MCS) of F must be an irreducible hitting set
of MUS(F).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 15
Structure of UNSAT Formulas: Hitting Sets Duality
To restore consistency of F ∈ UNSAT one must “break” each of the
MUSes of F.
A correction subset of F must be a hitting set of MUS(F).
A minimal correction subset (MCS) of F must be an irreducible hitting set
of MUS(F).
Theorem
: Let F be in UNSAT.
[Reiter, ’87; Birnbaum and Lozinskii, ’03]
I
M is an MCS of F iff M is an irreducible hitting set of MUS(F).
I
M is an MUS of F iff M is an irreducible hitting set of MCS(F).
Note: In
[Reiter’ 87]
A. Belov
MCS = minimal diagnosis, MUS = minimal conflict set.
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 15
Structure of UNSAT Formulas: Hitting Sets Duality
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
MUSes
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
MCSes
MCS(F) = { {C1 }, {C2 }, {C3 , C4 }, {C3 , C6 } }
MUS(F) = { {C1 , C2 , C3 }, {C1 , C2 , C4 , C6 } }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 16
Structure of UNSAT Formulas: MaxSAT
Def: MaxSAT problem — given a CNF formula F find an assignment τ
(a MaxSAT solution ) that satisfies the maximum number of clauses.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 17
Structure of UNSAT Formulas: MaxSAT
Def: MaxSAT problem — given a CNF formula F find an assignment τ
(a MaxSAT solution ) that satisfies the maximum number of clauses.
Let τ be a MaxSAT solution of F, and let M = Unsat(F, τ ).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 17
Structure of UNSAT Formulas: MaxSAT
Def: MaxSAT problem — given a CNF formula F find an assignment τ
(a MaxSAT solution ) that satisfies the maximum number of clauses.
Let τ be a MaxSAT solution of F, and let M = Unsat(F, τ ).
Note: F \ M ∈ SAT, and ∀C ∈ M, F \ (M \ {C }) ∈ UNSAT. I.e. M is
an MCS of F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 17
Structure of UNSAT Formulas: MaxSAT
Def: MaxSAT problem — given a CNF formula F find an assignment τ
(a MaxSAT solution ) that satisfies the maximum number of clauses.
Let τ be a MaxSAT solution of F, and let M = Unsat(F, τ ).
Note: F \ M ∈ SAT, and ∀C ∈ M, F \ (M \ {C }) ∈ UNSAT. I.e. M is
an MCS of F.
Point : MaxSAT is about finding the smallest MCS.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 17
Structure of UNSAT Formulas: MaxSAT
Def: MaxSAT problem — given a CNF formula F find an assignment τ
(a MaxSAT solution ) that satisfies the maximum number of clauses.
Let τ be a MaxSAT solution of F, and let M = Unsat(F, τ ).
Note: F \ M ∈ SAT, and ∀C ∈ M, F \ (M \ {C }) ∈ UNSAT. I.e. M is
an MCS of F.
Point : MaxSAT is about finding the smallest MCS.
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
MCSes
A model of {C2 , . . . , C6 } is a MaxSAT solution.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 17
Course outline
1. Preliminaries: CNF formulas, notation, SAT solvers.
2. Minimal Unsatisfiability: example, definition.
3. Structure of UNSAT formulas: MUSes, MCSes, hitting sets duality,
MaxSAT.
4. Minimal Unsatisfiability and MUSes: complexity results, related
problems.
5. Towards the algorithms: categorization of clauses.
6. Algorithms for MUS computation.
7. Applications.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 18
Complexity Results
Theorem
[Papadimitriou and Wolfe, ’88]
A. Belov
: MU is DP -complete.
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 19
Complexity Results
Theorem
[Papadimitriou and Wolfe, ’88]
: MU is DP -complete.
L ∈ DP iff L = L1 ∩ L2 with L1 ∈ NP and L2 ∈ coNP.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 19
Complexity Results
Theorem
[Papadimitriou and Wolfe, ’88]
: MU is DP -complete.
L ∈ DP iff L = L1 ∩ L2 with L1 ∈ NP and L2 ∈ coNP.
I
Canonical DP -complete problem: SAT − UNSAT
the set of all pairs hF1 , F2 i with F1 ∈ SAT and F2 ∈ UNSAT.
I Note:
I
[Papadimitriou and Wolfe, ’88]
nicely reduce SAT to MU and UNSAT to MU.
Many problems related to “critical combinatorics” are in DP .
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 19
Complexity Results
Theorem
[Papadimitriou and Wolfe, ’88]
: MU is DP -complete.
L ∈ DP iff L = L1 ∩ L2 with L1 ∈ NP and L2 ∈ coNP.
I
Canonical DP -complete problem: SAT − UNSAT
the set of all pairs hF1 , F2 i with F1 ∈ SAT and F2 ∈ UNSAT.
I Note:
I
[Papadimitriou and Wolfe, ’88]
nicely reduce SAT to MU and UNSAT to MU.
Many problems related to “critical combinatorics” are in DP .
For certain formulas the problem is easier.
Def: A deficiency of a CNF formula F, d(F) = |F| − |Vars(F)|.
Theorem
: F ∈ MU ⇒ d(F) > 0.
[Aharoni and Linial, ’86]
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 19
Complexity Results
Notation: MU(k) — the set of MU formulas with deficiency k.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 20
Complexity Results
Notation: MU(k) — the set of MU formulas with deficiency k.
Theorem
: For a fixed k, MU(k) ∈ P.
[Fleischner, Kullmann, and Szeider, ’02]
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 20
Complexity Results
Notation: MU(k) — the set of MU formulas with deficiency k.
Theorem
: For a fixed k, MU(k) ∈ P.
[Fleischner, Kullmann, and Szeider, ’02]
1
I
Specifically: F ∈ MU(k) can be decided in O(L · nk+ 2 ), where
n = |Var (F)|, and L is the length of F (i.e. L = O(n2 )).
I
O(n2 ) algorithm for deciding F ∈ MU(1) in
I O(n3 )
A. Belov
algorithm for MU(2) in
[Kleine Buning, ’00]
[Davidov et al, ’98]
.
(also, MU(k) ∈ NP).
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 20
Complexity Results
Notation: MU(k) — the set of MU formulas with deficiency k.
Theorem
: For a fixed k, MU(k) ∈ P.
[Fleischner, Kullmann, and Szeider, ’02]
1
I
Specifically: F ∈ MU(k) can be decided in O(L · nk+ 2 ), where
n = |Var (F)|, and L is the length of F (i.e. L = O(n2 )).
I
O(n2 ) algorithm for deciding F ∈ MU(1) in
I O(n3 )
algorithm for MU(2) in
[Kleine Buning, ’00]
[Davidov et al, ’98]
.
(also, MU(k) ∈ NP).
Note: in practical applications k is very large.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 20
Complexity Results
Notation: MU(k) — the set of MU formulas with deficiency k.
Theorem
: For a fixed k, MU(k) ∈ P.
[Fleischner, Kullmann, and Szeider, ’02]
1
I
Specifically: F ∈ MU(k) can be decided in O(L · nk+ 2 ), where
n = |Var (F)|, and L is the length of F (i.e. L = O(n2 )).
I
O(n2 ) algorithm for deciding F ∈ MU(1) in
I O(n3 )
algorithm for MU(2) in
[Kleine Buning, ’00]
[Davidov et al, ’98]
.
(also, MU(k) ∈ NP).
Note: in practical applications k is very large.
MUS computation: in FPNP Note: i.e. poly number of calls to NP oracle.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 20
Complexity Results
Notation: MU(k) — the set of MU formulas with deficiency k.
Theorem
: For a fixed k, MU(k) ∈ P.
[Fleischner, Kullmann, and Szeider, ’02]
1
I
Specifically: F ∈ MU(k) can be decided in O(L · nk+ 2 ), where
n = |Var (F)|, and L is the length of F (i.e. L = O(n2 )).
I
O(n2 ) algorithm for deciding F ∈ MU(1) in
I O(n3 )
algorithm for MU(2) in
[Kleine Buning, ’00]
[Davidov et al, ’98]
.
(also, MU(k) ∈ NP).
Note: in practical applications k is very large.
MUS computation: in FPNP Note: i.e. poly number of calls to NP oracle.
Practical algorithms for computation of MUSes are based on iterative calls
to SAT solver.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 20
Related Problems
MUS Membership Problem : does C ∈ F belongs to some MUS of F ?
I
I
ΣP2 -complete
(reduction from ∃∀QBF).
S
Related function problem: given F, compute MUS(F).
A. Belov
[Liberatore, 05]
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 21
Related Problems
MUS Membership Problem : does C ∈ F belongs to some MUS of F ?
I
I
ΣP2 -complete
(reduction from ∃∀QBF).
S
Related function problem: given F, compute MUS(F).
[Liberatore, 05]
Smallest MUS Problem : compute M ∈ MUS(F) of smallest cardinality.
I
Related problem: given F and k ∈ N, is there M ∈ MUS(F) such
that |M| ≤ k. ΣP2 -complete [Liberatore, 05].
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 21
Related Problems
MUS Membership Problem : does C ∈ F belongs to some MUS of F ?
I
I
ΣP2 -complete
(reduction from ∃∀QBF).
S
Related function problem: given F, compute MUS(F).
[Liberatore, 05]
Smallest MUS Problem : compute M ∈ MUS(F) of smallest cardinality.
I
Related problem: given F and k ∈ N, is there M ∈ MUS(F) such
that |M| ≤ k. ΣP2 -complete [Liberatore, 05].
MUS Enumeration Problem : given F, compute the set MUS(F).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 21
Related Problems
MUS Membership Problem : does C ∈ F belongs to some MUS of F ?
I
I
ΣP2 -complete
(reduction from ∃∀QBF).
S
Related function problem: given F, compute MUS(F).
[Liberatore, 05]
Smallest MUS Problem : compute M ∈ MUS(F) of smallest cardinality.
I
Related problem: given F and k ∈ N, is there M ∈ MUS(F) such
that |M| ≤ k. ΣP2 -complete [Liberatore, 05].
MUS Enumeration Problem : given F, compute the set MUS(F).
Note: Precise complexity results for ‘many problems are scarce.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 21
Course outline
1. Preliminaries: CNF formulas, notation, SAT solvers.
2. Minimal Unsatisfiability: example, definition.
3. Structure of UNSAT formulas: MUSes, MCSes, hitting sets duality,
MaxSAT.
4. Minimal Unsatisfiability and MUSes: complexity results, related
problems.
5. Towards the algorithms: categorization of clauses.
6. Algorithms for MUS computation.
7. Applications.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 22
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 23
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
Necessary clauses — belong to all MUSes of F, i.e. in
A. Belov
MU and MUSes: Theory, Algorithms and Applications
T
MUS(F).
EPCL Training Camp, 2012
# 23
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
Necessary clauses — belong to all MUSes of F, i.e. in
I Must be used in every resolution refutation of F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
T
MUS(F).
EPCL Training Camp, 2012
# 23
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
Necessary clauses — belong to all MUSes of F, i.e. in
I Must be used in every resolution refutation of F.
I If F ∈ MU, then all C ∈ F are necessary for F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
T
MUS(F).
EPCL Training Camp, 2012
# 23
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
T
Necessary clauses — belong to all MUSes of F, i.e. in MUS(F).
I Must be used in every resolution refutation of F.
I If F ∈ MU, then all C ∈ F are necessary for F.
I If C is necessary for F, it is necessary for every UNSAT F 0 ⊂ F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 23
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
T
Necessary clauses — belong to all MUSes of F, i.e. in MUS(F).
I Must be used in every resolution refutation of F.
I If F ∈ MU, then all C ∈ F are necessary for F.
I If C is necessary for F, it is necessary for every UNSAT F 0 ⊂ F.
Def: C ∈ F is necessary for F if F ∈ UNSAT and F \ {C } ∈ SAT.
I To decide whether C is necessary for F is NP-complete.[Liberatore, 05]
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 23
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
SAT
T
Necessary clauses — belong to all MUSes of F, i.e. in MUS(F).
I Must be used in every resolution refutation of F.
I If F ∈ MU, then all C ∈ F are necessary for F.
I If C is necessary for F, it is necessary for every UNSAT F 0 ⊂ F.
Def: C ∈ F is necessary for F if F ∈ UNSAT and F \ {C } ∈ SAT.
I To decide whether C is necessary for F is NP-complete.[Liberatore, 05]
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 23
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
SAT
T
Necessary clauses — belong to all MUSes of F, i.e. in MUS(F).
I Must be used in every resolution refutation of F.
I If F ∈ MU, then all C ∈ F are necessary for F.
I If C is necessary for F, it is necessary for every UNSAT F 0 ⊂ F.
Def: C ∈ F is necessary for F if F ∈ UNSAT and F \ {C } ∈ SAT.
I To decide whether C is necessary for F is NP-complete.[Liberatore, 05]
Note: C ∈ F is necessary for F iff ∃τ , such that Unsat(F, τ ) = {C }.
I τ – a witness of (necessity) of C ∈ F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 23
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
Potentially necessary clauses — in some but not all MUSes of F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 24
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
Potentially necessary clauses — in some but not all MUSes of F.
I
May become necessary when some clauses are removed from F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 24
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
Potentially necessary clauses — in some but not all MUSes of F.
I
May become necessary when some clauses are removed from F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 24
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
SAT
Potentially necessary clauses — in some but not all MUSes of F.
I
May become necessary when some clauses are removed from F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 24
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
SAT
Potentially necessary clauses — in some but not all MUSes of F.
I
May become necessary when some clauses are removed from F.
I
May be forced into every refutation by removing some clauses from F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 24
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
SAT
Potentially necessary clauses — in some but not all MUSes of F.
I
May become necessary when some clauses are removed from F.
I
May be forced into every refutation by removing some clauses from F.
I
To decide whether C belongs to some MUS is ΣP2 -complete.[Liberatore, 05]
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 24
Categorization of Clauses in (UNSAT) CNF
[Kullmann et al, ’06]
C1 = (p)
C3 = (¬p ∨ ¬q)
C5 = (p ∨ q)
C2 = (q)
C4 = (¬p ∨ r )
C6 = (¬q ∨ ¬r )
UNSAT
Potentially necessary clauses — in some but not all MUSes of F.
I
May become necessary when some clauses are removed from F.
I
May be forced into every refutation by removing some clauses from F.
I
To decide whether C belongs to some MUS is ΣP2 -complete.[Liberatore, 05]
Never necessary clauses — the rest.
I
Some might be used in resolution refutation; some will never be used.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 24
Course outline
1. Preliminaries: CNF formulas, notation, SAT solvers.
2. Minimal Unsatisfiability: example, definition.
3. Structure of UNSAT formulas: MUSes, MCSes, hitting sets duality,
MaxSAT.
4. Minimal Unsatisfiability and MUSes: complexity results, related
problems.
5. Towards the algorithms: categorization of clauses.
6. Algorithms for MUS computation.
7. Applications.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 25
Algorithms for Computing MUSes
Practical MUS extraction algorithms are based on detection of necessary
clauses (aka transition clauses ).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 26
Algorithms for Computing MUSes
Practical MUS extraction algorithms are based on detection of necessary
clauses (aka transition clauses ).
Most algorithms use iterative calls to SAT solver for this purpose.
I C is necessary for F ∈ UNSAT if F \ {C } ∈ SAT.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 26
Algorithms for Computing MUSes
Practical MUS extraction algorithms are based on detection of necessary
clauses (aka transition clauses ).
Most algorithms use iterative calls to SAT solver for this purpose.
I C is necessary for F ∈ UNSAT if F \ {C } ∈ SAT.
I Notation: SAT(F) — denotes SAT solver call. Returns true if
F ∈ SAT, false otherwise.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 26
Algorithms for Computing MUSes
Practical MUS extraction algorithms are based on detection of necessary
clauses (aka transition clauses ).
Most algorithms use iterative calls to SAT solver for this purpose.
I C is necessary for F ∈ UNSAT if F \ {C } ∈ SAT.
I Notation: SAT(F) — denotes SAT solver call. Returns true if
F ∈ SAT, false otherwise.
Typically classified according to the way the search is performed:
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 26
Algorithms for Computing MUSes
Practical MUS extraction algorithms are based on detection of necessary
clauses (aka transition clauses ).
Most algorithms use iterative calls to SAT solver for this purpose.
I C is necessary for F ∈ UNSAT if F \ {C } ∈ SAT.
I Notation: SAT(F) — denotes SAT solver call. Returns true if
F ∈ SAT, false otherwise.
Typically classified according to the way the search is performed:
I Deletion-based (or destructive ): necessary clauses are detected on
transition from UNSAT to SAT. MUS is built by removing
unnecessary clauses.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 26
Algorithms for Computing MUSes
Practical MUS extraction algorithms are based on detection of necessary
clauses (aka transition clauses ).
Most algorithms use iterative calls to SAT solver for this purpose.
I C is necessary for F ∈ UNSAT if F \ {C } ∈ SAT.
I Notation: SAT(F) — denotes SAT solver call. Returns true if
F ∈ SAT, false otherwise.
Typically classified according to the way the search is performed:
I Deletion-based (or destructive ): necessary clauses are detected on
transition from UNSAT to SAT. MUS is built by removing
unnecessary clauses.
I Insertion-based (or constructive ): necessary clauses are detected on
transition from SAT to UNSAT. MUS is built by adding necessary
clauses.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 26
Algorithms for Computing MUSes
Practical MUS extraction algorithms are based on detection of necessary
clauses (aka transition clauses ).
Most algorithms use iterative calls to SAT solver for this purpose.
I C is necessary for F ∈ UNSAT if F \ {C } ∈ SAT.
I Notation: SAT(F) — denotes SAT solver call. Returns true if
F ∈ SAT, false otherwise.
Typically classified according to the way the search is performed:
I Deletion-based (or destructive ): necessary clauses are detected on
transition from UNSAT to SAT. MUS is built by removing
unnecessary clauses.
I Insertion-based (or constructive ): necessary clauses are detected on
transition from SAT to UNSAT. MUS is built by adding necessary
clauses.
I Dichotomic (binary search).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 26
Algorithms for Computing MUSes
Practical MUS extraction algorithms are based on detection of necessary
clauses (aka transition clauses ).
Most algorithms use iterative calls to SAT solver for this purpose.
I C is necessary for F ∈ UNSAT if F \ {C } ∈ SAT.
I Notation: SAT(F) — denotes SAT solver call. Returns true if
F ∈ SAT, false otherwise.
Typically classified according to the way the search is performed:
I Deletion-based (or destructive ): necessary clauses are detected on
transition from UNSAT to SAT. MUS is built by removing
unnecessary clauses.
I Insertion-based (or constructive ): necessary clauses are detected on
transition from SAT to UNSAT. MUS is built by adding necessary
clauses.
I Dichotomic (binary search).
Complexity: in terms of number of SAT solver calls.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 26
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {C2 , C3 , C4 , C5 , C6 , C7 , C8 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {C2 , C3 , C4 , C5 , C6 , C7 , C8 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {C3 , C4 , C5 , C6 , C7 , C8 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {C4 , C5 , C6 , C7 , C8 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {C5 , C6 , C7 , C8 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C9
C6
C7
C8
C10
C11
C12
UNSAT
M = {C6 , C7 , C8 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C9
C6
C7
C8
C10
C11
C12
SAT
M = {C6 , C7 , C8 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C9
C6
C7
C8
C10
C11
C12
UNSAT
M = {C6 , C7 , C8 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C6
C9
C8
C10
C11
C12
UNSAT
M = {C6 , C8 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C6
C9
C10
C11
C12
UNSAT
M = {C6 , C9 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C6
C10
C11
C12
UNSAT
M = {C6 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C6
C10
C11
C12
SAT
M = {C6 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C6
C10
C11
C12
UNSAT
M = {C6 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C6
C10
C11
C12
UNSAT
M = {C6 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C6
C10
C11
C12
UNSAT
M = {C6 , C10 , C11 , C12 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Init: M = F — MUS overapproximation
Loop: for each clause C ∈ M
1. if M \ {C } ∈ UNSAT, then C is not necessary for M – remove it
from M.
2. otherwise, C is necessary, keep it in M.
C6
C10
C11
C12
UNSAT
M = {C6 , C10 , C11 , C12 } is an MUS of F
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 27
Deletion-Based MUS Computation
Input : Unsatisfiable CNF formula F
Output: M ∈ MUS(F)
M←F
// MUS over-approximation
foreach C ∈ M do
// Inv: tested clauses in M are nec. for M
if not SAT(M \ {C }) then // If UNSAT, C is not necessary for M
M ← M \ {C }
return M
A. Belov
// M is an MUS of F
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 28
Deletion-Based MUS Computation
Input : Unsatisfiable CNF formula F
Output: M ∈ MUS(F)
M←F
// MUS over-approximation
foreach C ∈ M do
// Inv: tested clauses in M are nec. for M
if not SAT(M \ {C }) then // If UNSAT, C is not necessary for M
M ← M \ {C }
return M
// M is an MUS of F
Number of calls to SAT oracle: Θ(|F|)
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 28
Deletion-Based MUS Computation
Input : Unsatisfiable CNF formula F
Output: M ∈ MUS(F)
M←F
// MUS over-approximation
foreach C ∈ M do
// Inv: tested clauses in M are nec. for M
if not SAT(M \ {C }) then // If UNSAT, C is not necessary for M
M ← M \ {C }
return M
// M is an MUS of F
Number of calls to SAT oracle: Θ(|F|)
But, certain optimizations make it scale on practical applications better
than any other algorithm.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 28
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {}
A. Belov
S = {}
F = {C1 , . . . , C12 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
SAT
M = {}
A. Belov
S = {}
F = {C1 , . . . , C12 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
SAT
M = {}
A. Belov
S = {C1 }
F = {C1 , . . . , C12 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
SAT
M = {}
A. Belov
S = {C1 , C2 }
F = {C1 , . . . , C12 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
SAT
M = {}
A. Belov
S = {C1 , C2 , C3 }
F = {C1 , . . . , C12 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
SAT
M = {}
A. Belov
S = {C1 , C2 , C3 , C4 }
F = {C1 , . . . , C12 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
SAT
M = {}
A. Belov
S = {C1 , C2 , C3 , C4 , C5 }
F = {C1 , . . . , C12 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {}
A. Belov
S = {C1 , C2 , C3 , C4 , C5 , C6 }
F = {C1 , . . . , C12 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {C6 }
A. Belov
S = {C1 , C2 , C3 , C4 , C5 , C6 }
F = {C1 , . . . , C12 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
UNSAT
M = {C6 }
A. Belov
S = {C1 , C2 , C3 , C4 , C5 , C6 }
F = {C1 , C2 , C3 , C4 , C5 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
SAT
M = {C6 }
A. Belov
S = {}
F = {C1 , C2 , C3 , C4 , C5 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
SAT
M = {C6 }
A. Belov
S = {C1 }
F = {C1 , C2 , C3 , C4 , C5 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
SAT
M = {C6 }
A. Belov
S = {C1 , C2 }
F = F = {C1 , C2 , C3 , C4 , C5 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
SAT
M = {C6 }
A. Belov
S = {C1 , C2 , C3 }
F = {C1 , C2 , C3 , C4 , C5 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
SAT
M = {C6 }
A. Belov
S = {C1 , C2 , C3 , C4 }
F = {C1 , C2 , C3 , C4 , C5 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
UNSAT
M = {C6 }
A. Belov
S = {C1 , C2 , C3 , C4 , C5 }
F = {C1 , C2 , C3 , C4 , C5 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
UNSAT
M = {C6 , C5 }
A. Belov
S = {C1 , C2 , C3 , C4 , C5 }
F = {C1 , C2 , C3 , C4 , C5 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
UNSAT
M = {C6 , C5 }
A. Belov
S = {C1 , C2 , C3 , C4 , C5 }
F = {C1 , C2 , C3 , C4 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
SAT
M = {C6 , C5 }
A. Belov
S = {}
F = {C1 , C2 , C3 , C4 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
SAT
M = {C6 , C5 }
A. Belov
S = {C1 }
F = {C1 , C2 , C3 , C4 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
UNSAT
M = {C6 , C5 }
A. Belov
S = {C1 , C2 }
F = {C1 , C2 , C3 , C4 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
C3
C4
UNSAT
M = {C6 , C5 , C2 }
A. Belov
S = {C1 , C2 }
F = {C1 , C2 , C3 , C4 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
UNSAT
M = {C6 , C5 , C2 }
A. Belov
S = {C1 , C2 }
MU and MUSes: Theory, Algorithms and Applications
F = {C1 }
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
SAT
M = {C6 , C5 , C2 }
A. Belov
S = {}
F = {C1 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
UNSAT
M = {C6 , C5 , C2 }
A. Belov
S = {C1 }
F = {C1 }
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
UNSAT
M = {C6 , C5 , C2 , C1 }
A. Belov
S = {C1 }
MU and MUSes: Theory, Algorithms and Applications
F = {C1 }
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
UNSAT
M = {C6 , C5 , C2 , C1 }
A. Belov
S = {C1 }
MU and MUSes: Theory, Algorithms and Applications
F = {}
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Init: M = ∅ — MUS under-approximation; S = ∅ — working formula.
1. while M ∪ S ∈ SAT, pick C ∈ F and add it to S.
2. when M ∪ S ∈ UNSAT the last clause C added to S is necessary for
M ∪ S.
3. add C to M, let F = S \ {C }, and let S = ∅.
4. if F = ∅ done, otherwise goto 1.
C1
C2
C5
C6
UNSAT
M = {C6 , C5 , C2 , C1 } is an MUS of the input formula F
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 29
Insertion-Based MUS Computation
Input : Unsatisfiable CNF Formula F
Output: M ∈ MUS(F)
M←∅
while F 6= ∅ do
// Inv:
S←∅
while SAT(M ∪ S) do
C ← PickClause(F)
S ← S ∪ {C }
M ← M ∪ {C }
F ← S \ {C }
// MUS under-approximation
∀C ∈ M is nec. for F ∪ M ∈ UNSAT
// Working formula
// Assert:
return M
A. Belov
C is nec. for M ∪ S
// M is an MUS of F
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 30
Insertion-Based MUS Computation
Input : Unsatisfiable CNF Formula F
Output: M ∈ MUS(F)
M←∅
while F 6= ∅ do
// Inv:
S←∅
while SAT(M ∪ S) do
C ← PickClause(F)
S ← S ∪ {C }
M ← M ∪ {C }
F ← S \ {C }
// MUS under-approximation
∀C ∈ M is nec. for F ∪ M ∈ UNSAT
// Working formula
// Assert:
return M
C is nec. for M ∪ S
// M is an MUS of F
Number of calls to SAT oracle: O(|F| × |M|)
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 30
Insertion-Based MUS Computation
Input : Unsatisfiable CNF Formula F
Output: M ∈ MUS(F)
M←∅
while F 6= ∅ do
// Inv:
S←∅
while SAT(M ∪ S) do
C ← PickClause(F)
S ← S ∪ {C }
M ← M ∪ {C }
F ← S \ {C }
// MUS under-approximation
∀C ∈ M is nec. for F ∪ M ∈ UNSAT
// Working formula
// Assert:
return M
C is nec. for M ∪ S
// M is an MUS of F
Number of calls to SAT oracle: O(|F| × |M|)
Worst case (F ∈ MU): Θ(|F|2 )
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 30
Insertion-Based MUS Computation
Why bother ?
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 31
Insertion-Based MUS Computation
Why bother ?
1. In principle, can much faster than deletion-based when there is a lot
small MUSes.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 31
Insertion-Based MUS Computation
Why bother ?
1. In principle, can much faster than deletion-based when there is a lot
small MUSes.
2. Easier SAT solver calls — SAT formulas are easier to solve than
UNSAT.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 31
Insertion-Based MUS Computation
Why bother ?
1. In principle, can much faster than deletion-based when there is a lot
small MUSes.
2. Easier SAT solver calls — SAT formulas are easier to solve than
UNSAT.
Note: Empirically, with the current optimizations the deletion-based algorithms are
orders of magnitude faster than insertion-based.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 31
Insertion-Based MUS Computation
Why bother ?
1. In principle, can much faster than deletion-based when there is a lot
small MUSes.
2. Easier SAT solver calls — SAT formulas are easier to solve than
UNSAT.
Note: Empirically, with the current optimizations the deletion-based algorithms are
orders of magnitude faster than insertion-based.
Some interesting variations of the insertion-based algorithms:
I
Addition of redundancy checks
I
Relaxation-variable based approach
A. Belov
[Van Maaren and Wieringa, ’08]
[Marques-Silva and Lynce, ’11]
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 31
Insertion-Based MUS with Redundancy Checks
Def: A clause C ∈ F (not necesserially UNSAT) is redundant in F if
F \ {C } {C }. C is irredundant otherwise.
Alternatively, C is redundant if F ≡ F \ {C }.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 32
Insertion-Based MUS with Redundancy Checks
Def: A clause C ∈ F (not necesserially UNSAT) is redundant in F if
F \ {C } {C }. C is irredundant otherwise.
Alternatively, C is redundant if F ≡ F \ {C }.
Note: Necessary clauses are a special case of irredundant clauses when
F ∈ UNSAT. Thus, every clause in an MUS M of F is irredundant.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 32
Insertion-Based MUS with Redundancy Checks
Def: A clause C ∈ F (not necesserially UNSAT) is redundant in F if
F \ {C } {C }. C is irredundant otherwise.
Alternatively, C is redundant if F ≡ F \ {C }.
Note: Necessary clauses are a special case of irredundant clauses when
F ∈ UNSAT. Thus, every clause in an MUS M of F is irredundant.
Idea: [Van Maaren and Wieringa, ’08] In insertion-based algorithm, do not add C ∈ F
to the working formula S if M ∪ S {C }, as otherwise C would be
redundant.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 32
Insertion-Based MUS with Redundancy Checks
Checking redundancy in the inner loop of the algorithm:
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 33
Insertion-Based MUS with Redundancy Checks
Checking redundancy in the inner loop of the algorithm:
S
I Let {¬C } denote
l∈C {¬l}.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 33
Insertion-Based MUS with Redundancy Checks
Checking redundancy in the inner loop of the algorithm:
S
I Let {¬C } denote
l∈C {¬l}.
I
If M ∪ S ∪ {¬C } ∈ UNSAT, then C is redundant ⇒ cannot be in the
computed MUS.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 33
Insertion-Based MUS with Redundancy Checks
Checking redundancy in the inner loop of the algorithm:
S
I Let {¬C } denote
l∈C {¬l}.
I
If M ∪ S ∪ {¬C } ∈ UNSAT, then C is redundant ⇒ cannot be in the
computed MUS.
I
So, replace SAT(M ∪ S) with SAT(M ∪ S ∪ {¬C }).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 33
Insertion-Based MUS with Redundancy Checks
Checking redundancy in the inner loop of the algorithm:
S
I Let {¬C } denote
l∈C {¬l}.
I
If M ∪ S ∪ {¬C } ∈ UNSAT, then C is redundant ⇒ cannot be in the
computed MUS.
I
So, replace SAT(M ∪ S) with SAT(M ∪ S ∪ {¬C }).
I
If outcome is true, add C to S, otherwise remove it from F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 33
Insertion-Based MUS with Redundancy Checks
Checking redundancy in the inner loop of the algorithm:
S
I Let {¬C } denote
l∈C {¬l}.
I
If M ∪ S ∪ {¬C } ∈ UNSAT, then C is redundant ⇒ cannot be in the
computed MUS.
I
So, replace SAT(M ∪ S) with SAT(M ∪ S ∪ {¬C }).
I
If outcome is true, add C to S, otherwise remove it from F.
But, then how do we know when to terminate the inner loop ?
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 33
Insertion-Based MUS with Redundancy Checks
Checking redundancy in the inner loop of the algorithm:
S
I Let {¬C } denote
l∈C {¬l}.
I
If M ∪ S ∪ {¬C } ∈ UNSAT, then C is redundant ⇒ cannot be in the
computed MUS.
I
So, replace SAT(M ∪ S) with SAT(M ∪ S ∪ {¬C }).
I
If outcome is true, add C to S, otherwise remove it from F.
But, then how do we know when to terminate the inner loop ?
I
We don’t, but when M ∪ S ∈ UNSAT, every new clause is redundant.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 33
Insertion-Based MUS with Redundancy Checks
Checking redundancy in the inner loop of the algorithm:
S
I Let {¬C } denote
l∈C {¬l}.
I
If M ∪ S ∪ {¬C } ∈ UNSAT, then C is redundant ⇒ cannot be in the
computed MUS.
I
So, replace SAT(M ∪ S) with SAT(M ∪ S ∪ {¬C }).
I
If outcome is true, add C to S, otherwise remove it from F.
But, then how do we know when to terminate the inner loop ?
I
We don’t, but when M ∪ S ∈ UNSAT, every new clause is redundant.
I
So, we just check every clause of F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 33
Insertion-Based MUS with Redundancy Checks
Checking redundancy in the inner loop of the algorithm:
S
I Let {¬C } denote
l∈C {¬l}.
I
If M ∪ S ∪ {¬C } ∈ UNSAT, then C is redundant ⇒ cannot be in the
computed MUS.
I
So, replace SAT(M ∪ S) with SAT(M ∪ S ∪ {¬C }).
I
If outcome is true, add C to S, otherwise remove it from F.
But, then how do we know when to terminate the inner loop ?
I
We don’t, but when M ∪ S ∈ UNSAT, every new clause is redundant.
I
So, we just check every clause of F.
I
Cheap in incremental SAT solvers, they re-use learned clauses.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 33
Insertion-Based MUS with Redundancy Checks
Input : Unsatisfiable CNF Formula F
Output: MUS M
M←∅
// MUS under-approximation
while F 6= ∅ do
// Inv: ∀C ∈ M is nec. for F ∪ M ∈ UNSAT
S←∅
// Working formula
foreach C ∈ F do
if SAT(M ∪ S ∪ {¬C }) then
// C is not redundant
S ← S ∪ {C }
Cn ← C
// Remember the last irredundant clause
M ← M ∪ {Cn }
F ← S \ {Cn }
// Assert:
return M
A. Belov
Cn is nec. for M ∪ S
// M is an MUS of F
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 34
Insertion-Based MUS with Redundancy Checks
Input : Unsatisfiable CNF Formula F
Output: MUS M
M←∅
// MUS under-approximation
while F 6= ∅ do
// Inv: ∀C ∈ M is nec. for F ∪ M ∈ UNSAT
S←∅
// Working formula
foreach C ∈ F do
if SAT(M ∪ S ∪ {¬C }) then
// C is not redundant
S ← S ∪ {C }
Cn ← C
// Remember the last irredundant clause
M ← M ∪ {Cn }
F ← S \ {Cn }
// Assert:
return M
Cn is nec. for M ∪ S
// M is an MUS of F
Same complexity as before, but in practice M ∪ F shrinks much faster.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 34
Insertion-Based MUS with Redundancy Checks
Input : Unsatisfiable CNF Formula F
Output: MUS M
M←∅
// MUS under-approximation
while F 6= ∅ do
// Inv: ∀C ∈ M is nec. for F ∪ M ∈ UNSAT
S←∅
// Working formula
foreach C ∈ F do
if SAT(M ∪ S ∪ {¬C }) then
// C is not redundant
S ← S ∪ {C }
Cn ← C
// Remember the last irredundant clause
M ← M ∪ {Cn }
F ← S \ {Cn }
// Assert:
return M
Cn is nec. for M ∪ S
// M is an MUS of F
Same complexity as before, but in practice M ∪ F shrinks much faster.
The extra SAT calls (when M ∪ S is already UNSAT) are cheap.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 34
Insertion-Based MUS with Relaxation Variables
Idea: [Marques-Silva and Lynce, ’11] instead of looking for necessary clauses explicitly,
ask the SAT solver to find them.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 35
Insertion-Based MUS with Relaxation Variables
Idea: [Marques-Silva and Lynce, ’11] instead of looking for necessary clauses explicitly,
ask the SAT solver to find them.
How ?
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 35
Insertion-Based MUS with Relaxation Variables
Idea: [Marques-Silva and Lynce, ’11] instead of looking for necessary clauses explicitly,
ask the SAT solver to find them.
How ?
1. Relax all clauses in F:
I
I
Replace each clause C ∈ F with a clause (r ∨ C ) — r is a fresh
relaxation variable.
Let F R ← {(ri ∨ Ci ) | Ci ∈ F}
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 35
Insertion-Based MUS with Relaxation Variables
Idea: [Marques-Silva and Lynce, ’11] instead of looking for necessary clauses explicitly,
ask the SAT solver to find them.
How ?
1. Relax all clauses in F:
I
I
Replace each clause C ∈ F with a clause (r ∨ C ) — r is a fresh
relaxation variable.
Let F R ← {(ri ∨ Ci ) | Ci ∈ F}
2. P
Add to F R a CNF of AtMost1 constraint on relaxation variables:
ri ri ≤ 1.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 35
Insertion-Based MUS with Relaxation Variables
Idea: [Marques-Silva and Lynce, ’11] instead of looking for necessary clauses explicitly,
ask the SAT solver to find them.
How ?
1. Relax all clauses in F:
I
I
Replace each clause C ∈ F with a clause (r ∨ C ) — r is a fresh
relaxation variable.
Let F R ← {(ri ∨ Ci ) | Ci ∈ F}
2. P
Add to F R a CNF of AtMost1 constraint on relaxation variables:
ri ri ≤ 1.
Point 1: setting all ri to 0 in F R makes F R to be equivalent to F.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 35
Insertion-Based MUS with Relaxation Variables
Idea: [Marques-Silva and Lynce, ’11] instead of looking for necessary clauses explicitly,
ask the SAT solver to find them.
How ?
1. Relax all clauses in F:
I
I
Replace each clause C ∈ F with a clause (r ∨ C ) — r is a fresh
relaxation variable.
Let F R ← {(ri ∨ Ci ) | Ci ∈ F}
2. P
Add to F R a CNF of AtMost1 constraint on relaxation variables:
ri ri ≤ 1.
Point 1: setting all ri to 0 in F R makes F R to be equivalent to F.
Point 2: setting some ri to 1 in F R makes F R to be equivalent to
F \ {Ci }.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 35
Insertion-Based MUS with Relaxation Variables
Then, the query SAT(F R ) means:
is there one (relaxed) clause (ri ∨ Ci ) such that F \ {Ci } ∈ SAT ?
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 36
Insertion-Based MUS with Relaxation Variables
Then, the query SAT(F R ) means:
is there one (relaxed) clause (ri ∨ Ci ) such that F \ {Ci } ∈ SAT ?
If the outcome is true (SAT), then look at the model τ : the clause Ci for
which τ (ri ) = 1 is necessary for F, since F ∈ UNSAT.
I
Add Ci to M (the under-approximation of an MUS);
I
Un-relax the clause.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 36
Insertion-Based MUS with Relaxation Variables
Then, the query SAT(F R ) means:
is there one (relaxed) clause (ri ∨ Ci ) such that F \ {Ci } ∈ SAT ?
If the outcome is true (SAT), then look at the model τ : the clause Ci for
which τ (ri ) = 1 is necessary for F, since F ∈ UNSAT.
I
Add Ci to M (the under-approximation of an MUS);
I
Un-relax the clause.
If the outcome is false (UNSAT), then either need to remove more than
one clause, or already have MUS.
I
If there are still relaxed clauses in F R , then remove one.
I
Otherwise, the set of un-relaxed clauses are unsatisfiable,
i.e. represents an MUS.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 36
Insertion-Based MUS with Relaxation Variables
Input : Unsatisfiable CNF Formula F
Output: MUS M
M←∅
// MUS under-approximation
F R ← {(riP
∨ Ci ) | Ci ∈ F}
// F R working formula (relaxed clauses)
T ← CNF( ri ≤ 1)
// ≤ 1 constraint
R
// Repeat while relaxed clauses exist
while F 6= ∅ do
(st, ν) ← SAT(F R ∪ T ∪ M)
if st = true then
// There is a necessary clause
ri ← TrueRelaxationVariable(ν)
else
// No necessary clauses: remove one
F R ← F R \ PickClause(F R )
// Remove some un-nec. clause
return M
A. Belov
// Final M is an MUS
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 37
Insertion-Based MUS with Relaxation Variables
Input : Unsatisfiable CNF Formula F
Output: MUS M
M←∅
// MUS under-approximation
F R ← {(riP
∨ Ci ) | Ci ∈ F}
// F R working formula (relaxed clauses)
T ← CNF( ri ≤ 1)
// ≤ 1 constraint
R
// Repeat while relaxed clauses exist
while F 6= ∅ do
(st, ν) ← SAT(F R ∪ T ∪ M)
if st = true then
// There is a necessary clause
ri ← TrueRelaxationVariable(ν)
else
// No necessary clauses: remove one
F R ← F R \ PickClause(F R )
// Remove some un-nec. clause
return M
// Final M is an MUS
Number of calls to SAT oracle: O(|F|)
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 37
Insertion-Based MUS with Relaxation Variables
Input : Unsatisfiable CNF Formula F
Output: MUS M
M←∅
// MUS under-approximation
F R ← {(riP
∨ Ci ) | Ci ∈ F}
// F R working formula (relaxed clauses)
T ← CNF( ri ≤ 1)
// ≤ 1 constraint
R
// Repeat while relaxed clauses exist
while F 6= ∅ do
(st, ν) ← SAT(F R ∪ T ∪ M)
if st = true then
// There is a necessary clause
ri ← TrueRelaxationVariable(ν)
else
// No necessary clauses: remove one
F R ← F R \ PickClause(F R )
// Remove some un-nec. clause
return M
// Final M is an MUS
Number of calls to SAT oracle: O(|F|)
But SAT calls are more difficult.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 37
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {} min = 1 max = 12
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
UNSAT
M = {}
A. Belov
mid = 6
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
UNSAT
M = {} min = 1 max = 6
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
SAT
M = {}
A. Belov
mid = 3
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
SAT
M = {} min = 4 max = 6
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
SAT
M = {}
A. Belov
mid = 5
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
UNSAT
M = {} min = max = 6
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
UNSAT
M = {C6 } min = max = 6
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
UNSAT
M = {C6 } min = 1 max = 5
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
SAT
M = {C6 }
A. Belov
mid = 3
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
SAT
M = {C6 } min = 4 max = 5
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
SAT
M = {C6 }
A. Belov
mid = 4
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
UNSAT
M = {C6 } min = max = 5
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Init: M = ∅ — MUS under-approximation; min = 1, max = |F|.
1. mid = b(min + max)/2c
2. if {C1 , . . . , Cmid } ∈ SAT , min = mid + 1, otherwise max = mid
3. when min = max, Cmin is necessary for M ∪ {C1 , . . . , Cmin } ⇒ add it
to M. Stop when M ∈ UNSAT.
C1
C2
C5
C6
C3
C4
UNSAT
M = {C6 , C5 }
A. Belov
min = max = 5
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 38
Dichotomic MUS extraction
Input : Unsatisfiable CNF Formula F = {C1 , . . . , Cm }
Output: M ∈ MUS(F)
M←∅
while SAT(M) do
hmin, maxi ← h1, |F|i
while min 6= max do
mid = b(min + max)/2c
S ← {C1 , . . . , Cmid }
if SAT(M ∪ S) then
min ← mid + 1
// MUS under-approximation
// Execute binary search
// Extract sub-sequence of F
else
max ← mid
M ← M ∪ {Cmin }
F ← {C1 . . . , Cmin−1 }
// Cmin is necessary clause
return M
A. Belov
// Final M is MUS
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 39
Dichotomic MUS extraction
Input : Unsatisfiable CNF Formula F = {C1 , . . . , Cm }
Output: M ∈ MUS(F)
M←∅
while SAT(M) do
hmin, maxi ← h1, |F|i
while min 6= max do
mid = b(min + max)/2c
S ← {C1 , . . . , Cmid }
if SAT(M ∪ S) then
min ← mid + 1
// MUS under-approximation
// Execute binary search
// Extract sub-sequence of F
else
max ← mid
M ← M ∪ {Cmin }
F ← {C1 . . . , Cmin−1 }
// Cmin is necessary clause
return M
// Final M is MUS
Number of calls to SAT oracle: O(|M| × log(|F|))
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 39
Complexity and Performance of MUS Algorithms
Algorithm
Deletion
Insertion
Insertion with redundancy checks
Insertion with relaxation variables
Dichotomic
A. Belov
Calls to SAT Solver
Θ(|F|)
O(|M| × |F |)
O(|M| × |F |)
O(|F|)
O(|M| × log(|F|))
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 40
Complexity and Performance of MUS Algorithms
Algorithm
Deletion
Insertion
Insertion with redundancy checks
Insertion with relaxation variables
Dichotomic
Calls to SAT Solver
Θ(|F|)
O(|M| × |F |)
O(|M| × |F |)
O(|F|)
O(|M| × log(|F|))
In practice, deletion-based solutions currently dominate others.
This is due to a number of optimizations.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 40
Hybrid MUS Extraction
I
[Marques-Silva&Lynce’11]
– Motivation
Several similarities between deletion-based and insertion-based
algorithms
I
I
Both identify necessary clauses.
In both, F ∪ M includes MUS
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 41
Hybrid MUS Extraction
I
– Motivation
Several similarities between deletion-based and insertion-based
algorithms
I
I
I
[Marques-Silva&Lynce’11]
Both identify necessary clauses.
In both, F ∪ M includes MUS
Key issue is how to reduce the number of SAT solver calls
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 41
Hybrid MUS Extraction
I
– Motivation
Several similarities between deletion-based and insertion-based
algorithms
I
I
I
[Marques-Silva&Lynce’11]
Both identify necessary clauses.
In both, F ∪ M includes MUS
Key issue is how to reduce the number of SAT solver calls
I
Clause-set refinement — reduces the number UNSAT outcomes.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 41
Hybrid MUS Extraction
I
– Motivation
Several similarities between deletion-based and insertion-based
algorithms
I
I
I
[Marques-Silva&Lynce’11]
Both identify necessary clauses.
In both, F ∪ M includes MUS
Key issue is how to reduce the number of SAT solver calls
I
I
Clause-set refinement — reduces the number UNSAT outcomes.
Model rotation — reduces the number SAT outcomes.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 41
Hybrid MUS Extraction
I
I
Both identify necessary clauses.
In both, F ∪ M includes MUS
Key issue is how to reduce the number of SAT solver calls
I
I
I
– Motivation
Several similarities between deletion-based and insertion-based
algorithms
I
I
[Marques-Silva&Lynce’11]
Clause-set refinement — reduces the number UNSAT outcomes.
Model rotation — reduces the number SAT outcomes.
How to make SAT solvers calls easier ?
I
Redundancy removal — simplifies SAT solver calls.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 41
Hybrid MUS Extraction
I
I
I
Clause-set refinement — reduces the number UNSAT outcomes.
Model rotation — reduces the number SAT outcomes.
How to make SAT solvers calls easier ?
I
I
Both identify necessary clauses.
In both, F ∪ M includes MUS
Key issue is how to reduce the number of SAT solver calls
I
I
– Motivation
Several similarities between deletion-based and insertion-based
algorithms
I
I
[Marques-Silva&Lynce’11]
Redundancy removal — simplifies SAT solver calls.
Hybrid MUS extraction algorithm is organized to implement these
techniques.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 41
Hybrid MUS Extraction
I
I
Both identify necessary clauses.
In both, F ∪ M includes MUS
Key issue is how to reduce the number of SAT solver calls
I
I
I
– Motivation
Several similarities between deletion-based and insertion-based
algorithms
I
I
[Marques-Silva&Lynce’11]
Clause-set refinement — reduces the number UNSAT outcomes.
Model rotation — reduces the number SAT outcomes.
How to make SAT solvers calls easier ?
I
Redundancy removal — simplifies SAT solver calls.
I
Hybrid MUS extraction algorithm is organized to implement these
techniques.
I
Optimizations take advantage of modern SAT solvers capabilities:
unsatisfiable core generation, SAT solving with assumptions.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 41
Hybrid MUS Extraction w/o optimizations
Input : Unsatisfiable CNF Formula F
Output: M ∈ MUS(F)
F0 ← F
// Working CNF formula
M←∅
// MUS under-approximation
while F 0 6= ∅ do // Inv: M ⊆ F, and ∀C ∈ M is nec. for M ∪ F 0
C ← PickClause(F 0 )
st = SAT(M ∪ (F 0 \ {C }))
// Redundancy removal
if st = true then
// If SAT, C is necessary for M ∪ F 0
M ← M ∪ {C }
RMR(F 0 ∪ M, M, τ )
// Recursive model rotation
else
F 0 ← F 0 \ {C }
// Clause-set refinement
return M
A. Belov
// M ∈ MUS(F)
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 42
Hybrid MUS Extraction w/o optimizations
Input : Unsatisfiable CNF Formula F
Output: M ∈ MUS(F)
F0 ← F
// Working CNF formula
M←∅
// MUS under-approximation
while F 0 6= ∅ do // Inv: M ⊆ F, and ∀C ∈ M is nec. for M ∪ F 0
C ← PickClause(F 0 )
st = SAT(M ∪ (F 0 \ {C }))
// Redundancy removal
if st = true then
// If SAT, C is necessary for M ∪ F 0
M ← M ∪ {C }
RMR(F 0 ∪ M, M, τ )
// Recursive model rotation
else
F 0 ← F 0 \ {C }
// Clause-set refinement
return M
// M ∈ MUS(F)
Essentially deletion-based algorithm, but with insertion-like datastructures.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 42
Optimizations: clause-set refinement/trimming
I
Fact: Every unsatisfiable formula contains at least one MUS.
I
Hence, if U is an unsatisfiable core of F, all clauses outside of U can
be removed from F.
I
Relies on the capability of SAT solvers to return unsatisfiable core.
I
Effect: remove multiple unnecessary clauses at once.
I
Applied to the working formula inside the main loop (e.g. M ∪ F 0 in
the Hybrid algorithm) — clause-set refinement .
Applied to the input formula prior to MUS extraction —
clause-set trimming .
I
I
I
I
Until fix point
A fixed number of times
Until size change is bounded
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 43
Hybrid MUS Extraction: clause-set refinement
Input : Unsatisfiable CNF Formula F
Output: M ∈ MUS(F)
F0 ← F
// Working CNF formula
M←∅
// MUS under-approximation
while F 0 6= ∅ do // Inv: M ⊆ F, and ∀C ∈ M is nec. for M ∪ F 0
C ← PickClause(F 0 )
st = SAT(M ∪ (F 0 \ {C }))
// Redundancy removal
if st = true then
// If SAT, C is necessary for M ∪ F 0
M ← M ∪ {C }
RMR(F 0 ∪ M, M, τ )
// Recursive model rotation
else
F 0 ← F 0 \ {C }
// Clause-set refinement
return M
A. Belov
// M ∈ MUS(F)
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 44
Hybrid MUS Extraction: clause-set refinement
Input : Unsatisfiable CNF Formula F
Output: M ∈ MUS(F)
F0 ← F
// Working CNF formula
M←∅
// MUS under-approximation
while F 0 6= ∅ do // Inv: M ⊆ F, and ∀C ∈ M is nec. for M ∪ F 0
C ← PickClause(F 0 )
(st, U) = SAT(M ∪ (F 0 \ {C }))
// Redundancy removal
if st = true then
// If SAT, C is necessary for M ∪ F 0
M ← M ∪ {C }
RMR(F 0 ∪ M, M, τ )
// Recursive model rotation
else
F0 ← U \ M
// Clause-set refinement
return M
A. Belov
// M ∈ MUS(F)
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 44
Impact of clause-set refinement
I
295 benchmarks from track of SAT Competition 2011.
Time limit 1800 sec, memory limit 4 GB.
I
HYB, no optimizations (#sol=132) vs refinement only (#sol=221)
I
I
I
Left: number of SAT solver calls. Right: CPU time (sec).
Color: MUS size (% of input size).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 45
Optimizations: recursive model rotation (RMR)
I
Fact: C is necessary for F iff F ∈ UNSAT and ∃τ such that
Unsat(F, τ ) = {C }. τ is a witness (of necessity) for C .
I
I
During (hybrid) MUS extraction: when M ∪ (F 0 \ {C }) ∈ SAT, the
assignment τ found by the SAT solver is a witness for C .
Witnesses are also available in other algorithms for MUS extraction.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 46
Optimizations: recursive model rotation (RMR)
I
Fact: C is necessary for F iff F ∈ UNSAT and ∃τ such that
Unsat(F, τ ) = {C }. τ is a witness (of necessity) for C .
I
I
I
During (hybrid) MUS extraction: when M ∪ (F 0 \ {C }) ∈ SAT, the
assignment τ found by the SAT solver is a witness for C .
Witnesses are also available in other algorithms for MUS extraction.
Model rotation [Marques-Silva&Lynce’11]: given a witness τ for C , try to
modify it into a witness τ 0 for another clause C 0 . How ?
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 46
Example
F = {C1 , . . . , C6 }
M — an over-approximation of some MUS of F
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 47
Example
F = {C1 , . . . , C6 }
M — an over-approximation of some MUS of F
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 47
Example
F = {C1 , . . . , C6 }
M — an over-approximation of some MUS of F
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 47
Example
F = {C1 , . . . , C6 }
M — an over-approximation of some MUS of F
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 47
Example
F = {C1 , . . . , C6 }
M — an over-approximation of some MUS of F
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 }
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 47
Example
F = {C1 , . . . , C6 }
M — an over-approximation of some MUS of F
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 47
Example
F = {C1 , . . . , C6 }
M — an over-approximation of some MUS of F
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
Flip x in τ 0 : back to τ . C3 is already known to be necessary.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 47
Example
F = {C1 , . . . , C6 }
M — an over-approximation of some MUS of F
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
Flip x in τ 0 : back to τ . C3 is already known to be necessary.
Flip y in τ 0 : τ 00 = {x, ¬y , z}
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 47
Example
F = {C1 , . . . , C6 }
M — an over-approximation of some MUS of F
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
Flip x in τ 0 : back to τ . C3 is already known to be necessary.
Flip y in τ 0 : τ 00 = {x, ¬y , z}, Unsat(M, τ 00 ) = {C2 , C6 }.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 47
Example
F = {C1 , . . . , C6 }
M — an over-approximation of some MUS of F
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
Flip x in τ 0 : back to τ . C3 is already known to be necessary.
Flip y in τ 0 : τ 00 = {x, ¬y , z}, Unsat(M, τ 00 ) = {C2 , C6 }.
Tried all variables in C4 — stop.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 47
Example
F = {C1 , . . . , C6 }
M — an over-approximation of some MUS of F
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
Flip x in τ 0 : back to τ . C3 is already known to be necessary.
Flip y in τ 0 : τ 00 = {x, ¬y , z}, Unsat(M, τ 00 ) = {C2 , C6 }.
C4 is necessary, without SAT solver call.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 47
Recursive model rotation (RMR)
Idea: when model rotation stops, backtrack to a necessary clause detected
earlier and flip another variable.
Motivation:
Fact: let τ be a witness for C in F, that is Unsat(F, τ ) = {C }. Then, the
sets Unsat(F, τ |¬x ) for x ∈ Var (C ) are pairwise disjoint.
I
By flipping different variables we are likely to detect new necessary
clauses.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 48
Example
F = {C1 , . . . , C6 }
M (the over-approximation of some MUS of F ):
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
Flip x in τ 0 : back to τ . C3 is already known to be necessary.
Flip y in τ 0 : τ 00 = {x, ¬y , z}, Unsat(M, τ 00 ) = {C2 , C6 }.
Tried all variables in C4 — /////
stop go back to C3 and τ .
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 49
Example
F = {C1 , . . . , C6 }
M (the over-approximation of some MUS of F ):
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 49
Example
F = {C1 , . . . , C6 }
M (the over-approximation of some MUS of F ):
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
Flip y in τ : τ 0 = {¬x, ¬y , z}
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 49
Example
F = {C1 , . . . , C6 }
M (the over-approximation of some MUS of F ):
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
Flip y in τ : τ 0 = {¬x, ¬y , z}, Unsat(M, τ 0 ) = {C6 } → C6 is necessary.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 49
Example
F = {C1 , . . . , C6 }
M (the over-approximation of some MUS of F ):
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
Flip y in τ : τ 0 = {¬x, ¬y , z}, Unsat(M, τ 0 ) = {C6 } → C6 is necessary.
Flip z in τ 0 : τ 00 = {¬x, ¬y , ¬z}
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 49
Example
F = {C1 , . . . , C6 }
M (the over-approximation of some MUS of F ):
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
Flip y in τ : τ 0 = {¬x, ¬y , z}, Unsat(M, τ 0 ) = {C6 } → C6 is necessary.
Flip z in τ 0 : τ 00 = {¬x, ¬y , ¬z}, Unsat(M, τ 00 ) = {C5 } → C5 is necessary.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 49
Example
F = {C1 , . . . , C6 }
M (the over-approximation of some MUS of F ):
C1 = x ∨ y
C3 = x ∨ ¬y
C5 = y ∨ z
C2 = ¬x ∨ y
C4 = ¬x ∨ ¬y
C6 = y ∨ ¬z
M \ {C3 } ∈ SAT, hence C3 is necessary.
SAT solver returns τ = {¬x, y , z}, Unsat(M, τ ) = {C3 }.
Flip x in τ : τ 0 = {x, y , z}, Unsat(M, τ 0 ) = {C4 } → C4 is necessary.
Flip y in τ : τ 0 = {¬x, ¬y , z}, Unsat(M, τ 0 ) = {C6 } → C6 is necessary.
Flip z in τ 0 : τ 00 = {¬x, ¬y , ¬z}, Unsat(M, τ 00 ) = {C5 } → C5 is necessary.
C4 , C5 , C6 are necessary, without SAT solver call.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 49
Recursive Model Rotation (RMR)
Input :
:
:
Effect:
F — an unsatisfiable CNF formula
M ⊆ F — a set of transition clauses of F
τ — a model of F \ {C } for some C ∈ M
M may contain additional transition clauses of F
C ← the single clause in Unsat(F, τ )
foreach x ∈ Var (C ) do
τ 0 ← τ |¬x
if Unsat(F, τ 0 ) = {C 0 } and C 0 ∈
/ M then
M ← M ∪ {C 0 }
RMR (F, M, τ 0 )
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 50
Recursive Model Rotation (RMR)
Input :
:
:
Effect:
F — an unsatisfiable CNF formula
M ⊆ F — a set of transition clauses of F
τ — a model of F \ {C } for some C ∈ M
M may contain additional transition clauses of F
C ← the single clause in Unsat(F, τ )
foreach x ∈ Var (C ) do
τ 0 ← τ |¬x
if Unsat(F, τ 0 ) = {C 0 } and C 0 ∈
/ M then
M ← M ∪ {C 0 }
RMR (F, M, τ 0 )
The second condition of if keeps the number of the recursive calls linear in
the size of computed MUS.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 50
Hybrid MUS Extraction: RMR
Input : Unsatisfiable CNF Formula F
Output: M ∈ MUS(F)
F0 ← F
// Working CNF formula
M←∅
// MUS under-approximation
while F 0 6= ∅ do // Inv: M ⊆ F, and ∀C ∈ M is nec. for M ∪ F 0
C ← PickClause(F 0 )
(st, U) = SAT(M ∪ (F 0 \ {C }))
// Redundancy removal
if st = true then
// If SAT, C is necessary for M ∪ F 0
M ← M ∪ {C }
RMR(F 0 ∪ M, M, τ )
// Recursive model rotation
else
F0 ← U \ M
// Clause-set refinement
return M
A. Belov
// M ∈ MUS(F)
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 51
Hybrid MUS Extraction: RMR
Input : Unsatisfiable CNF Formula F
Output: M ∈ MUS(F)
F0 ← F
// Working CNF formula
M←∅
// MUS under-approximation
while F 0 6= ∅ do // Inv: M ⊆ F, and ∀C ∈ M is nec. for M ∪ F 0
C ← PickClause(F 0 )
(st, U, τ ) = SAT(M ∪ (F 0 \ {C }))
// Redundancy removal
if st = true then
// If SAT, C is necessary for M ∪ F 0
M ← M ∪ {C }
RMR(F 0 ∪ M, M, τ )
// Recursive model rotation
else
F0 ← U \ M
// Clause-set refinement
return M
A. Belov
// M ∈ MUS(F)
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 51
Impact of recursive model rotation
I
295 benchmarks from track of SAT Competition 2011.
Time limit 1800 sec, memory limit 4 GB.
I
HYB, refinement only (#sol=221) vs refinement+RMR (#sol=254)
I
I
I
Left: number of SAT solver calls. Right: CPU time (sec).
Color: MUS size (% of input size).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 52
Optimizations: redundancy removal
I
Fact: If F ∈ UNSAT, then F \ {C } ≡ F \ {C } ∪ {¬C }.
I
I
I
S
{¬C } stands for l∈C ¬l.
During (hybrid) MUS extraction: add {¬C } to the formula before SAT
solver call.
Similar to Insertion with Redundancy Checks, however the purpose is
not to detect redundant clauses.
I
Effect: make SAT calls easier.
I
But: if F \ {C } ∪ {¬C } ∈ UNSAT and any of the literals from {¬C }
are in the unsatisfiable core U, the core cannot be safely used for
refinement (F ∩ U may be SAT).
I
Adaptive approach: if a core is “tainted”, disable redundancy removal
until the next SAT outcome.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 53
Hybrid MUS Extraction: redundancy removal
Input : Unsatisfiable CNF Formula F
Output: M ∈ MUS(F)
F0 ← F
// Working CNF formula
M←∅
// MUS under-approximation
while F 0 6= ∅ do // Inv: M ⊆ F, and ∀C ∈ M is nec. for M ∪ F 0
C ← PickClause(F 0 )
(st, U, τ ) = SAT(M ∪ (F 0 \ {C }))
// Redundancy removal
if st = true then
// If SAT, C is necessary for M ∪ F 0
M ← M ∪ {C }
RMR(F 0 ∪ M, M, τ )
// Recursive model rotation
else
F0 ← U \ M
// Clause-set refinement
return M
A. Belov
// M ∈ MUS(F)
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 54
Hybrid MUS Extraction: redundancy removal
Input : Unsatisfiable CNF Formula F
Output: M ∈ MUS(F)
F0 ← F
// Working CNF formula
M←∅
// MUS under-approximation
while F 0 6= ∅ do // Inv: M ⊆ F, and ∀C ∈ M is nec. for M ∪ F 0
C ← PickClause(F 0 )
(st, τ, U) = SAT(M ∪ (F 0 \ {C }) ∪ {¬C })
// Redundancy removal
if st = true then
// If SAT, C is necessary for M ∪ F 0
M ← M ∪ {C }
RMR(F 0 ∪ M, M, τ )
// Recursive model rotation
else if U ∩ {¬C } = ∅ then
F0 ← U \ M
// If the core is ‘‘clean’’
// Clause-set refinement
return M
A. Belov
// M ∈ MUS(F)
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 54
Impact of (adaptive) redundancy removal
I
295 benchmarks from track of SAT Competition 2011.
Time limit 1800 sec, memory limit 4 GB.
I
HYB, refinement+RMR (#sol=254) vs ref+RMR+rra (#sol=260)
I
I
I
Left: avg. time per SAT call (msec). Right: CPU time (sec).
Color: MUS size (% of input size).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 55
Performance of different algorithms: run-time
I
I
295 benchmarks used in the MUS track of SAT Competition 2011.
Time limit 1800 sec, memory limit 4 GB.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 56
Heuristics
Local-search based: clauses that are falsified often are likely to belong to
some MUS [Mazure et al, ’98].
I Sure: for any τ , Unsat(F, τ ) is an over-approximation of one or more
MCSes. And hence (by hitting sets duality) must be a hitting set of
MUS(F).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 57
Heuristics
Local-search based: clauses that are falsified often are likely to belong to
some MUS [Mazure et al, ’98].
I Sure: for any τ , Unsat(F, τ ) is an over-approximation of one or more
MCSes. And hence (by hitting sets duality) must be a hitting set of
MUS(F).
Refinement of this idea: pay attention to the critical clauses
I
I
I
[Gregoire et al, ’07]
.
C ∈ F is critical under τ if τ (C ) = 0, and for any x ∈ Var (C ), τ |¬x
will falsify a clause satisfied by τ .
Every clause in MU formula is critical for some τ (it is for the witness
assignment).
Every clause falsified in a local minima of LS algorithm is critical.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 57
Heuristics
Local-search based: clauses that are falsified often are likely to belong to
some MUS [Mazure et al, ’98].
I Sure: for any τ , Unsat(F, τ ) is an over-approximation of one or more
MCSes. And hence (by hitting sets duality) must be a hitting set of
MUS(F).
Refinement of this idea: pay attention to the critical clauses
[Gregoire et al, ’07]
.
C ∈ F is critical under τ if τ (C ) = 0, and for any x ∈ Var (C ), τ |¬x
will falsify a clause satisfied by τ .
I Every clause in MU formula is critical for some τ (it is for the witness
assignment).
I Every clause falsified in a local minima of LS algorithm is critical.
Appears to work on some instances.
I
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 57
Heuristics
Local-search based: clauses that are falsified often are likely to belong to
some MUS [Mazure et al, ’98].
I Sure: for any τ , Unsat(F, τ ) is an over-approximation of one or more
MCSes. And hence (by hitting sets duality) must be a hitting set of
MUS(F).
Refinement of this idea: pay attention to the critical clauses
[Gregoire et al, ’07]
.
C ∈ F is critical under τ if τ (C ) = 0, and for any x ∈ Var (C ), τ |¬x
will falsify a clause satisfied by τ .
I Every clause in MU formula is critical for some τ (it is for the witness
assignment).
I Every clause falsified in a local minima of LS algorithm is critical.
Appears to work on some instances.
Problem 1: SLS is painfully ineffective on practical instances.
I
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 57
Heuristics
Local-search based: clauses that are falsified often are likely to belong to
some MUS [Mazure et al, ’98].
I Sure: for any τ , Unsat(F, τ ) is an over-approximation of one or more
MCSes. And hence (by hitting sets duality) must be a hitting set of
MUS(F).
Refinement of this idea: pay attention to the critical clauses
[Gregoire et al, ’07]
.
C ∈ F is critical under τ if τ (C ) = 0, and for any x ∈ Var (C ), τ |¬x
will falsify a clause satisfied by τ .
I Every clause in MU formula is critical for some τ (it is for the witness
assignment).
I Every clause falsified in a local minima of LS algorithm is critical.
Appears to work on some instances.
Problem 1: SLS is painfully ineffective on practical instances.
Problem 2: its not quite clear whether going to necessary clauses is a good
idea in the first place.
I
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 57
Some Recent MUS Extractors
MUSer2 [A. Belov and J. Marques-Silva] — many different algorithms (deletion,
insertion, dichotomic, and many variations), all optimizations are
integrated, can use different SAT solvers.
Haifa-MUC [V. Ryvchin] — deletion-based algorithm that manipulates
resolution proofs, built on top of minisat-2.2.
MoUsSaka
picomus
SAT4J
[S. Kottler]
[A. Biere]
[D. Le Berre]
A. Belov
— deletion-based, uses activity-based heuristic.
— deletion-based, on top of picosat.
— a number of different algorithms, Java-based.
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 58
Applications: Formal Equivalence Checking (FEC)
I
FEC is a technique for formally proving the equivalence of two design
models (e.g. RTL “golden” model vs the implementation).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 59
Applications: Formal Equivalence Checking (FEC)
I
FEC is a technique for formally proving the equivalence of two design
models (e.g. RTL “golden” model vs the implementation).
I
FEC has to be performed compositionally: separate the models into
small parts ( slices ), and the equivalence between the slices with
BDD or SAT-based FEC engine.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 59
Applications: Formal Equivalence Checking (FEC)
I
FEC is a technique for formally proving the equivalence of two design
models (e.g. RTL “golden” model vs the implementation).
I
FEC has to be performed compositionally: separate the models into
small parts ( slices ), and the equivalence between the slices with
BDD or SAT-based FEC engine.
I
Note: any slice in isolation can have more behaviours than when it is
part of the complete model (e.g. some combinations of inputs are not
possible).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 59
Applications: Formal Equivalence Checking (FEC)
I
FEC is a technique for formally proving the equivalence of two design
models (e.g. RTL “golden” model vs the implementation).
I
FEC has to be performed compositionally: separate the models into
small parts ( slices ), and the equivalence between the slices with
BDD or SAT-based FEC engine.
I
Note: any slice in isolation can have more behaviours than when it is
part of the complete model (e.g. some combinations of inputs are not
possible).
I
FEC is performed under the environmental assumptions which mimic
the essential behaviour of the complete model with respect to the
slice.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 59
Applications: Formal Equivalence Checking (FEC)
SAT-based FEC
I
Build a CNF formula F that captures the logic of the two slices and
the environmental assumptions.
I
Property: F ∈ UNSAT if and only if the slices, under the given
assumptions, are functionally equivalent.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 60
Applications: Formal Equivalence Checking (FEC)
SAT-based FEC
I
Build a CNF formula F that captures the logic of the two slices and
the environmental assumptions.
I
Property: F ∈ UNSAT if and only if the slices, under the given
assumptions, are functionally equivalent.
But now, if F ∈ UNSAT, the assumptions need to be confirmed — the
designer must prove that the assumptions are guaranteed by the model
(assume-guarantee reasoning).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 60
Applications: Formal Equivalence Checking (FEC)
SAT-based FEC
I
Build a CNF formula F that captures the logic of the two slices and
the environmental assumptions.
I
Property: F ∈ UNSAT if and only if the slices, under the given
assumptions, are functionally equivalent.
But now, if F ∈ UNSAT, the assumptions need to be confirmed — the
designer must prove that the assumptions are guaranteed by the model
(assume-guarantee reasoning).
Thus, it is critical to reduce the number of assumptions.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 60
Applications: Formal Equivalence Checking (FEC)
SAT-based FEC
I
Build a CNF formula F that captures the logic of the two slices and
the environmental assumptions.
I
Property: F ∈ UNSAT if and only if the slices, under the given
assumptions, are functionally equivalent.
But now, if F ∈ UNSAT, the assumptions need to be confirmed — the
designer must prove that the assumptions are guaranteed by the model
(assume-guarantee reasoning).
Thus, it is critical to reduce the number of assumptions.
MUSes provide an effective and practically feasible way to reduce the
number of assumptions; critical impact on the efficiency of the design flow.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 60
Applications: Proof-based Abstraction Refinement (PBA)
An approach to model checking of large industrial hardware designs.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 61
Applications: Proof-based Abstraction Refinement (PBA)
An approach to model checking of large industrial hardware designs.
I
Run a Bounded Model Checking (BMC) run for some small depth k.
I
i.e. construct a propositional formula BMC (k) such that it is UNSAT
if and only if no execution of the FSM (representing the design) with
≤ k steps violates the correctness property.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 61
Applications: Proof-based Abstraction Refinement (PBA)
An approach to model checking of large industrial hardware designs.
I
Run a Bounded Model Checking (BMC) run for some small depth k.
I
I
i.e. construct a propositional formula BMC (k) such that it is UNSAT
if and only if no execution of the FSM (representing the design) with
≤ k steps violates the correctness property.
If BMC (k) ∈ SAT — the property is violated, and we are done.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 61
Applications: Proof-based Abstraction Refinement (PBA)
An approach to model checking of large industrial hardware designs.
I
Run a Bounded Model Checking (BMC) run for some small depth k.
I
i.e. construct a propositional formula BMC (k) such that it is UNSAT
if and only if no execution of the FSM (representing the design) with
≤ k steps violates the correctness property.
I
If BMC (k) ∈ SAT — the property is violated, and we are done.
I
If BMC (k) ∈ UNSAT, use an unsatisfiable core U ⊆ BMC (k) to
construct a localization abstraction of the design:
I
I
let LC (L, k) be the set of clauses in the BMC (k) that represent the
input-output relationship of some latch L.
if U ∩ LC (L, k) = ∅, drop L from the design (i.e. replace it by primary
input)
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 61
Applications: Proof-based Abstraction Refinement (PBA)
An approach to model checking of large industrial hardware designs.
I
Run a Bounded Model Checking (BMC) run for some small depth k.
I
i.e. construct a propositional formula BMC (k) such that it is UNSAT
if and only if no execution of the FSM (representing the design) with
≤ k steps violates the correctness property.
I
If BMC (k) ∈ SAT — the property is violated, and we are done.
I
If BMC (k) ∈ UNSAT, use an unsatisfiable core U ⊆ BMC (k) to
construct a localization abstraction of the design:
I
I
let LC (L, k) be the set of clauses in the BMC (k) that represent the
input-output relationship of some latch L.
if U ∩ LC (L, k) = ∅, drop L from the design (i.e. replace it by primary
input)
Note: the abstraction has more behaviours, but no bad runs of length ≤ k.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 61
Applications: Proof-based Abstraction Refinement (PBA)
Note: Each removed latch reduces the size of the state space by half
Note: Abstractions typically contain a small fraction of the latches in the
concrete designs ⇒ easier to model-check.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 62
Applications: Proof-based Abstraction Refinement (PBA)
Note: Each removed latch reduces the size of the state space by half
Note: Abstractions typically contain a small fraction of the latches in the
concrete designs ⇒ easier to model-check.
Now, run a complete model checker (e.g. BDD-based, IC3, etc.):
I
If the property holds on the abstraction, then it holds in the concrete
design. Done.
I
If the property is violated, the length of the counterexample can be
used for the next BMC run.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 62
Applications: Proof-based Abstraction Refinement (PBA)
Note: Each removed latch reduces the size of the state space by half
Note: Abstractions typically contain a small fraction of the latches in the
concrete designs ⇒ easier to model-check.
Now, run a complete model checker (e.g. BDD-based, IC3, etc.):
I
If the property holds on the abstraction, then it holds in the concrete
design. Done.
I
If the property is violated, the length of the counterexample can be
used for the next BMC run.
Extremely beneficial to abstract away as many latches as possible ⇒
smaller cores are better ⇒ MUSes.
Note: Recent evaluation of the effectiveness of MUSes in this setting is to appear at
DATE-13.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 62
Open Problems
Heuristics
I
Current work is very scarce.
I
In light of recently developed optimizations, its not even clear what
kind of heuristics is needed (e.g. maybe its better to go for
unnecessary clauses, to take advantage of clause-set refinement).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 63
Open Problems
Heuristics
I
Current work is very scarce.
I
In light of recently developed optimizations, its not even clear what
kind of heuristics is needed (e.g. maybe its better to go for
unnecessary clauses, to take advantage of clause-set refinement).
Scalability
I
New algorithms, new optimization techniques.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 63
Open Problems
Heuristics
I
Current work is very scarce.
I
In light of recently developed optimizations, its not even clear what
kind of heuristics is needed (e.g. maybe its better to go for
unnecessary clauses, to take advantage of clause-set refinement).
Scalability
I
New algorithms, new optimization techniques.
Applications
I
New applications; typically pose new types of problems (extensions of
the “standard” MUS computation – more on this tomorrow).
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 63
Further Reading
Recent surverys on algorithms
I J. Marques-Silva. Minimal Unsatisfiability: models, algorithms and appplications (Invited
Paper). In Proc. of ISMVL 2010.
I E. Gregoire, B. Mazure, and C. Piette. On approaches to explaining infeasibility of sets of
Boolean clauses. In Proc. ICTAI 2008.
Entry point for theory
I H.K. Büning, O. Kullmann: Minimal unsatisfiability and autarkies. Handbook of
Satisfiability, 2009.
Advanced techniques
I A. Belov, I. Lynce, J. Marques-Silva: Towards efficient MUS extraction. AI Comm., 2012.
I A. Nadel. Boosting minimal unsatisfiable core extraction. In Proc. of FMCAD 2010.
I V. Ryvchin, O. Strichman: Faster extraction of high-level minimal unsatisfiable cores. In
Proc. of SAT 2011.
I S. Wieringa: Understanding, improving and parallelizing MUS finding using model
rotation. In Proc. of CP 2012.
A. Belov
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 64
References
[Aharoni and Linial, ’86]
[Birnbaum and Lozinskii, ’03]
[Cook, ’71]
[Davidov et al, ’98]
[Davis et al, ’62]
[Eén and Sörensson, ’03]
[Fleischner, Kullmann and Szeider, ’02]
[Gregoire et al, ’07]
[Kleine Buning, ’00]
[Kullmann et al, ’06]
[Liberatore, 05]
[Van Maaren and Wieringa, ’08]
[Marques-Silva and Lynce, ’11]
[Marques Silva and Sakallah, ’96]
[Mazure et al, ’98]
[Papadimitriou and Wolfe, ’88]
[Reiter, ’87]
A. Belov
R. Aharoni and N. Linial. Minimal non-two-colorable hypergraphs and minimal
unsatisfiable formulas”. J. Combinatorial Theory, 1986.
E. Birnbaum and E. Lozinskii. Consistent subsets of inconsistent systems: structure and behaviour. JETAI, 2003.
S. Cook. The complexity of theorem proving procedures. Proc. of the 3rd Annual
ACM Symposium on Theory of Computing, 1971.
G. Davydov, I. Davidova, and H. K. Buning. An efficient algorithm for the minimal
unsatisfiability problem for a subclass of CNF. Ann. of Math. and A.I., 1998.
M. Davis, G. Logemann, and D. Loveland. A machine program for theoremproving. Comm. of the ACM, 1962.
N. Eén and N. Sörensson. Temporal induction by incremental SAT solving. Electr.
Notes Theor. Comput. Sci., 2003.
H. Fleischner, O. Kullmann, S. Szeider. Polynomial time recognition for minimal
unsatisfiable formulas with fixed clause-variable difference. Th. Comp. Sci, 2002.
E. Gregoire, B. Mazure, and C. Piette. Local-search Extraction of MUSes. Constraints, vol. 12, 2007.
H. K. Buning. On subclasses of minimal unsatisfiable formulas. Disc. Applied
Math., 2000.
O. Kullmann, I. Lynce, and J. Marques-Silva. Categorisation of clauses in conjunctive normal forms : minimally unsatisfiable sub-clause-sets and the lean kernel.
In Proc. of SAT-2006, 2006.
Redundancy in logic I : CNF propositional formulae. AI, 2005.
H. Van Maaren and S. Wieringa. Finding guaranteed MUSes fast. Proc. of SAT
2008, 2008.
J. Marques-Silva and I. Lynce. On improving MUS extraction algorithms. Proc.
of SAT 2011, 2011.
J. Marques-Silva and K. A. Sakallah. GRASP - a new search algorithm for satisfiability. Proc. of ICCAD 1996, 1996
Mazure, B., Saïs, L., and Gregoire, E.Boosting complete techniques thanks to
local search. Ann. Math. Artif. Intell. 22, 1998
The complexity of facets resolved. J. Comput. Syst. Sci., 1988.
R. Reiter. A theory of dignosis from first principles. AI, 1987.
MU and MUSes: Theory, Algorithms and Applications
EPCL Training Camp, 2012
# 65
© Copyright 2026 Paperzz