Problem SAT
A problem SAT is a Problème of decision aiming at determining if there exists a valuation then on a whole of propositional variables such as a given propositional formula either logically true (in short, it is to know if a Boolean equation has a solution). This problem is very important in Théorie of complexity and has many applications in traditional planning, Model checking , diagnosis, etc
Definitions
Clause and form clausale
A clause is a proposal of the form where the are literal (positive or negative). A clause of order N is thus a disjunction of with more N literal. A formula of propositional calculation is in conjunctive normal form (or clausale forms) order N if it is a conjunction of clauses of order N.
Problem SAT
That is to say a logical formula under conjunctive normal form (CNF). This CNF is satisfaisable if it is possible to associate a Boolean logical value with each one of its variables in such a way that this formula is logically true. To determine if a formula under CNF of order N is satisfaisable is called problem of satisfaisability or problem SAT of order N (n-SAT). If the propositional formula is not under CNF, it is necessary to standardize it so that the problem is qualified SAT. Generally, the answer to this question also provides an example of assignment of the variables such as the CNF is logically true.; Exemple
- Is the whole of variables and .
- is satisfaisable since, if one poses , then is logically true .
- On the other hand, is not satisfaisable !
- is satisfaisable since, if one poses , then is logically true .
Complexity and restrictions
Np-complétude
Problem SAT is a Np-complete problem according to the Théorème of Cook.
The problem 3-SAT is him also Np-complete. To show it, it is enough to prove that problem SAT is polynomialement reducible with 3-SAT.
; Proof
- One notices that any clause can be put in the form:
- Donc problem SAT is polynomialement reducible with 3-SAT. It is concluded that 3-SAT is Np-complete.
Let us note that all the problems n-SAT with N equal to or higher than 3 are problems Np-complete S.
; Example
- Are of the propositional variables.
- Déterminer if the expression is satisfaisable is a problem 3-SAT.
- Any algorithm able to solve a problem 3-SAT (even “the best”) can in certain cases duty test an exponential number of combinations of assignments in the value .
- Déterminer if the expression is satisfaisable is a problem 3-SAT.
The problem 2-SAT
2-SAT, according to the definition, seeks to determine the satisfaisability of a formula of propositional calculation in the conjunctive normal form of order 2. This problem is not Np-complete but of class . There exist several polynomial algorithms to solve the problem 2-SAT.
; Example
- Let us interest more particularly in that presented by Even, Itai and Shamir in 1976 in the article “One the complexity off timetable and multicommodity fl ow problems” published in SIAM Journal off Computing, pages 691 to 703.
-
a clause of order two is equivalent to the implications . To solve 2-SAT one builds the graph directed G = (S, A) dual (called graph 2-SAT) according to the following rules. The tops S correspond to the various propositional variables (or their negations) of the formula considered. One then associates with each clause the two arcs and to form the unit E.
-
F is satisfaisable if and only so for each propositional variable of F, the tops and of the graph 2-SAT are in two distinct strongly related components. The algorithm of Tarjan makes it possible to calculate the strongly related components of a graph directed in , therefore 2-SAT is well of class .
Another interesting result, obtained by Papadimitriou in 1994, relates to complexity in term of space of the problem 2-SAT. This one is complete for the class of complexity NL.
Algorithms of SAT
Most obvious of the methods to solve a problem SAT the Truth table problem is to traverse, but complexity is then exponential compared to the number of variables.
Systematic method
To prove the satisfaisability of the CNF , it is enough to choose a variable and to prove recursively the satisfaisability of or . The procedure is easier recursively since with or can be often simplified. The recursive call builds a binary Tree thus of research.Generally, there exists with each nœ ud of the unit clauses (the CNF is form ), which make it possible to strongly reduce the space of research.
; Example
- Let us consider the CNF:
- .
- the second clause () is unit and makes it possible to obtain . One can replace the values of in this CNF. That gives:
- .
- Again, one has a unit clause, and one obtains . Then, by propagation , one obtains .
In this example, one found the values of the three variables without same developing the tree of research. In a general way, one can strongly reduce the space of research. In addition, if a variable always positively appears in the CNF , then one can pose since is satisfaisable if and only if is satisfaisable (and the same if the variable appears negatively). Thus, in the preceding example, appears only negatively and assignement the can be carried out. Let us notice that this assignement allows to accelerate the discovery of a solution but that solutions could exist by carrying out the assignement contrary one. The algorithm DPLL (Davis, Putnam, Davis, Logemann, Loveland) is based on these ideas.
The choice of the variable to be developed is very important for the performances of algorithms SAT. One generally chooses the variables which generally appear, if possible in clauses of size 2.
Training of clauses
The principle of the training of clauses is the suivant : when a conflict appears at the time of research, i.e. when assignement partial is shown non-cohesive with the unit of the clauses, one can isolate a subset from these assignements and a subset of these clauses, which are responsible for the conflict (the assignements are not coherent with the clauses). Starting from these assignements, it is possible to build ( to learn ) a clause which is implied by the clauses. This new clause is added to the CNF. The relevant assignements are determined by a graph of dependence between the clauses and the assignements. The learned clauses make it possible not to remake several times the same errors in the tree of research.
; Example
- Considérons that assignement the leads to a conflict. If it is shown that the variables are responsible for this conflict, then the clause is implied and it is possible to add it in the list of the clauses. So thereafter, research leads to assignement the , the variable can be immediately assigned with thanks to the learned clause.
Prospective approaches
The prospective approach consists with to prospect the tree of research to discover assignements some. Thus, being given a CNF , being given a not instanciée variable , one prospects CNFs and . If both CNFs lead to the instanciation of the same variable with the same value, then instanciation can be done as of the CNF .
; Example
- Let us consider the CNF . We are interested here in the variable and prospect the variable .
- Let us consider assignement the . One obtains and thus assignement the (since this variable appears only positively).
- Let us consider assignement the . One obtains and thus assignement the by unit clause.
- In all the cases, one obtains and it is thus possible to carry out this assignement as of the CNF .
- Let us consider assignement the . One obtains and thus assignement the (since this variable appears only positively).
Let us recall that the complexity of problem SAT comes from the exponential size of the tree of research compared to the number of variables. The prospection makes it possible to strongly reduce this number of variables as of the root (or to any node of the tree) with a relatively low additional complexity have regard the reduction of the tree of research.
Local research
On the basis of an assignment of all the variables, one seeks to modify certain valuations in order to reduce the number of nonsatisfied clauses. This algorithm suffers from several défauts : it can fall into local minima and it is unable to prove to it not satisfaisability, but it proves very effective in the not structured problems (i.e. often problems generated by chance). In the event of failure after a long time, it is possible to choose a new random assignment to avoid the local minima.
Principal implementations
-
ZChaff (Moskewicz, Madigan, Zhao, Zhang 2001)
- Seat (Ryan 2003)
- MiniSAT (Eén and Sörensson)
Applications
It is possible to translate certain problems of Artificial intelligence and to use algorithms SAT to solve these problems effectively.
Diagnosis
The diagnosis of static systems consists in determining if a system has a defective behavior being given the observation of the entries and exits of the system. The model of the system can be translated into a whole of constraints (disjunctions) : for each component of the system, a variable is created which is evaluated with true if the component has an abnormal behavior ( normal Ab ). The observations can be also translated by a whole of disjunctions. Assignement found by the algorithm of satisfaisability is a diagnosis.
Traditional planning
The traditional problem of planning consists in finding a sequence of actions carrying out of a state of the system to a whole of states. Being given a maximum length of the plan and a whole of Boolean variables of state allowing to describe the state of the system, one creates the propositional variables for all and any variable . The variable is true if the variable of state is true after the action number . One also creates the variables for all and any action . The variable is true if the action number is . It is then possible to transform the model of the system into a whole of clauses. For example, if the action makes pass the variable to true when this one is false , then the CNF contains a clause (what is translated by the clause ). Assignement found by the algorithm of satisfaisability can be immediately translated into plan.
Traditional planning by SAT is very effective if one knows the length plan. If this value is not known, one can seek plans for an incremental value, which is sometimes expensive (in particular because the CNF is not satisfaisable until ).
Model checking
A similar approach was used for the Model checking (checking of properties of a model). The principal difference is that the model checking applies to trajectories infinite length contrary to planning. However, if the space of states of the system is finished, any infinite trajectory buckles at a certain point and one can limit the size of the trajectories which it is necessary to check. The bounded model checking car started from this property to transform the problem of model checking into a certain number of problems of satisfaisability.