Maximum leaf spanning tree
AbbreviationInstances of MAXIMUM LEAF SPANNING TREE#✓fully proved
An instance of MAXIMUM LEAF SPANNING TREE is a triple \((n, es, K)\) of a natural number \(n\) (the number of vertices), a list \(es\) of pairs of natural numbers (the edge list) and a natural number \(K\) (the bound on the number of leaves).
abbrev MaximumLeafSpanningTreeInstance := ℕ × List (ℕ × ℕ) × ℕ
DefinitionWell-formed MAXIMUM LEAF SPANNING TREE instances#✓fully proved
An instance \((n, es, K)\) of MAXIMUM LEAF SPANNING TREE is well formed when \(n > 0\), the list \(es\) has no repeated entries, and every entry \((u, v)\) of \(es\) satisfies \(u < n\), \(v < n\) and \(u \ne v\), and \((v, u)\) is not an entry of \(es\).
def WellFormed (i : MaximumLeafSpanningTreeInstance) : 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 MaximumLeafSpanningTreeInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/MaximumLeafSpanningTreeWanted.lean:48
Uses 1 · Used by 1
DefinitionFeasible MAXIMUM LEAF SPANNING TREE instances#✓fully proved
An instance \((n, es, K)\) of MAXIMUM LEAF SPANNING TREE is feasible when there are a sublist \(T\) of \(es\) (a list obtained from \(es\) by deleting entries) with no repeated entries and exactly \(n - 1\) entries, and a set \(L\) of at least \(K\) vertices in \(\{0, \dots, n - 1\}\), such that the simple graph on \(\{0, \dots, n - 1\}\) in which distinct vertices \(i\) and \(j\) are adjacent when \((i, j)\) or \((j, i)\) is an entry of \(T\) is connected, and each vertex in \(L\) is an endpoint of exactly one entry of \(T\).
def MaximumLeafSpanningTreeFeasible
(i : MaximumLeafSpanningTreeInstance) : Prop :=
∃ T : List (ℕ × ℕ), T.Sublist i.2.1 ∧ T.Nodup ∧ T.length = i.1 - 1 ∧
(Cslib.Complexity.Karp.edgeGraph i.1 T).Connected ∧
∃ leaves : Finset (Fin i.1), i.2.2 ≤ leaves.card ∧
∀ v ∈ leaves, ∃! e ∈ T, e.1 = (v : ℕ) ∨ e.2 = (v : ℕ)
abbrev MaximumLeafSpanningTreeInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/MaximumLeafSpanningTreeWanted.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
DefinitionThe decision problem MAXIMUM LEAF SPANNING TREE#✓fully proved
The decision problem MAXIMUM LEAF SPANNING TREE accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding of instances, to an instance \((n, es, K)\) of MAXIMUM LEAF SPANNING TREE that is well formed and feasible (its graph has a spanning tree with at least \(K\) leaves). Bitstrings that do not decode are rejected.
noncomputable def maximumLeafSpanningTreeDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := MaximumLeafSpanningTreeInstance) x with
| some i => decide (WellFormed i ∧ MaximumLeafSpanningTreeFeasible 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 MaximumLeafSpanningTreeInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/MaximumLeafSpanningTreeWanted.lean:48
def WellFormed (i : MaximumLeafSpanningTreeInstance) : 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/MaximumLeafSpanningTreeWanted.lean:51
def MaximumLeafSpanningTreeFeasible
(i : MaximumLeafSpanningTreeInstance) : Prop :=
∃ T : List (ℕ × ℕ), T.Sublist i.2.1 ∧ T.Nodup ∧ T.length = i.1 - 1 ∧
(Cslib.Complexity.Karp.edgeGraph i.1 T).Connected ∧
∃ leaves : Finset (Fin i.1), i.2.2 ≤ leaves.card ∧
∀ v ∈ leaves, ∃! e ∈ T, e.1 = (v : ℕ) ∨ e.2 = (v : ℕ)
WantedExt/Complexity/NPComplete/MaximumLeafSpanningTreeWanted.lean:55
Uses 12 · Used by 1
TheoremMAXIMUM LEAF SPANNING TREE is NP-complete#●ready to prove
The decision problem MAXIMUM LEAF SPANNING TREE belongs to NP, and every decision problem in NP reduces to it by a polynomial-time many-one reduction.
public theorem_wanted maximumLeafSpanningTree_npComplete :
maximumLeafSpanningTreeDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L maximumLeafSpanningTreeDec
noncomputable def maximumLeafSpanningTreeDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := MaximumLeafSpanningTreeInstance) x with
| some i => decide (WellFormed i ∧ MaximumLeafSpanningTreeFeasible i)
| none => false
WantedExt/Complexity/NPComplete/MaximumLeafSpanningTreeWanted.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), MAXIMUM LEAF SPANNING TREE.
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.