Questions tagged [sat]

In computer science, the Boolean Satisfiability Problem (or SAT) is the problem of determining if there exists an interpretation that satisfies a given boolean formula.

Mainly from Wikipedia:

In computer science, the Boolean Satisfiability Problem (sometimes called Propositional Satisfiability Problem and abbreviated as satisfiability or SAT) is the problem of determining if there exists an interpretation that satisfies a given Boolean formula.

In other words, it asks whether the variables of a given Boolean formula can be consistently replaced by the values true or false in such a way that the formula evaluates to true.

If this is the case, the formula is called satisfiable. On the other hand, if no such assignment exists, the function expressed by the formula is identically false for all possible variable assignments and the formula is unsatisfiable.

  • For example, the formula "a AND NOT b" is satisfiable because one can find the values a = TRUE and b = FALSE, which make "a AND NOT b" TRUE.

  • In contrast, "a AND NOT a" is unsatisfiable.

SAT is one of the first problems that was proven to be NP-complete. This means that all problems in the complexity class NP, which includes a wide range of natural decision and optimization problems, are in a technical sense equally difficult to solve as SAT.

There is no known algorithm that efficiently solves SAT, and it is generally believed that no such algorithm exists; yet this belief has not been proven mathematically, and resolving the question whether SAT has an efficient algorithm is equivalent to the P versus NP problem, which is the most famous open problem in the theory of computing.

Despite the fact that no algorithms are known that solve SAT efficiently, correctly, and for all possible input instances, many instances of SAT that occur in practice (such as in artificial intelligence, circuit design and automatic theorem proving) can actually be solved rather efficiently using heuristical SAT-solvers.

Such algorithms are not believed to be efficient on all SAT instances, but experimentally these algorithms tend to work well for many practical applications.

Nowadays, the research on the SAT theory continues, if you want to keep up to date with this research, feel free to visit: http://www.satlive.org/.

289 questions
1
vote
1 answer

Prolog output should match the input of the sat solver

Another user created a very useful code for me, which i will be using to create random k-cnf formulas. I found a good sat-solver online which i want to use to check the satisfiability of the k-cnf formula. There is a problem though. The output is…
user12417778
1
vote
1 answer

Why is unit-propagation performed first in DPLL algorithm?

Why is the pure-literal rule performed after the unit propagation and not before?
Ronald
  • 157
  • 6
1
vote
1 answer

Generating DIMACS CNF file using bc2cnf is missing AND

I tried using the bc2cnf tool to generate the DIMACS CNF file of a boolean equation. The input file contains the equation of an AND gate as shown below : BC1.1 f := A & B; ASSIGN f; Command used: ./bc2cnf -v inp.txt opt.txt Content in the output…
1
vote
1 answer

How to use soft constraints in Z3-Python to express 'abstract' biases in SAT search: such as 'I prefer half of the literals to be true and half false'

I previously asked in How to bias Z3's (Python) SAT solving towards a criteria, such as 'preferring' to have more negated literals, whether there was a way in Z3 (Python) to 'bias' the SAT search towards a 'criteria'? In that post, we learnt 'simple…
Theo Deep
  • 666
  • 4
  • 15
1
vote
0 answers

Is there a way to get a random solution from pycosat every time I run it?

I am given a completely blank sudoku and I want that it should produce fairly different answers when executed. Currently I am choosing a random integer say( x ) and iterate over solutions till I reach x:- i=0 for lists in…
1
vote
1 answer

Z3-Python as SAT solver does not give right results

I am trying to use Z3 (in Python) as a SAT solver, but the results are unexpected. First, imagine I want to get a model for the following formula: from z3 import * c_0 = Bool('c_0') c_1 = Bool('c_1') c_2 = Bool('c_2') c_3 = Bool('c_3') sss =…
Theo Deep
  • 666
  • 4
  • 15
1
vote
1 answer

Convert complex logic expression to CNF (without exponential blowup)

In my Boolean logic problem, I have a set of variables (encoded as integers) over 10,000 in length (from 10 to 100k). Each variable has its set of constraints, i.e. other variables from the same set contradicting it. Contradictions are mutual,…
s0mbre
  • 361
  • 2
  • 14
1
vote
0 answers

Generate CNF from Boolean expression

Specific problem I have a problem that I want to solve using a SAT solver in Python (e.g. pycosat or cryptominisat). A SAT solver accepts problem input as a list a CNF expression comprised of individual Boolean clauses. For my specific task, the…
s0mbre
  • 361
  • 2
  • 14
1
vote
1 answer

Converting Undirected Graph to CNF SAT for 3-Coloring

Now, in order to translate this into a CNF SAT problem, I understand that: Each node must have atleast one color. Each node must have at most one color. Connected nodes cannot have the same color. But I can't move ahead as I am unable to…
Silent
  • 45
  • 5
1
vote
1 answer

convert logical gates to cnf python

i have an object-oriented logical circuit that's created from gate objects (similar to the second example here: http://www.openbookproject.net/books/pythonds/Introduction/ObjectOrientedProgramminginPythonDefiningClasses.html ) I need to represent…
1
vote
0 answers

Incomplete MaxSAT in z3

I have a problem where I am considering to use incomplete MaxSAT algorithms. Are there any incomplete MaxSMT solvers implemented in z3?
1
vote
2 answers

how to use format in python iteratively?

im currently writing a program which requires me to have a logical formula and then try every combination of True and False on that logical formula. Currently I have some code which creates a logical formula in the form : ({1} or not {2} or not {5}…
userj
  • 158
  • 11
1
vote
1 answer

What is Z3Py FreshBool() function?

What is the difference between z3.Bool() and z3.FreshBool() functions? My code in z3 on python fails when I use Bool() (the solver returns unsat when it shouldn't), but works fine when I use FreshBool() (Desired behaviour is observed). I cannot give…
anon
  • 15
  • 4
1
vote
1 answer

Efficiently create structured binary decision diagram

I'm trying to create a BDD with a particular structure. I have a 1D sequence of boolean variables x_i, e.g. x_1, x_2, x_3, x_4, x_5. My condition is satisfied if there are no isolated ones or zeros (except possibly at the edges). I have implemented…
1
vote
1 answer

How do you define the At-Most-K SAT constraint in OrTools

The at-most-k constraint, given a number of tasks and users, where a given number of tasks must be completed by at most k number of users, each task is only assigned to one user, a user can have multiple tasks. the goal is to find which tasks are…
x12
  • 11
  • 2