Documentation

CslibFrontier.Computability.Complexity.Problems.ChromaticNumber

Chromatic number #

ChromaticNumber is Karp's problem CHROMATIC NUMBER [Kar72]: given a graph G and a number k, the declared vertices of G can be colored with k colors so that adjacent vertices get different colors. It is KColoring k with the number of colors moved into the instance (Cslib.Complexity.ChromaticNumberInstance, encoded by Cslib.Complexity.encChromaticNumber). The graph of the declared vertices has chromatic number at most k in the sense of SimpleGraph.chromaticNumber (Cslib.Complexity.mem_ChromaticNumber_iff_chromaticNumber_le). Equivalently, by Mathlib's SimpleGraph.partitionable_iff_colorable, that graph is partitioned into at most k independent sets (SimpleGraph.Partitionable).

NP membership uses a list of colors as the witness, the color of a vertex being the entry at its first occurrence among the declared vertices (Cslib.Complexity.colorOf). Since k is written in binary, a coloring of a member is first replaced by one with colors below the number of declared vertices, so that witnesses have length polynomial in the instance: when k exceeds the number of declared vertices, every vertex is colored by its position.

Karp proves hardness by a reduction from SATISFIABILITY WITH AT MOST 3 LITERALS PER CLAUSE. Here ChromaticNumber is NP-hard because the NP-hard ThreeColoring is the instances with three colors (Cslib.Complexity.polyTimeReducible_KColoring_ChromaticNumber).

Main definitions #

Main results #

References #

An instance (graph, colors) of Chromatic Number.

  • graph : Graph

    The graph to be colored.

  • colors : ℕ

    The maximum number of colors allowed.

Instances For
    theorem Cslib.Complexity.encChromaticNumber_graph_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → ChromaticNumberInstance} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ encChromaticNumber S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (a : γ✝) => (g✝ a).graph) encIn✝ encGraph S✝
    theorem Cslib.Complexity.encChromaticNumber_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Graph} {T0 S0 x1 T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn encGraph T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encNat T1 S1) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { graph := x0 x, colors := x1 x }) encIn encChromaticNumber (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
    theorem Cslib.Complexity.encChromaticNumber_colors_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → ChromaticNumberInstance} :
    @[reducible, inline]

    The tuple of the fields of encChromaticNumber.

    Instances For
      theorem Cslib.Complexity.encChromaticNumber_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → Graph} {x1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn encGraph budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encNat budget) :
      Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { graph := x0 x, colors := x1 x }) encIn encChromaticNumber budget

      Chromatic number [Kar72]: the graphs whose declared vertices can be colored with the given number of colors so that adjacent vertices get different colors. Unlike KColoring k, the number of colors is part of the instance.

      Instances For
        @[simp]
        theorem Cslib.Complexity.mem_ChromaticNumber_iff {G : Graph} {k : ℕ} :
        { graph := G, colors := k } ∈ ChromaticNumber ↔ G ∈ KColoring k

        Membership in ChromaticNumber is membership in KColoring with the given number of colors.

        Membership in ChromaticNumber bounds the chromatic number of the graph induced on the declared vertices (SimpleGraph.chromaticNumber).

        ChromaticNumber belongs to NP, with a list of colors as the witness. Colors are taken below the number of declared vertices, so witnesses stay polynomial although the number of colors is written in binary.

        KColoring k reduces to ChromaticNumber in polynomial time, by attaching the number of colors k to the graph.

        Chromatic number is NP-complete, with the number of colors in binary [Kar72].