Documentation

CslibFrontier.Computability.Complexity.Problems.VertexCover

Vertex covers #

VertexCover is the set of graphs, given by a list of vertices and a list of edges, together with a number k, such that k of the declared vertices meet every edge between declared vertices [Kar72]. Graphs are read on their declared vertices through Cslib.Complexity.Graph.induced, and covers through SimpleGraph.IsVertexCover. Edges with an undeclared endpoint and self-loops are therefore ignored, and repeated vertex entries count once.

The cover has exactly k distinct vertices, matching IndependentSet. Since a set of declared vertices containing a cover is a cover, this agrees with the textbook formulation "a cover of at most k vertices" for every k up to the number n of distinct declared vertices, and VertexCover rejects every k > n (mem_VertexCover_iff_exists_card_le). In particular a graph without declared vertices belongs to VertexCover only with k = 0.

A set of declared vertices is a vertex cover exactly when the remaining declared vertices form an independent set (SimpleGraph.isIndepSet_compl_iff_isVertexCover), so IndependentSet.toVertexCover maps (G, m) to (G, n - m), where n is the number of distinct declared vertices; a target m > n is mapped to the unsatisfiable target n + 1 [Kar72].

The same problem as a class of finite structures, closed under isomorphism and without an encoding, with the target size given by a unary relation, is Cslib.Logic.FO.sizedGraph.VertexCover. There loops are ignored, edges need not be symmetric, and the reductions between independent set, clique and vertex cover are quantifier-free first-order interpretations.

Main definitions #

Main results #

References #

An instance (graph, k) of Vertex Cover.

  • graph : Graph

    The graph in which to find a vertex cover.

  • k : ℕ

    The target number of declared vertices.

Instances For

    Framed encGraph followed by binary target encNat, encoding VertexCoverInstance.

    Instances For
      @[reducible, inline]

      The tuple of the fields of encVertexCoverInstance.

      Instances For
        theorem Cslib.Complexity.encVertexCoverInstance_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, k := x1 x }) encIn encVertexCoverInstance (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
        theorem Cslib.Complexity.encVertexCoverInstance_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, k := x1 x }) encIn encVertexCoverInstance budget
        theorem Cslib.Complexity.encVertexCoverInstance_graph_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → VertexCoverInstance} :
        theorem Cslib.Complexity.encVertexCoverInstance_k_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → VertexCoverInstance} :

        The graphs with a vertex cover of k of their vertices: k declared vertices meeting every edge between two declared vertices [Kar72].

        Instances For
          theorem Cslib.Complexity.mem_VertexCover_iff {x : VertexCoverInstance} :
          x ∈ VertexCover ↔ ∃ (S : Finset ℕ), (∀ v ∈ S, v ∈ x.graph.vertices) ∧ (∀ u ∈ x.graph.vertices, ∀ v ∈ x.graph.vertices, x.graph.toSimpleGraph.Adj u v → u ∈ S ∨ v ∈ S) ∧ S.card = x.k

          Membership in VertexCover as a finite set of k declared vertices meeting every edge between declared vertices.

          @[simp]
          theorem Cslib.Complexity.mem_VertexCover_iff_mk {G : Graph} {k : ℕ} :
          { graph := G, k := k } ∈ VertexCover ↔ ∃ (S : Finset ℕ), (∀ v ∈ S, v ∈ G.vertices) ∧ (∀ u ∈ G.vertices, ∀ v ∈ G.vertices, G.toSimpleGraph.Adj u v → u ∈ S ∨ v ∈ S) ∧ S.card = k

          VertexCover through covers of at most k vertices: x ∈ VertexCover exactly when x.k is at most the number of distinct declared vertices and some cover has at most x.k vertices.

          theorem Cslib.Complexity.mem_VertexCover_iff_exists_card_le_mk {G : Graph} {k : ℕ} :
          { graph := G, k := k } ∈ VertexCover ↔ k ≤ G.vertices.toFinset.card ∧ ∃ (S : Finset ℕ), (∀ v ∈ S, v ∈ G.vertices) ∧ (∀ u ∈ G.vertices, ∀ v ∈ G.vertices, G.toSimpleGraph.Adj u v → u ∈ S ∨ v ∈ S) ∧ S.card ≤ k

          Reduction from independent sets #

          The reduction from IndependentSet to VertexCover: keep the graph and replace the target m by n - m, where n is the number of distinct declared vertices, or by n + 1 when m > n.

          Instances For

            The reduction toVertexCover is polynomial-time: the vertex count is computed in unary, and the binary target is compared with it by saturating decoding.

            Whether both endpoints of e are declared vertices of G.

            Instances For

              The listed edges of G between declared vertices.

              Instances For

                An edge is declared when it is listed and both endpoints are declared vertices.

                Whether the edge e joins two distinct declared vertices of G and neither endpoint is in C.

                Instances For

                  The edges of G between distinct declared vertices with neither endpoint in C.

                  Instances For

                    Whether C covers every edge of G between declared vertices.

                    Instances For
                      theorem Cslib.Complexity.VertexCover.mem_uncoveredEdges_iff {G : Graph} {C : List ℕ} {e : ℕ × ℕ} :
                      e ∈ uncoveredEdges G C ↔ e ∈ G.edges ∧ e.1 ∈ G.vertices ∧ e.2 ∈ G.vertices ∧ e.1 ≠ e.2 ∧ e.1 ∉ C ∧ e.2 ∉ C
                      theorem Cslib.Complexity.VertexCover.isCover_eq_true_iff {G : Graph} {C : List ℕ} :
                      isCover G C = true ↔ ∀ u ∈ G.vertices, ∀ v ∈ G.vertices, G.toSimpleGraph.Adj u v → u ∈ C ∨ v ∈ C

                      isCover G C holds exactly when every edge between declared vertices of G has an endpoint in C.

                      The verifier for VertexCover, a subset verifier (Cslib.Complexity.subsetVerifier): select distinct declared vertices by the certificate mask, check that their count equals k, and check that every edge between declared vertices has a selected endpoint (isCover).

                      Instances For

                        The vertex cover number #

                        The vertex cover number of a graph: the least number of declared vertices meeting every edge between declared vertices.

                        Instances For

                          The vertex cover number is the size of a vertex cover.

                          Every vertex cover has at least G.vertexCoverNum vertices.

                          A vertex cover is the complement of an independent set: the vertex cover number is the number of distinct declared vertices minus the independence number.