why 2-CNF SAT is in P
Since there is a polynomial algorithm for solving it.
Rough sketch of evidence:
Note that any sentence in 2-CNF is in the form A => B , where A and B are either variables or their negation. Therefore, we can say that this section says that when A is true, it makes B be true. It also means that B are false forces of A as false. We should consider this later.
Now you can take the variable one by one and search if it transitively forces itself to be negative (A => B => C => ... => non A) and vice versa (non A => ... => A). If the first is true, A must be false; if second, A is true. If both, the formula is unsatisfactory.
If you do not find any variable that makes the formula unsatisfactory, it is doable.
Note that this βbrutalβ algorithm is not actual, using the strongly related components of the graph, which I recommend you read. However, it is a polynomial (searching for one variable is obviously O (N ^ 2), since you force one variable at a time, looking at the sentences of O (N), and you count the variables O (N), which means that the algorithm is polynomial), Please note that the fact that we have no more than two literals in the article is crucial. If the sentences were A => B or C or something else, this would not work well.
source share