Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Boolean satisfiability problem
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===XOR-satisfiability=== {| align="right" class="wikitable collapsible collapsed" style="text-align:left; margin: 1em; max-width: 95%" |- ! Solving an XOR-SAT example<BR>by [[Gaussian elimination]] |- | {| align="left" class="collapsible collapsed" style="text-align:left" |- ! Given formula |- | ("β" means XOR, the {{color|#ff8080|red clause}} is optional) |- | (''a''β''c''β''d'') β§ (''b''βΒ¬''c''β''d'') β§ (''a''β''b''βΒ¬''d'') β§ (''a''βΒ¬''b''βΒ¬''c'') {{color|#ff8080|β§ (Β¬''a''β''b''β''c'')}} |} |- | {| align="left" class="collapsible collapsed" style="text-align:left" |- ! colspan="9" | Equation system |- | colspan="9" | ("1" means TRUE, "0" means FALSE) |- | colspan="9" | Each clause leads to one equation. |- | || ''a'' || β || || ''c'' || β || || ''d'' || = 1 |- | || ''b'' || β || Β¬ || ''c'' || β || || ''d'' || = 1 |- | || ''a'' || β || || ''b'' || β || Β¬ || ''d'' || = 1 |- | || ''a'' || β || Β¬ || ''b'' || β || Β¬ || ''c'' || = 1 |- | {{color|#ff8080|Β¬}} || {{color|#ff8080|''a''}} || {{color|#ff8080|β}} || || {{color|#ff8080|''b''}} || {{color|#ff8080|β}} || || {{color|#ff8080|''c''}} || {{color|#ff8080| β 1}} |} |- | {| align="left" class="collapsible collapsed" style="text-align:left" |- ! colspan="6" | Normalized equation system |- | colspan="6" | using properties of [[Boolean rings]] (Β¬''x''=1β''x'', ''x''β''x''=0) |- | ''a'' || β || ''c'' || β || ''d'' || = '''1''' |- | ''b'' || β || ''c'' || β || ''d'' || = '''0''' |- | ''a'' || β || ''b'' || β || ''d'' || = '''0''' |- | ''a'' || β || ''b'' || β || ''c'' || = '''1''' |- | {{color|#ff8080|''a''}} || {{color|#ff8080|β}} || {{color|#ff8080|''b''}} || {{color|#ff8080|β}} || {{color|#ff8080|''c''}} || {{color|#ff8080| β '''0'''}} |- | colspan="6" | (If the {{color|#ff8080|red equation}} is present, {{color|#ff8080|it}} contradicts |- | colspan="6" | the last black one, so the system is unsolvable. |- | colspan="6" | Therefore, Gauss' algorithm is |- | colspan="6" | used only for the black equations.) |} |- | {| align="left" class="collapsible collapsed" style="text-align:left" |- ! colspan="6" | Associated coefficient matrix |- | |- ! ''a'' !! ''b'' !! ''c'' !! ''d'' !! !! line |- | |- | 1 || 0 || 1 || 1 ! 1 | A |- | 0 || 1 || 1 || 1 ! 0 | B |- | 1 || 1 || 0 || 1 ! 0 | C |- | 1 || 1 || 1 || 0 ! 1 | D |} |- | {| align="left" class="collapsible collapsed" style="text-align:left" |- ! colspan="6" |Transforming to echelon form |- | |- ! ''a'' !! ''b'' !! ''c'' !! ''d'' !! !! operation |- | |- | 1 || 0 || 1 || 1 ! 1 | A |- | 1 || 1 || 0 || 1 ! 0 | C |- | 1 || 1 || 1 || 0 ! 1 | D |- | 0 || 1 || 1 || 1 ! 0 | B (swapped) |- | |- | 1 || 0 || 1 || 1 ! 1 | A |- | 0 || 1 || 1 || 0 ! 1 | E = CβA |- | 0 || 1 || 0 || 1 ! 0 | F = DβA |- | 0 || 1 || 1 || 1 ! 0 | B |- | |- | 1 || 0 || 1 || 1 ! 1 | A |- | 0 || 1 || 1 || 0 ! 1 | E |- | 0 || 0 || 1 || 1 ! 1 | G = FβE |- | 0 || 0 || 0 || 1 ! 1 | H = BβE |} |- | {| align="left" class="collapsible collapsed" style="text-align:left" |- ! colspan="6" | Transforming to diagonal form |- | |- ! ''a'' !! ''b'' !! ''c'' !! ''d'' !! !! operation |- | |- | 1 || 0 || 1 || 0 ! 0 | I = AβH |- | 0 || 1 || 1 || 0 ! 1 | E |- | 0 || 0 || 1 || 0 ! 0 | J = GβH |- | 0 || 0 || 0 || 1 ! 1 | H |- | |- | 1 || 0 || 0 || 0 ! 0 | K = IβJ |- | 0 || 1 || 0 || 0 ! 1 | L = EβJ |- | 0 || 0 || 1 || 0 ! 0 | J |- | 0 || 0 || 0 || 1 ! 1 | H |- |} |- | {| align="left" class="collapsible collapsed" style="text-align:left" |- ! Solution: |- | If the {{color|#ff8080|red clause}} is present: || Unsolvable |- | Else: || ''a'' = 0 = FALSE |- | || ''b'' = 1 = TRUE |- | || ''c'' = 0 = FALSE |- | || ''d'' = 1 = TRUE |- | colspan="2" | '''As a consequence:''' |- | colspan="2" | ''R''(''a'',''c'',''d'') β§ ''R''(''b'',Β¬''c'',''d'') β§ ''R''(''a'',''b'',Β¬''d'') β§ ''R''(''a'',Β¬''b'',Β¬''c'') {{color|#ff8080|β§ ''R''(Β¬''a'',''b'',''c'')}} |- | colspan="2" | is not 1-in-3-satisfiable, |- | colspan="2" | while (''a'' β¨ ''c'' β¨ ''d'') β§ (''b'' β¨ Β¬''c'' β¨ ''d'') β§ (''a'' β¨ ''b'' β¨ Β¬''d'') β§ (''a'' β¨ Β¬''b'' β¨ Β¬''c'') |- | colspan="2" | is 3-satisfiable with ''a''=''c''=FALSE and ''b''=''d''=TRUE. |} |} Another special case is the class of problems where each clause contains XOR (i.e. [[exclusive or]]) rather than (plain) OR operators.{{efn|Formally, generalized conjunctive normal forms with a ternary Boolean function ''R'' are employed, which is TRUE just if 1 or 3 of its arguments is. An input clause with more than 3 literals can be transformed into an equisatisfiable conjunction of clauses Γ‘ 3 literals similar to [[#3-satisfiability|above]]; i.e. XOR-SAT can be reduced to XOR-3-SAT.}} This is in [[P (complexity class)|P]], since an XOR-SAT formula can also be viewed as a system of linear equations mod 2, and can be solved in cubic time by [[Gaussian elimination]];<ref>{{citation|title=The Nature of Computation|first1=Cristopher|last1=Moore|author1-link=Cristopher Moore|first2=Stephan|last2=Mertens|publisher=Oxford University Press|year=2011|isbn=9780199233212|page=366|url=https://books.google.com/books?id=z4zMiZyAE1kC&pg=PA366}}.</ref> see the box for an example. This recast is based on the [[Boolean algebra (structure)#Boolean rings|kinship between Boolean algebras and Boolean rings]], and the fact that arithmetic modulo two forms the finite field [[GF(2)]]. Since ''a'' XOR ''b'' XOR ''c'' evaluates to TRUE if and only if exactly 1 or 3 members of {''a'',''b'',''c''} are TRUE, each solution of the 1-in-3-SAT problem for a given CNF formula is also a solution of the XOR-3-SAT problem, and in turn each solution of XOR-3-SAT is a solution of 3-SAT; see the picture. As a consequence, for each CNF formula, it is possible to solve the XOR-3-SAT problem defined by the formula, and based on the result infer either that the 3-SAT problem is solvable or that the 1-in-3-SAT problem is unsolvable. Provided that the [[P = NP problem|complexity classes P and NP are not equal]], neither 2-, nor Horn-, nor XOR-satisfiability is NP-complete, unlike SAT. ====Examples==== Here is an unsatisfiable XOR-SAT instance of 2 variables and 3 clauses: :{{math|(''a'' β ''b'') β§ (''a'') β§ (''b'')}} Here is a satisfiable XOR-SAT instance of 2 variables and 1 clause admitting 2 solutions: :{{math|(''a'' β ''b'')}} And here is a unique XOR-SAT instance, that is to say a satisfiable XOR-SAT instance of 2 variables and 2 clauses admitting exactly one solution: :{{math|(''a'' β ''b'') β§ (''a'')}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)