Path cover of a digraph
AbbreviationInstances of DIRECTED PATH COVER#✓fully proved
An instance of DIRECTED PATH COVER is a triple \((n, E, K)\), where the natural number \(n\) is the number of vertices, the list \(E\) of ordered pairs of natural numbers lists the directed edges, and the natural number \(K\) bounds the number of paths.
abbrev DirectedPathCoverInstance := ℕ × List (ℕ × ℕ) × ℕ
DefinitionDirected adjacency in an edge list#✓fully proved
For a list \(E\) of ordered pairs of natural numbers and natural numbers \(u\) and \(v\), the directed adjacency test of \(E\) at \((u, v)\) is the boolean that is true exactly when the pair \((u, v)\) occurs in \(E\), that is, when \(E\) contains an edge from \(u\) to \(v\).
Used by 1
DefinitionWell-formed DIRECTED PATH COVER instances#✓fully proved
An instance \((n, E, K)\) of DIRECTED PATH COVER is well formed when the edge list \(E\) has no repeated entries and every edge \((a, b)\) in \(E\) satisfies \(a < n\), \(b < n\) and \(a \ne b\).
def WellFormed (i : DirectedPathCoverInstance) : Prop :=
i.2.1.Nodup ∧ ∀ e ∈ i.2.1, e.1 < i.1 ∧ e.2 < i.1 ∧ e.1 ≠ e.2
abbrev DirectedPathCoverInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/DirectedPathCoverWanted.lean:47
Uses 1 · Used by 1
DefinitionFeasible DIRECTED PATH COVER instances#✓fully proved
An instance \((n, E, K)\) of DIRECTED PATH COVER is feasible when there is a list of at most \(K\) paths, each a list of natural numbers, such that every path has no repeated vertex, every vertex on a path is less than \(n\), and whenever \(v\) immediately follows \(u\) on a path the pair \((u, v)\) occurs in \(E\); and such that every vertex \(v < n\) lies on some path, and all paths containing \(v\) are equal.
def DirectedPathCoverFeasible
(i : DirectedPathCoverInstance) : Prop :=
∃ paths : List (List ℕ), paths.length ≤ i.2.2 ∧
(∀ p ∈ paths, p.Nodup ∧ (∀ v ∈ p, v < i.1) ∧
∀ j, j + 1 < p.length → DAdj i.2.1 (p.getD j 0) (p.getD (j + 1) 0)) ∧
∀ v < i.1, ∃ p ∈ paths, v ∈ p ∧ ∀ p' ∈ paths, v ∈ p' → p' = p
abbrev DirectedPathCoverInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/DirectedPathCoverWanted.lean:47
def DAdj (edges : List (ℕ × ℕ)) (u v : ℕ) : Bool :=
edges.contains (u, v)
WantedExt/Complexity/NPComplete/DirectedPathCoverWanted.lean:51
Uses 2 · Used by 1
DefinitionDIRECTED PATH COVER as a decision problem#✓fully proved
DIRECTED PATH COVER is the decision problem that accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding, to an instance \((n, E, K)\) of DIRECTED PATH COVER that is well formed and feasible; bitstrings that do not decode to an instance are rejected.
noncomputable def directedPathCoverDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := DirectedPathCoverInstance) x with
| some i => decide (WellFormed i ∧ DirectedPathCoverFeasible i)
| none => false
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def bitDecode [BitstringEncoding α] (l : List Bool) : Option α := toEncoding.decode l
MathlibExt/Computability/Complexity.lean:58
abbrev DirectedPathCoverInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/DirectedPathCoverWanted.lean:47
def WellFormed (i : DirectedPathCoverInstance) : Prop :=
i.2.1.Nodup ∧ ∀ e ∈ i.2.1, e.1 < i.1 ∧ e.2 < i.1 ∧ e.1 ≠ e.2
WantedExt/Complexity/NPComplete/DirectedPathCoverWanted.lean:56
def DirectedPathCoverFeasible
(i : DirectedPathCoverInstance) : Prop :=
∃ paths : List (List ℕ), paths.length ≤ i.2.2 ∧
(∀ p ∈ paths, p.Nodup ∧ (∀ v ∈ p, v < i.1) ∧
∀ j, j + 1 < p.length → DAdj i.2.1 (p.getD j 0) (p.getD (j + 1) 0)) ∧
∀ v < i.1, ∃ p ∈ paths, v ∈ p ∧ ∀ p' ∈ paths, v ∈ p' → p' = p
WantedExt/Complexity/NPComplete/DirectedPathCoverWanted.lean:60
Uses 12 · Used by 1
TheoremDIRECTED PATH COVER is NP-complete#●ready to prove
The decision problem DIRECTED PATH COVER is in NP, and every decision problem in NP has a polynomial-time many-one reduction to DIRECTED PATH COVER.
public theorem_wanted directedPathCover_npComplete :
directedPathCoverDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L directedPathCoverDec
noncomputable def directedPathCoverDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := DirectedPathCoverInstance) x with
| some i => decide (WellFormed i ∧ DirectedPathCoverFeasible i)
| none => false
WantedExt/Complexity/NPComplete/DirectedPathCoverWanted.lean:69
def NP : DecisionComplexityClass :=
{ L | ∃ (p : Polynomial ℕ), ∃ R : (List Bool × List Bool) → Bool,
IsPolyTime R ∧
∀ x, L x ↔ ∃ w : List Bool, w.length ≤ p.eval x.length ∧ R (x, w) }
MathlibExt/Computability/Complexity.lean:200
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def PolyManyOneRed (L₁ L₂ : MetaMathlibExt.ComplexityTheory.DecisionProblem) : Prop :=
∃ reduce : List Bool → List Bool,
MetaMathlibExt.ComplexityTheory.IsPolyTime reduce ∧ ∀ x, L₁ x = L₂ (reduce x)
CSLibExt/Computability/CookLevin.lean:396
Sources
- M. R. Garey and D. S. Johnson, Computers and Intractability (1979), PATH COVER (the
K = 1slice is Hamiltonian path).
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.