Documentation

DescriptiveComplexity.Problems.ThreeColorability.ToSat

3-colorability FO-reduces to SAT #

This file constructs a (quantifier-free) first-order reduction from graph 3-colorability to CNF satisfiability, DescriptiveComplexity.threeCol_fo_reduction_sat : FOReduction ThreeCol SAT, formalizing the classical encoding used by SAT solvers:

The resulting CNF is satisfiable iff the graph is 3-colorable (DescriptiveComplexity.threeColorable_iff_satisfiable); note that the usual “at most one color per vertex” clauses are not needed for the equivalence. All defining formulas are quantifier-free (DescriptiveComplexity.threeColToSat_isQuantifierFree), so this is even a quantifier-free reduction, the weakest reduction notion in common use in descriptive complexity.

Elements of the interpreted universe not of the shapes above (“junk”, e.g. (varC i, ![u, v]) with u ≠ v, or (edgClause i, ![u, v]) with (u, v) not an edge) are neither clauses nor occur in any clause, so they do not affect satisfiability.

Tags for the tagged 2-dimensional interpretation of SAT instances in graphs.

  • varC : Fin 3ColTag

    (varC i, ![u, u]) is the propositional variable “u gets color i”.

  • vtxClause : ColTag

    (vtxClause, ![u, u]) is the clause “u gets some color”.

  • edgClause : Fin 3ColTag

    (edgClause i, ![u, v]) is the clause “u and v do not both get color i” (present when (u, v) is an edge).

Instances For
    Dependency graph
    Equations
    Instances For
      Dependency graph
      Dependency graph
      Dependency graph
      Dependency graph
      Dependency graph

      Defining formula for satPosIn: the vertex clause of u contains positively exactly the variables xᵤᵢ.

      Equations
      Instances For
        Dependency graph

        Defining formula for satNegIn: the edge clause of (u, v) for color i contains negatively exactly the variables xᵤᵢ and xᵥᵢ.

        Equations
        Instances For
          Dependency graph

          The first-order interpretation producing, from a graph, the CNF instance expressing its 3-colorability.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            Dependency graph
            Dependency graph
            Dependency graph
            Dependency graph
            @[simp]
            Dependency graph
            Dependency graph
            def DescriptiveComplexity.colAssignment {V : Type} (col : VFin 3) :
            ColTag × (Fin 2V)Prop

            The truth assignment induced by a coloring: xᵤᵢ is true iff u gets color i. (Junk elements are assigned False.)

            Equations
            Instances For
              Dependency graph
              @[simp]
              theorem DescriptiveComplexity.colAssignment_varC {V : Type} (col : VFin 3) (i : Fin 3) (w : Fin 2V) :
              colAssignment col (ColTag.varC i, w) col (w 0) = i
              Dependency graph

              Correctness of the reduction: a graph is 3-colorable iff the interpreted CNF instance is satisfiable.

              Dependency graph

              3-colorability FO-reduces to SAT. The fo_reduction theorem: the first-order interpretation threeColToSat maps a graph to a satisfiable CNF instance iff the graph is 3-colorable.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Dependency graph
                Dependency graph

                Corollary in terms of Mathlib's SimpleGraph: a simple graph is 3-colorable iff the CNF instance interpreted in it is satisfiable.

                Dependency graph