AFTD Auto-Formalizing Theoretical Domains

SATtoColor.ReductionGraph

defimported Lean

Given a 3-SAT instance $f$ over variables $V$, the reduction graph $\mathrm{ReductionGraph}(f)$ is the SimpleGraph on $\mathrm{OutputVertex}(V)$ whose adjacency relation is the symmetrisation of $\mathrm{EdgeRelation}(f)$: two distinct vertices are adjacent iff $\mathrm{EdgeRelation}(f, u, v)$ or $\mathrm{EdgeRelation}(f, v, u)$ holds.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
def SATtoColor.ReductionGraph {V : Type} (f : Sat3 V) : SimpleGraph (OutputVertex V)
Defined in
TCSlib, `SATtoColor.ReductionGraph`
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.
What was changed in SATtoColor.ReductionGraph
--- TCSlib/Complexity/NPReductions/ThreeSATToColoring.lean:157 (SATtoColor.ReductionGraph)
+++ as compiled here
@@ -1,5 +1,6 @@
-/-- Simple graph for reduction from 3-SAT to 3-Coloring. -/
-def ReductionGraph {V : Type} (f : Sat3 V) : SimpleGraph (OutputVertex V) where
+set_option relaxedAutoImplicit false in
+set_option autoImplicit false in
+def SATtoColor.ReductionGraph {V : Type} (f : Sat3 V) : SimpleGraph (OutputVertex V) where
   Adj u v := u ≠ v ∧ (EdgeRelation f u v ∨ EdgeRelation f v u)
-  symm _ _ h := ⟨h.1.symm, h.2.symm⟩
-  loopless := fun _ h => h.1 rfl
+  symm := ⟨fun _ _ h => ⟨h.1.symm, h.2.symm⟩⟩
+  loopless := ⟨fun _ h => h.1 rfl⟩
Verified
07 Oct 2026
Axioms
none listed
Built on 3
  • SATtoColor.EdgeRelation$\mathrm{EdgeRelation}(f, u, v)$ defines the (undirected) adjacency structure of the reduction graph. The edges are: all pairs of distinct…
  • SATtoColor.OutputVertexThe vertex set of the reduction graph is the inductive type $\mathrm{OutputVertex}(V)$ with three constructors:
    •…
  • 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)$.
Used by 3
  • SATtoColor.SATtoColorReductionCorrectness 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…
  • 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.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…

Lean source view module on GitHub

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
/-- Simple graph for reduction from 3-SAT to 3-Coloring. -/
def SATtoColor.ReductionGraph {V : Type} (f : Sat3 V) : SimpleGraph (OutputVertex V) where
  Adj u v := u ≠ v ∧ (EdgeRelation f u v ∨ EdgeRelation f v u)
  symm := ⟨fun _ _ h => ⟨h.1.symm, h.2.symm⟩⟩
  loopless := ⟨fun _ h => h.1 rfl⟩
See it in the graphDiscuss this resultChallenge it