(a or b) and (¬a or c) => (b or c)
2) While preserving consistency, for each variable in the original formula, you must add only one of these special clauses: (x or x) and (¬x or ¬x). (For Krom, a formula is consistent if there aren’t both of these special clauses at the same time in the formula) 3) You assign to each variable TRUE or FALSE depending on which of these special clauses has been added to the formula. If the variable x has the special clause (x or x) then we assign TRUE to x; and if the variable y has the special clause (¬y or ¬y) then we assign FALSE to y. 4) This is the step where I am stuck. My problem is that I don’t know what to do once I have made the assignments to the variables. And the last paragraph of the Wikipedia describing the algorithm doesn’t explain it clearly. Do I have to check satisfiability on this formula or also in the original formula as well? Furthermore, for example: I have this formula:(a or b) Then I add for each variable its special clause (as the algorithm doesn’t specify which of them you should pick) like this (a or b) and (¬a or ¬a) and (¬b or ¬b) So I assign to the variables a and b the value FALSE, but then the first clause (the clause on the original formula) becomes false. What do I do in that case? Could somebody explain me the last step of Krom’s Algorithm for solving 2SAT problems?
Asked By : RabidOrange
Answered By : Yuval Filmus
- Generate all 2-clauses reachable by resolution.
- If you have generated both $a lor a$ and $bar{a} lor bar{a}$ for some variable $a$, then there is no solution.
- Otherwise, if for some variable $a$ we have generated neither $a lor a$ nor $bar{a} lor bar{a}$, add one of them as you please and go back to step 1.
- Output the truth assignment satisfying all literals $a$ for which we have generated $a lor a$.
This is just one implementation; others are possible. (For example, we could immediately substitute any known values before step 3.) Back to your example: $a lor b$. Step 1 produces no new clauses. The variable $a$ is “free”, so in step 3 we add (say) $bar{a} lor bar{a}$. Step 1 is now more interesting: $$ begin{array}{c} a lor b qquad bar{a} lor bar{a} hline b lor bar{a} end{array} begin{array}{c} a lor b qquad b lor bar{a} hline b lor b end{array} $$ We can now read off the truth assignment $a=F,b=T$. Had we added $a lor a$ instead, step 1 would still not do anything, and so we would add either $b lor b$ or $bar{b} lor bar{b}$ in step 3, and then read off one of the truth assignment $a=T,b=T$, $a=T,b=F$.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/51302 3.2K people like this