1

Suppose I have a CNF expression with variables (a,b,c,d,e,f,g). How would I go about using a SAT solver to find an assignment for (d,e,f) given that {a,b,c,g} = {1,0,0,1} and {a,b,c,g} = {1,1,1,1}? If it was one assumption, calling a sat solver to find assignments for {d,e,f} would be straight-forward (E.g., by adding unit clauses to the CNF). But what if I have multiple assumptions? Is this possible?

red_house
  • 63
  • 3
  • 1
    Can you explain what you mean by this, so far it just looks trivially unsatisfiable to me (eg b cannot be both 0 and 1) – harold Feb 27 '17 at 22:10
  • Assume a,b,c,d = (1,0,0,1) and a,b,c,d = (1,1,1,1) are two 'observations'. How can I assign values to (d,e,f) such that these observations are consistent? – red_house Feb 27 '17 at 22:28
  • That edit made it confusing again. Does this mean anything more complicated than "allow abcg to be either 1001 or 1111, whichever works to get some satisfying model"? Or do the same def have to work for all abcg vectors in the set? – harold Feb 27 '17 at 22:55
  • Sorry for the confusion. I definitely didn't mean the first one (in that case, you could apply them as blocking clauses and you're done). I mean that there are two values that (a,b,c,d) can take: (1,0,0,1) and (1,1,1,1). Of course it could take on the other (2^4 - 2) values too. But what can I assign to (d,e,f) so that, at the very least, those two values of (a,b,c,d) are satisfied? – red_house Feb 27 '17 at 23:03
  • But then you could just make copies of abc(d?g?) (and all the clauses that depend on them), and force them with unit clauses again, one assignment per set of copies. OK that makes the CNF expression pretty big.. anyway is that what you mean – harold Feb 27 '17 at 23:12
  • Sorry it should have been (a,b,c,g). What do you mean by 'making copies'? Do you mean in the same CNF expression? I can't have two unit clauses for the same variables in the same CNF expression though. If you mean that I make two separate CNFs (each with its own unit clause), how would I ensure the values for (d,e,f) would satisfy both those CNFs simultaneously? – red_house Feb 27 '17 at 23:52
  • I meant copies as in new versions of those variables, clauses copied and updated with the new set of variables. Not def though, they should just be shared. But new versions of abcg (and auxiliary variables if you have any) to allow them to have different values simultaneously. Of course the constraints on them have the same structure as on the original abcg, so I got lazy in the description and just called it a copy.. – harold Feb 27 '17 at 23:57

2 Answers2

3

Here are the steps for what (I think) harold was trying to describe to you. You have some CNF formula F over the variables a, b, c, d, e, f and g.

  1. Duplicate the formula, calling the duplicate G.
  2. In G, replace the variable a with aa, b with bb, c with cc, and g with gg.
  3. Add unit clauses to F so that (a,b,c,g) = (1,0,0,1).
  4. Add unit clauses to G so that (aa,bb,cc,gg) = (1,1,1,1).
  5. Concatenate the formulas F and G and feed the result into the SAT solver.

The solver will find a satisfying assignment consistent with both (a,b,c,g)'s and (aa,bb,cc,gg)'s preset values.

Kyle Jones
  • 5,492
  • 1
  • 21
  • 30
0

It is not quite clear if you want a practical answer or an interesting theoretical answer. I will go after practical.

For each set of assumptions, call a sat solver that supports solve with assumptions on that set of assumptions (example). Do this sequentially on the same solver instance.

Pros:

  • You do not mix satisfiability of mutually exclusive sets of assumptions. If set of assumptions A is sat for a formula F and the other set A' is unsat for F, each call to the solver tells you if those assumptions are sat/unsat.
  • Learned clauses from the first call may stick around for the second call. The intermediate learned clauses talk about the same variables. (Note: If you have a disjoint formula F & G where F is over variables X, G is over variables Y and X and Y share no variables, resolution -- the inference rule used in CDCL -- cannot derive clauses mixing F and G. There is no obvious gain of mixing the two together instead of splitting them apart unless one instance is much easier to prove unsat and stop early.)

Cons:

  • If instance A is hard to solve in practice but A' is trivial, you might get stuck on A.
  • It is not parallel so if you have way more instances than two that you want to solve ASAP you'll need additional mechanisms.

I know this is a bit of an obvious answer, but it is worth trying. If that fails, you can try doing fancier things like solving w.r.t. the assumptions A union A', and only if that is unsat solving falling back on this strategy of A then A'. This won't help for your example as (a,b,c,g) = (1,0,0,1) and (a,b,c,g) = (1,1,1,1) are mutually exclusive.

Tim
  • 1,008
  • 5
  • 13