17

I've seen how XOR-3-SAT is efficiently solvable (for instance, see the "XOR-satisfiability" section in the Wikipedia entry for Boolean satisfiability problem).

I'm wondering a basic question: Is XOR-k-SAT efficiently solvable, for formulas with varying amounts of literals per clause?

I'd really like to know if we can increase the amounts of literals per clause beyond 3, and if we can have mixed clause lengths.

Raphael
  • 73,212
  • 30
  • 182
  • 400
Matt Groff
  • 902
  • 1
  • 7
  • 16

2 Answers2

15

It looks like the Wikipedia article you linked to says that XORSAT (not just 3-XORSAT) is in P. The method by which they are solving that 3-XORSAT formula in their example very easily generalizes to formulas in which the clauses can have arbitrarily large numbers of variables and differing numbers of variables.

You just look at the formula as a system of linear equations where you have an equation for each clause, and a variable for each variable. For example, the formula:

$$(x_1\oplus x_2\oplus\lnot x_3\oplus x_5)\land (x_2\oplus x_3)$$

has a satisfying assignment if and only if the following system of equations has a solution:

$$x_1+x_2+(1+x_3)+x_5\equiv 1 \mod 2$$ $$x_2+x_3\equiv 1 \mod 2$$

And we can find solutions to linear systems of equations like these in polynomial time using Gaussian elimination!

Dylan McKay
  • 326
  • 1
  • 5
9

Yes. It is solvable by Gaussian elimination. Gaussian elimination can solve any system of equations that is linear modulo. XOR acts as addition modulo 2, so each XOR-SAT clause acts as a linear equation modulo 2. Consequently, Gaussian elimination can solve any XOR-k-SAT formula or any XOR-SAT formula, even if there are a varying number of literals per clause or mixed clause lengths, in polynomial time.

D.W.
  • 167,959
  • 22
  • 232
  • 500