AFTD Auto-Formalizing Theoretical Domains

SATtoColor.SATtoColorReduction

theoremverifiedformalizationimported Lean

Correctness of the 3-SAT to 3-coloring reduction. Let $f$ be a 3-SAT instance over a variable type $V$: a list of clauses, each clause an ordered triple of literals, where a literal is a positive or a negative occurrence of a variable in $V$. Then $f$ is satisfiable — some Boolean assignment $V \to \{\mathrm{true}, \mathrm{false}\}$ makes every clause in $f$ true — if and only if the reduction graph associated to $f$ is 3-colorable, that is, admits a proper coloring by three colors.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
theorem SATtoColor.SATtoColorReduction {V : Type} (f : Sat3 V) :
  IsSatisfiable f ↔ Is3Colorable (ReductionGraph f)
Formalizes
Correctness of the 3-SAT to 3-coloring reduction, as formalized in TCSlib (`SATtoColor.SATtoColorReduction`)
Lean proof
By CS 294-268 course staff (UC Berkeley, Spring 2026), from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Copyright (c) 2026 UC Berkeley CS 294. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
Verified
07 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 7
  • SATtoColor.SATtoColorSoundnessSoundness of the 3-SAT to 3-colouring reduction. Let $f$ be a 3-SAT instance over a variable type $V$, that is, a list of clauses, each…
  • SATtoColor.IsSatisfiableA 3-SAT instance $f$ is satisfiable if there exists a Boolean assignment that satisfies it:…
  • SATtoColor.Is3ColorableA simple graph $G$ on vertex type $V'$ is 3-colorable if there exists a proper graph coloring with colors $\mathrm{Fin}\,3$, i.e.\…
  • SATtoColor.SATtoColorCompletenessCompleteness of the 3-SAT to 3-coloring reduction. Let $f$ be a 3-SAT instance over a variable type $V$, that is, a list of clauses, each…
  • SATtoColor.ReductionGraphGiven a 3-SAT instance $f$ over variables $V$, the reduction graph $\mathrm{ReductionGraph}(f)$ is the SimpleGraph on…
  • SATtoColor.Sat3A 3-SAT instance over variable type $V$ is defined as a list of clauses, i.e.\ $\mathrm{Sat3}(V) := \mathrm{List}(\mathrm{Clause}\,V)$.
  • SATtoColor.OutputVertexThe vertex set of the reduction graph is the inductive type $\mathrm{OutputVertex}(V)$ with three constructors:
    •…

Lean source view module on GitHub

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
/-- Main theorem: 3-SAT is satisfiable iff the reduction graph is 3-colorable. -/
theorem SATtoColor.SATtoColorReduction {V : Type} (f : Sat3 V) :
  IsSatisfiable f ↔ Is3Colorable (ReductionGraph f) :=
  Iff.intro (SATtoColorCompleteness f) (SATtoColorSoundness f)
See it in the graphDiscuss this resultChallenge it