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:
- for every vertex
uand colori < 3, a propositional variablexᵤᵢ(“ugets colori”), represented by the element(varC i, ![u, u]); - for every vertex
u, a clausexᵤ₀ ∨ xᵤ₁ ∨ xᵤ₂, represented by(vtxClause, ![u, u]); - for every edge
(u, v)and colori, a clause¬xᵤᵢ ∨ ¬xᵥᵢ, represented by(edgClause i, ![u, v]).
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 3 → ColTag
(varC i, ![u, u])is the propositional variable “ugets colori”. - vtxClause : ColTag
(vtxClause, ![u, u])is the clause “ugets some color”. - edgClause : Fin 3 → ColTag
(edgClause i, ![u, v])is the clause “uandvdo not both get colori” (present when(u, v)is an edge).
Instances For
Dependency graph
Equations
- DescriptiveComplexity.instDecidableEqColTag.decEq (DescriptiveComplexity.ColTag.varC a) (DescriptiveComplexity.ColTag.varC b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- DescriptiveComplexity.instDecidableEqColTag.decEq (DescriptiveComplexity.ColTag.varC a) DescriptiveComplexity.ColTag.vtxClause = isFalse ⋯
- DescriptiveComplexity.instDecidableEqColTag.decEq (DescriptiveComplexity.ColTag.varC a) (DescriptiveComplexity.ColTag.edgClause a_1) = isFalse ⋯
- DescriptiveComplexity.instDecidableEqColTag.decEq DescriptiveComplexity.ColTag.vtxClause (DescriptiveComplexity.ColTag.varC a) = isFalse ⋯
- DescriptiveComplexity.instDecidableEqColTag.decEq DescriptiveComplexity.ColTag.vtxClause DescriptiveComplexity.ColTag.vtxClause = isTrue ⋯
- DescriptiveComplexity.instDecidableEqColTag.decEq DescriptiveComplexity.ColTag.vtxClause (DescriptiveComplexity.ColTag.edgClause a) = isFalse ⋯
- DescriptiveComplexity.instDecidableEqColTag.decEq (DescriptiveComplexity.ColTag.edgClause a) (DescriptiveComplexity.ColTag.varC a_1) = isFalse ⋯
- DescriptiveComplexity.instDecidableEqColTag.decEq (DescriptiveComplexity.ColTag.edgClause a) DescriptiveComplexity.ColTag.vtxClause = isFalse ⋯
- DescriptiveComplexity.instDecidableEqColTag.decEq (DescriptiveComplexity.ColTag.edgClause a) (DescriptiveComplexity.ColTag.edgClause b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Defining formula for satIsClause: vertex clauses are the diagonal
vtxClause-elements, edge clauses for color i are the edgClause i-elements
carrying an edge.
Equations
- DescriptiveComplexity.isClauseFormula (DescriptiveComplexity.ColTag.varC a) = ⊥
- DescriptiveComplexity.isClauseFormula DescriptiveComplexity.ColTag.vtxClause = (FirstOrder.Language.var (0, 0)).equal (FirstOrder.Language.var (0, 1))
- DescriptiveComplexity.isClauseFormula (DescriptiveComplexity.ColTag.edgClause a) = FirstOrder.Language.adj.formula₂ (FirstOrder.Language.var (0, 0)) (FirstOrder.Language.var (0, 1))
Instances For
Dependency graph
Defining formula for satPosIn: the vertex clause of u contains
positively exactly the variables xᵤᵢ.
Equations
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.posInFormula x✝¹ x✝ = ⊥
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
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.negInFormula x✝¹ x✝ = ⊥
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
Dependency graph
Dependency graph
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
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
The reduction is even quantifier-free.
Dependency graph
Corollary in terms of Mathlib's SimpleGraph: a simple graph is
3-colorable iff the CNF instance interpreted in it is satisfiable.