Computing unsat cores of boolean and smt formulas
Download
1 / 28

Computing Unsat Cores Of Boolean And SMT Formulas - PowerPoint PPT Presentation


  • 78 Views
  • Uploaded on

Lecturer: Bat-Chen Golden. Computing Unsat Cores Of Boolean And SMT Formulas. Algorithms for Computing Minimal Unsatisfiable Subsets of Constraints Mark H. Liffiton and Karem A. Sakallah. Computing Small Unsatisfiable Cores in Satisfiability Modulo Theories

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Computing Unsat Cores Of Boolean And SMT Formulas' - malise


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Computing unsat cores of boolean and smt formulas

Lecturer: Bat-Chen Golden

Computing Unsat Cores Of Boolean And SMT Formulas

Algorithms for Computing Minimal Unsatisfiable Subsets of Constraints

Mark H. Liffiton and Karem A. Sakallah

Computing Small Unsatisfiable Cores

in Satisfiability Modulo Theories

Alessandro Cimatti, Alberto Griggioand Roberto Sebastiani


Example
Example

  • SAT/UNSAT?

  • Why?


Unsat cores
Unsat cores

  • Given an unsatisfiable CNF formula which consists of the set of clauses C, an “Unsat core” of is a subset of clauses which is unstasifiable.

  • For the formula from our example

    The subsets we found are Unsat cores of :

    {}, {}, {}

    But also the following sets are Unsatcores of :

    {}, {}


Minimal u nsat cores
Minimal unsat cores

  • Given an unsatisfiable CNF formula which consists of the set of clauses C, a “Minimal Unsat core” or “Minimal UnsatSubset” (MUS) of is a subset of clauses which holds:

  • is unsatisfiable

  • is satisfiable

    The subsets we found are minimal Unsat cores of :

    {}, {}, {}

    While the following sets are not minimal Unsatcores of :

    {} ( is redundant),

    {} (many clauses are redundant)


Our plan
Our plan

  • In the first part of this lecture we will get to know a sound and complete algorithm for computing all MUSesof an unsatisfiable CNF formula .

  • The algorithm is taken from the paper “Algorithms for Computing Minimal Unsatisfiable Subsets of Constraints” by Mark H. Liffiton and Karem A. Sakallah (2007).

  • They have implemented the algorithm in a tool called “CAMUS”.

  • In the second part of the lecture we will see how this algorithm can be used to find unsatisfiable subsets of constraints in a SMT formula


Example1
Example

  • Let’s “correct” : Remove clauses from it until it becomes satisfiable


Correcting subsets
Correcting subsets

  • Given an unsatisfiable CNF formula which consists of the set of clauses C, a “Correcting subset” of is a subset of clauses for which is satisfiable.

  • Given an unsatisfiable CNF formula which consists of the set of clauses C, a “Minimalcorrecting subset” (MCS) of is a subset of clauses for which:

  • is satisfiable.

  • is unsatisfiable.

  • The sets we found before are all the MCSesof 𝜑


Connection between muses and mcses
Connection between MUSes and MCSes


Connection between muses and mcses1
Connection between MUSes and MCSes


Hitting sets
Hitting sets

{

{

{

{

We are interested in finding minimal hitting sets, where minimal means removing any element from the set makes it no longer a hitting set.

Notice that we are not interested in finding a minimum hitting set (a minimal hitting set with the smallest possible number of elements), which is the famous NP-Hard problem.


Connection between muses and mcses2
Connection between MUSes and MCSes


Our approach
Our approach

  • We will find all MUSes of in two independent phases:

  • Phase 1: Find all MCSes of

  • Phase 2: Compute all minimal hitting sets of the group of MCSes found in the previous phase.

  • Why is this better than directly computing all MUSes?

  • “In practice, it is easier to find satisfiable subsets of constraints than unsatisfiable subsets. Thus, finding MCSes (equivalent to finding their complementary subsets) is easier than finding MUSes directly. This follows from the relative simplicity of problems in NP (e.g., Sat) as compared to those in Co-NP (e.g., Unsat).”

  • Two phases: Advantage: independency. Disadvantage: if phase 1 fails – the whole process fails.


Phase 1 find all mcses
Phase 1: find all MCSes

  • What is the naïve way to find all correcting sets (leaving minimality a side)?

  • Remove all possible subsets one by one and see if the remaining set is satisfiable.

  • Now, how do we enforce minimality?

  • By removing subsets in increasing size and making sure we don’t add a superset of a previous found MCS.

  • And how do we implement this?


Phase 1 find all mcses1
Phase 1: find all MCSes

  • Our goal will be to be able to construct from for any given another CNF formula, , which intuitively means “ after removing at most k clauses”.

  • In other words, will be satisfiable iff is satisfiable for some set of clauses which holds ||.


Phase 1 find all mcses2
Phase 1: find all MCSes

  • First, we will construct from , by adding “Clause-Selector” Variables:

  • Then, we will add an “AtMost” constraint

    This constraint means “we don’t permit an assignment which gives true to more than k literals from this group”



Phase 2 find all minimal hitting sets of the mcses
Phase 2: Find all minimal hitting sets of the MCSes

  • What is the naïve way to find a (not all) hitting set of all MCSes (leaving minimality a side)?

  • Randomly pick a clause from an MCS which haven’t been covered yet.

  • Now, how do we enforce minimality?

  • After picking a random clause we make sure it will not be redundant by picking an MCS it appears in and removing the other clauses in it from all the other MCSes.

  • For this process to always produce a valid hitting set we need to make sure no MCS includes another.

  • And how do we implement this?




Phase 2 find all minimal hitting sets of the mcses3
Phase 2: Find all minimal hitting sets of the MCSes

  • What should change if we want to find allhitting set of the MCSes?

  • Instead of making a random choice of clause and MCS containing it we will use backtracking to go over all the possible choices.

  • Note: this algorithm can produce duplicate outputs, for example:

    for the input MCSes{{C1,C2}, {C1,C3}},

    The output {C1} will be produced twice.

  • An optimization can be made to prevent this.



Conclusion of first article
Conclusion of first article

  • Our mission was to find all MUSes of an unsatisfiable CNF formula .

  • We used the connection between MUSes and MCSes to construct a two-phase algorithm:

  • First phase – we computed all MCSes directly, using “Clause-Selector” Variables and “AtMost” constraints.

  • Second phase – we computed all minimal hitting sets of the MCSes (which are the wanted MUSes) using a backtracking algorithm.


Second article
Second article

  • From now on we will discuss the article “A Simple and Flexible Way of Computing Small Unsatisfiable Cores in SAT Modulo Theories” by Alessandro Cimatti, Alberto Griggio, and Roberto Sebastiani.

  • As its name implies, the article presents an algorithm for computing an unsat core for an SMT formula, based on a given algorithm for computing unsat cores for boolean formulas (such as the one we just saw).


Example over equality logic
Example over equality logic

  • Reminder- the process of an SMT solver is more or less the following:


Example over equality logic1
Example over equality logic

  • Reminder- the process of an SMT solver is more or less the following:

  • Generally there could be more iterations where the sat solver returns “sat” and the T-solver returns “unsat”, and each such iteration adds a “learning clause”


The basic concepts behind the algorithm
The basic concepts behind the algorithm

  • The algorithm will be based on the following two observations:

  • The final Boolean formula created by this process is always unsatisfiable

  • Otherwise we could have continued (we are assuming the formula is T-unsat, otherwise there is no unsat core to find).

  • The “learning clauses” returned by the T-solver are always T-tautologies (satisfied by all possible assignments)

  • The T-solver returns “false” only when a contradiction is found. The opposite of a contradiction is a tautology.


The algorithm
The algorithm

(UNSAT by observation 1)

“Unabstract”

Remove “learning clauses”, they are tautologies (by observation 2)



ad