Edge coloring
AbbreviationEdge coloring instances#✓fully proved
An instance of EDGE COLORING is a triple \((n, E, K)\) consisting of a natural number \(n\), the number of vertices, a finite list \(E\) of ordered pairs of natural numbers, the edges, and a natural number \(K\), the bound on the number of colors.
abbrev EdgeColoringInstance := ℕ × List (ℕ × ℕ) × ℕ
DefinitionAdjacency in an edge coloring edge list#✓fully proved
Given a list \(E\) of ordered pairs of natural numbers and natural numbers \(u\) and \(v\), the boolean adjacency of \(u\) and \(v\) in \(E\) is true exactly when \((u, v)\) or \((v, u)\) occurs in \(E\).
DefinitionWell-formed edge coloring instances#✓fully proved
An edge coloring instance \((n, E, K)\) is well formed when the list \(E\) has no repeated entries and every pair \((a, b)\) in \(E\) satisfies \(a < n\), \(b < n\) and \(a \ne b\), and \((b, a)\) does not occur in \(E\).
def WellFormed (i : EdgeColoringInstance) : Prop :=
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 EdgeColoringInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/EdgeColoringWanted.lean:46
Uses 1 · Used by 1
DefinitionFeasible edge coloring instances#✓fully proved
Let \((n, E, K)\) be an edge coloring instance with edge list \(E = (e_0, \dots, e_{m-1})\), where the endpoints of a pair \((x, y)\) are \(x\) and \(y\). The instance is feasible when there is a list \((c_0, \dots, c_{m-1})\) of natural numbers with \(c_j < K\) for every \(j\) such that \(c_a \ne c_b\) for all distinct \(a, b < m\) for which \(e_a\) and \(e_b\) share an endpoint.
def EdgeColoringFeasible
(i : EdgeColoringInstance) : Prop :=
∃ coloring : List ℕ, coloring.length = i.2.1.length ∧ (∀ c ∈ coloring, c < i.2.2) ∧
∀ a < i.2.1.length, ∀ b < i.2.1.length, a ≠ b →
((i.2.1.getD a (0, 0)).1 = (i.2.1.getD b (0, 0)).1 ∨
(i.2.1.getD a (0, 0)).1 = (i.2.1.getD b (0, 0)).2 ∨
(i.2.1.getD a (0, 0)).2 = (i.2.1.getD b (0, 0)).1 ∨
(i.2.1.getD a (0, 0)).2 = (i.2.1.getD b (0, 0)).2) →
coloring.getD a 0 ≠ coloring.getD b 0
abbrev EdgeColoringInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/EdgeColoringWanted.lean:46
Uses 1 · Used by 1
DefinitionEDGE COLORING as a decision problem#✓fully proved
The EDGE COLORING decision problem accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding of edge coloring instances, to an instance that is well formed and feasible. Bitstrings that do not decode are rejected.
noncomputable def edgeColoringDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := EdgeColoringInstance) x with
| some i => decide (WellFormed i ∧ EdgeColoringFeasible 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 EdgeColoringInstance := ℕ × List (ℕ × ℕ) × ℕ
WantedExt/Complexity/NPComplete/EdgeColoringWanted.lean:46
def WellFormed (i : EdgeColoringInstance) : Prop :=
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/EdgeColoringWanted.lean:55
def EdgeColoringFeasible
(i : EdgeColoringInstance) : Prop :=
∃ coloring : List ℕ, coloring.length = i.2.1.length ∧ (∀ c ∈ coloring, c < i.2.2) ∧
∀ a < i.2.1.length, ∀ b < i.2.1.length, a ≠ b →
((i.2.1.getD a (0, 0)).1 = (i.2.1.getD b (0, 0)).1 ∨
(i.2.1.getD a (0, 0)).1 = (i.2.1.getD b (0, 0)).2 ∨
(i.2.1.getD a (0, 0)).2 = (i.2.1.getD b (0, 0)).1 ∨
(i.2.1.getD a (0, 0)).2 = (i.2.1.getD b (0, 0)).2) →
coloring.getD a 0 ≠ coloring.getD b 0
WantedExt/Complexity/NPComplete/EdgeColoringWanted.lean:59
Uses 12 · Used by 1
TheoremEDGE COLORING is NP-complete#●ready to prove
The EDGE COLORING decision problem belongs to NP, and every decision problem in NP has a polynomial-time many-one reduction to it.
public theorem_wanted edgeColoring_npComplete :
edgeColoringDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L edgeColoringDec
noncomputable def edgeColoringDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := EdgeColoringInstance) x with
| some i => decide (WellFormed i ∧ EdgeColoringFeasible i)
| none => false
WantedExt/Complexity/NPComplete/EdgeColoringWanted.lean:71
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), EDGE COLORING; I. Holyer, "The NP-completeness of edge-coloring" (1981).
Uses 5
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.