Documentation

CslibFrontier.Computability.Complexity.Problems.Graph.VertexColors

Vertex colors given by a list #

A coloring, or any other labeling of the vertices of a Cslib.Complexity.Graph by numbers, can be given as a list of numbers parallel to the vertex list: the label of a vertex is the entry at its first occurrence among the declared vertices (Cslib.Complexity.colorOf). The colored instances of color coding take colors in this form, and NP verifiers with colorings or vertex ranks as witnesses read them in this form (Cslib.Complexity.mem_NP_of_colorOf).

Main definitions #

Main results #

def Cslib.Complexity.colorOf (G : Graph) (cs : List ℕ) (v : ℕ) :

The color of the vertex v under a list of colors cs parallel to the vertex list of G: the entry of cs at the first occurrence of v, and 0 when there is none.

Instances For
    @[reducible, inline]

    Graphs with vertex colors: the graph (encGraph), framed, then the list of colors parallel to its vertex list (Cslib.Complexity.colorOf), each color framed and in binary.

    Instances For
      @[simp]
      theorem Cslib.Complexity.colorOf_map {G : Graph} {c : ℕ → ℕ} {v : ℕ} (hv : v ∈ G.vertices) :
      colorOf G (List.map c G.vertices) v = c v

      The list of the colors of the declared vertices under c gives every declared vertex its color.

      Reading computed colors of computed vertices is polynomial-time; the compositional form of Cslib.Complexity.computableInPolyTime_colorOf used by fun_prop.

      A labeling listed along the vertex list of a graph with at most n listed vertices, whose values on the declared vertices are at most n, has an encoding of length at most 2 n ^ 2 + n.

      theorem Cslib.Complexity.mem_NP_of_colorOf {α : Type} {enc : α ↪ List Bool} (graph : α → Graph) {S : Set α} {check : α × List ℕ → Bool} (hcheck : Turing.MultiTapeTM.ComputableInPolyTime check (Turing.MultiTapeTM.encPair enc (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat)) Turing.MultiTapeTM.encBool) (hlen : ∀ (x : α), (graph x).vertices.length ≤ (enc x).length) (hsound : ∀ (x : α) (cs : List ℕ), check (x, cs) = true → x ∈ S) (hcomplete : ∀ x ∈ S, ∃ (g : ℕ → ℕ), (∀ v ∈ (graph x).vertices, g v ≤ (graph x).vertices.length) ∧ check (x, List.map g (graph x).vertices) = true) :
      S ∈ NP enc

      NP membership from a bounded vertex labeling. Let check be polynomial-time on instances x paired with a list of vertex labels (Cslib.Complexity.colorOf). If every accepted list certifies membership in S, and every member x ∈ S has a labeling g of the declared vertices (graph x).vertices bounded by (graph x).vertices.length whose list (graph x).vertices.map g is accepted by check, then S ∈ NP enc.