Documentation

CslibFrontier.Computability.Complexity.Problems.LongPath.Hardness

k-Path is NP-complete #

k-Path (Cslib.Complexity.LongPath) [CyganEtAl2015, Section 5.2] is NP-complete (Cslib.Complexity.LongPath_npComplete), with the target k in binary.

Membership. A certificate is an ordering of the declared vertices, read by Cslib.Complexity.Graph.verifyOrdering as for Cslib.Complexity.HamPath. The verifier (Cslib.Complexity.LongPath.verifier) checks that the first k entries are k vertices with consecutive ones adjacent. A path on k vertices extends to an ordering by appending the other declared vertices. The first k entries, for k in binary, are the first min (length) k entries, a count in unary, so the verifier is polynomial-time.

Hardness. The pendant copy (Cslib.Complexity.HamPath.pendantCopy) of an instance ⟨G, s, t⟩ of undirected Hamiltonian path relabels every declared vertex v as Nat.pair i (p + 2) (Cslib.Complexity.HamPath.copyLabel), for p the position of the first occurrence of v, and attaches two pendant vertices Nat.pair i 0 and Nat.pair i 1 to the copies of s and t. A path on N + 2 vertices of the copy, for N the number of distinct vertices of G, visits every vertex of the copy; its ends are the pendant vertices, and removing them leaves a Hamiltonian path from s to t. Conversely, the pendant vertices extend a Hamiltonian path (Cslib.Complexity.HamPath.pendantCopy_mem_LongPath_iff). With i = 0 this is a polynomial-time reduction, so k-Path is NP-hard (Cslib.Complexity.LongPath_npHard). The labels use positions, which are bounded by the encoded length, because the library's pairing rule Turing.MultiTapeTM.ComputableInPolyTime.unary_pair takes unary arguments and a vertex name, written in binary, can be exponentially larger than its encoding. The copy index i is used by the disjoint union of copies in CslibFrontier.Computability.Complexity.Parameterized.LongPathKernel, the OR-cross-composition behind the kernel lower bound for k-Path. The gadget was written for this library; it is not taken from a source, and no novelty is claimed.

Main definitions #

Main results #

References #

The verifier for LongPath: decode a list of vertices from the certificate (Graph.decodeVertexList), check that it lists every declared vertex exactly once, and check that its first k entries are k vertices with consecutive ones adjacent.

LongPath.verifier verifies LongPath with certificates of length n ^ 2 for instances of encoded length n: a path on k vertices extends to an ordering of the declared vertices, and the first k entries of such an ordering form a path when there are k of them and consecutive ones are adjacent.

The LongPath verifier is polynomial-time: the first k entries, for k in binary, are the first min (length) k entries, a count in unary.

The label of the vertex v of the graph G in copy i: the pair of i and two more than the position of the first occurrence of v in the vertex list of G.

Copy i of the instance x = ⟨G, s, t⟩: the vertices of G, relabeled by copyLabel, with two pendant vertices Nat.pair i 0 and Nat.pair i 1 attached to s and to t.

Polynomial time #

Labels #

One copy #

Every vertex of copy i is a pair with first component i.

Both ends of every edge of copy i are pairs with first component i.

Paths through one copy #

theorem Cslib.Complexity.HamPath.pendantCopy_mem_LongPath_iff {G : Graph} {s t i : ℕ} :
{ graph := pendantCopy { graph := G, source := s, target := t } i, target := G.distinctVertices.length + 2 } ∈ LongPath ↔ { graph := G, source := s, target := t } ∈ HamPath

One copy: the copy of ⟨G, s, t⟩ has a path on two more vertices than G has exactly when G has a Hamiltonian path from s to t.

k-Path is NP-hard, by the pendant copy of an instance of HamPath: a graph has a Hamiltonian path from s to t exactly when its pendant copy has a path on two more vertices than the graph has.

k-Path is NP-complete, with the target k in binary.