Exact Cover by 3-sets #
An instance of 3-Exact Cover (3XC) is a sequence C of sets of exactly three elements; it is a
yes-instance when some sub-collection of C covers every element of the union of C exactly once
(Cslib.Complexity.ThreeExactCover). Goldreich's Proposition 2.25 says that 3XC is NP-complete
Goldreich, Section 2.3.3. Sets are lists of three distinct natural numbers,
and instances are encoded by the set-list encoding encNatSetList of Set Cover, with binary
element labels.
Membership in NP selects the sets of the cover (Cslib.Complexity.ThreeExactCover_mem_NP).
Hardness is a reduction from positive exact-one satisfiability with exactly three distinct
variables per clause and at most three occurrences per variable
(Cslib.Complexity.PositiveOneInExactThreeSATThree), which is NP-complete. For a formula with m
clauses, the clauses are the elements 0, …, m - 1, and 2m dummy elements m, …, 3m - 1 are
added. A variable v occurring in the clauses O_v (one to three of them) contributes the sets
O_v ∪ W for every window W of 3 - |O_v| consecutive dummy elements, and every window of three
consecutive dummy elements is a set. There are at most 2m + 1 windows of each width, and the
gadget is emitted once for each of the 3m variable occurrences, so the instance has O(m²) sets.
This is attained: m ≥ 1 clauses on 3m distinct variables give 3m (2m - 1) variable sets and
2m - 2 dummy triples. Enumerating all dummy triples instead would give Θ(m³) sets. This is the
padding of the last step of Goldreich's proof (the reduction from 3XC′, with K = m), applied
directly to the occurrence sets; the draft pads with arbitrary dummy elements, but consecutive
windows suffice.
- An exact-one assignment makes the occurrence sets of its true variables a partition of the
clauses. There are at most
mof them, so they need3k - m ≤ 2mdummy elements forktrue variables, taken as consecutive windows; the remaining3(m - k)dummy elements are covered by consecutive triples (Cslib.Complexity.ThreeExactCover.mem_of_oneSatisfiable). - Conversely, a set of an exact cover containing a clause consists of the occurrences of some
variable and of dummy elements. Several variables may occur in exactly the same clauses; the
least of them is set true (
Cslib.Complexity.ThreeExactCover.oneSatisfiable_of_mem).
The draft's proof composes three reductions, from 3SAT with at most three occurrences per variable through set cover with sets of size at most three and exact cover with sets of size at most three. The reduction here starts instead from the exact-one problem, whose NP-hardness is already in the library, and uses only the last of these steps.
Main definitions #
Cslib.Complexity.IsExactCover: a sub-collection of the sets covers their union exactly once.Cslib.Complexity.ThreeExactCover: the problem.Cslib.Complexity.ThreeExactCover.reduce: the reduction.
Main results #
Cslib.Complexity.ThreeExactCover_mem_NP: 3XC is in NP.Cslib.Complexity.ThreeExactCover.reduce_mem_iff: the reduction is correct.Cslib.Complexity.ThreeExactCover_npComplete: 3XC is NP-complete (Goldreich, Proposition 2.25).
References #
The indices of the clauses of φ in which the variable v occurs.
A fixed no-instance: {0, 1, 2, 3} is not exactly covered by {0, 1, 2} and {0, 1, 3}.
The reduction from positive exact-three exact-one SAT with at most three occurrences per variable.
The reduction is computable in polynomial time.
Membership in NP #
The shape of the reduced instance #
Occurrences under the syntax guard #
Correctness of the reduction #
Exact covers give exact-one assignments. A variable is set true when a set of the cover consists of its occurrences and it is the least variable with these occurrences.
Exact-one assignments give exact covers. The true variables of the clauses have disjoint occurrence lists covering all clause indices; padding them with distinct dummy elements and covering the remaining dummy elements by triples gives an exact cover.
The reduction is correct.
3XC is in NP: a certificate selects the sets of the exact cover.
Positive exact-three exact-one SAT with at most three occurrences per variable reduces to 3XC.
3XC is NP-hard.
3-Exact Cover is NP-complete Goldreich, Proposition 2.25.