Degree-constrained spanning tree
AbbreviationInstances of DEGREE-CONSTRAINED SPANNING TREE#✓fully proved
An instance of DEGREE-CONSTRAINED SPANNING TREE is a triple \((n, E, K)\) consisting of a natural number \(n\) (the number of vertices), a list \(E\) of pairs of natural numbers (the edges) and a natural number \(K\) (the degree bound).
abbrev DegreeConstrainedSpanningTreeInstance := ℕ × List (ℕ × ℕ) × ℕ
DefinitionWell-formed DEGREE-CONSTRAINED SPANNING TREE instances#✓fully proved
An instance \((n, E, K)\) of DEGREE-CONSTRAINED SPANNING TREE is well formed when \(n > 0\), the list \(E\) has no repeated entries, and every pair \((u, v)\) in \(E\) satisfies \(u < n\), \(v < n\) and \(u \ne v\), with the reversed pair \((v, u)\) not in \(E\).
def WellFormed (i : DegreeConstrainedSpanningTreeInstance) : Prop :=
0 < i.1 ∧ i.2.1.Nodup ∧ ∀ e ∈ i.2.1, e.1 < i.1 ∧ e.2 < i.1 ∧ e.1 ≠ e.2 ∧ (e.2, e.1) ∉ i.2.1
abbrev DegreeConstrainedSpanningTreeInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/DegreeConstrainedSpanningTreeWanted.lean:48
Uses 1 · Used by 1
DefinitionFeasibility for DEGREE-CONSTRAINED SPANNING TREE#✓fully proved
An instance \((n, E, K)\) of DEGREE-CONSTRAINED SPANNING TREE is feasible when there is a list \(T\) of pairs of natural numbers such that \(T\) is a sublist of \(E\) (obtained by deleting entries and keeping the order), \(T\) has no repeated entries, \(T\) has exactly \(n - 1\) entries, the graph of \(T\) on \(n\) vertices is connected, and for every vertex \(v < n\) there is no sublist of \(T\) with \(K + 1\) entries each of which has \(v\) as one of its two components.
For a well-formed instance this says that the graph of \(E\) on \(n\) vertices has a spanning tree in which every vertex has degree at most \(K\).
def DegreeConstrainedSpanningTreeFeasible
(i : DegreeConstrainedSpanningTreeInstance) : Prop :=
∃ T : List (ℕ × ℕ), T.Sublist i.2.1 ∧ T.Nodup ∧ T.length = i.1 - 1 ∧
(Cslib.Complexity.Karp.edgeGraph i.1 T).Connected ∧
∀ v < i.1, ¬ ∃ D : List (ℕ × ℕ), D.Sublist T ∧ D.length = i.2.2 + 1 ∧
∀ e ∈ D, e.1 = v ∨ e.2 = v
abbrev DegreeConstrainedSpanningTreeInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/DegreeConstrainedSpanningTreeWanted.lean:48
def edgeGraph (n : ℕ) (es : List (ℕ × ℕ)) : SimpleGraph (Fin n) :=
SimpleGraph.fromRel fun i j => ((i : ℕ), (j : ℕ)) ∈ es
CSLibExt/Computability/Complexity/Karp/Color.lean:51
Uses 2 · Used by 1
DefinitionDEGREE-CONSTRAINED SPANNING TREE as a decision problem#✓fully proved
The decision problem DEGREE-CONSTRAINED SPANNING TREE accepts a bitstring \(x\) exactly when bitstring decoding of \(x\) as a triple \((n, E, K)\) succeeds and returns an instance of DEGREE-CONSTRAINED SPANNING TREE that is both well formed and feasible; every bitstring that does not decode is rejected.
noncomputable def degreeConstrainedSpanningTreeDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := DegreeConstrainedSpanningTreeInstance) x with
| some i => decide (WellFormed i ∧ DegreeConstrainedSpanningTreeFeasible 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 DegreeConstrainedSpanningTreeInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/DegreeConstrainedSpanningTreeWanted.lean:48
def WellFormed (i : DegreeConstrainedSpanningTreeInstance) : Prop :=
0 < i.1 ∧ i.2.1.Nodup ∧ ∀ e ∈ i.2.1, e.1 < i.1 ∧ e.2 < i.1 ∧ e.1 ≠ e.2 ∧ (e.2, e.1) ∉ i.2.1
WantedExt/Complexity/NPComplete/DegreeConstrainedSpanningTreeWanted.lean:51
def DegreeConstrainedSpanningTreeFeasible
(i : DegreeConstrainedSpanningTreeInstance) : Prop :=
∃ T : List (ℕ × ℕ), T.Sublist i.2.1 ∧ T.Nodup ∧ T.length = i.1 - 1 ∧
(Cslib.Complexity.Karp.edgeGraph i.1 T).Connected ∧
∀ v < i.1, ¬ ∃ D : List (ℕ × ℕ), D.Sublist T ∧ D.length = i.2.2 + 1 ∧
∀ e ∈ D, e.1 = v ∨ e.2 = v
WantedExt/Complexity/NPComplete/DegreeConstrainedSpanningTreeWanted.lean:55
Uses 12 · Used by 1
TheoremDEGREE-CONSTRAINED SPANNING TREE is NP-complete#●ready to prove
The decision problem DEGREE-CONSTRAINED SPANNING TREE belongs to the class NP, and every decision problem in NP has a polynomial-time many-one reduction to it.
public theorem_wanted degreeConstrainedSpanningTree_npComplete :
degreeConstrainedSpanningTreeDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L degreeConstrainedSpanningTreeDec
noncomputable def degreeConstrainedSpanningTreeDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := DegreeConstrainedSpanningTreeInstance) x with
| some i => decide (WellFormed i ∧ DegreeConstrainedSpanningTreeFeasible i)
| none => false
WantedExt/Complexity/NPComplete/DegreeConstrainedSpanningTreeWanted.lean:64
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), DEGREE-CONSTRAINED SPANNING TREE (the
K = 2slice is Hamiltonian path).
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.