Hitting Set #
HittingSet is problem SP8 of Garey and Johnson. Its instances
(Cslib.Complexity.HittingSetInstance, encoded by Cslib.Complexity.encHittingSet) pair a set
system (Cslib.Complexity.SetSystem: a ground list and a list of subsets) with a number k. An
instance is in the problem when at most k distinct ground elements meet every listed subset.
Garey and Johnson ask, for a collection C of subsets of a finite set S and a positive integer
K ≤ |S|, for a set S' ⊆ S with |S'| ≤ K that contains an element of every member of C.
This formalization differs in three ways:
kis any natural number. An empty collection is hit for everyk, by the empty set, and withk = 0nothing else is. Akabove the number of distinct ground elements behaves like that number.- The listed subsets need not lie in the ground list. Only ground elements are chosen, so a subset without a ground element, such as the empty subset, is never hit.
- Repeated ground entries count once, and repeated subsets add no constraint.
For 1 ≤ k ≤ |S| and subsets of the ground list, this is the problem of Garey and Johnson.
NP membership uses subsetVerifier: the certificate selects distinct ground elements, and
HittingSet.verifier checks their number and HittingSet.isHitting.
The reduction from vertex cover #
Garey and Johnson credit the transformation from VERTEX COVER to [Kar72].
VertexCover.toHittingSet keeps the declared vertices as the ground list and k, and turns every
edge between two distinct declared vertices (VertexCover.properEdges) into the subset [u, v].
A set of declared vertices meets every such subset exactly when it is a vertex cover. Every subset
has at most two elements, the case that Garey and Johnson note remains NP-complete. VertexCover
asks for exactly k vertices and rejects every k above the number n of distinct declared
vertices (mem_VertexCover_iff_exists_card_le), while HittingSet asks for at most k. For
k > n the reduction therefore produces a fixed instance with only the empty subset, which no set
meets.
Main definitions #
Cslib.Complexity.HittingSetInstance,Cslib.Complexity.encHittingSet.Cslib.Complexity.HittingSet, withCslib.Complexity.mem_HittingSet_iffreading hitting sets as finite sets of natural numbers.Cslib.Complexity.HittingSet.isHitting, withCslib.Complexity.HittingSet.isHitting_eq_true_iff: the executable test that every subset meets the selected elements.Cslib.Complexity.HittingSet.verifier: theNPverifier.Cslib.Complexity.VertexCover.toHittingSet: the reduction fromVertexCover.
Main results #
Cslib.Complexity.HittingSet.isVerifier,Cslib.Complexity.HittingSet.computableInPolyTime_verifier,Cslib.Complexity.HittingSet.mem_NP:HittingSet ∈ NP encHittingSet.Cslib.Complexity.VertexCover.toHittingSet_mem_iff,Cslib.Complexity.VertexCover.computableInPolyTime_toHittingSet,Cslib.Complexity.polyTimeReducible_VertexCover_HittingSet: the reduction.Cslib.Complexity.HittingSet_npHard,Cslib.Complexity.HittingSet_npComplete:HittingSetisNP-complete.
References #
Framed encSetSystem followed by binary encNat, encoding HittingSetInstance. The ground
list and the subsets are framed lists of binary labels.
The tuple of the fields of encHittingSet.
The instances with a hitting set of at most k ground elements Garey and Johnson, Problem
SP8: at most k distinct ground elements such that every listed subset contains
one of them.
The hitting test is polynomial-time.
Membership in NP #
Verify a Hitting Set certificate: select distinct ground elements by the certificate mask,
then check that there are at most k of them and that they meet every listed subset.
HittingSet.verifier verifies HittingSet with certificates as long as the encoded
instance.
HittingSet belongs to NP: the certificate selects ground elements, and the verifier checks
their number and isHitting.
Reduction from vertex covers #
Karp's reduction from VertexCover: keep the declared vertices as the ground list and the
target, and make every edge (u, v) between two distinct declared vertices the subset [u, v], or
produce a fixed instance with only the empty subset, which no set meets, when the target exceeds
the number of distinct declared vertices.
Vertex covers of G are hitting sets of its edges.
The reduction toHittingSet is polynomial-time: the binary target is compared with the number
of distinct declared vertices, computed in unary.
VertexCover reduces to HittingSet in polynomial time via VertexCover.toHittingSet.
HittingSet is NP-hard.
HittingSet is NP-complete Garey and Johnson, Problem SP8, p. 222,
with the target in binary.