AFTD Auto-Formalizing Theoretical Domains

NAEtoColor.ReductionGraph

defimported Lean

Given a NAE-SAT instance $f$, $\texttt{NAEtoColor.ReductionGraph}\;f$ is the simple graph on $\texttt{NAEtoColor.OutputVertex}\;V$ whose adjacency is the symmetrization of $\texttt{NAEtoColor.EdgeRelation}\;f$ restricted to distinct pairs (no self-loops).

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
def NAEtoColor.ReductionGraph {V : Type} (f : NAESat3 V) : SimpleGraph (OutputVertex V)
Defined in
TCSlib, `NAEtoColor.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 NAEtoColor.ReductionGraph
--- TCSlib/Complexity/NPReductions/NAESATToColoring.lean:194 (NAEtoColor.ReductionGraph)
+++ as compiled here
@@ -1,10 +1,6 @@
-/-- Simple graph for reduction from NAE-SAT to 3-Coloring.
-
-We symmetrize EdgeRelation manually so proof of symmetry becomes trivial.
-A SimpleGraph also requires irreflexivity (no self-loops), enforced by `u ≠ v`,
-so we encode that in adjacency as well.
--/
-def ReductionGraph {V : Type} (f : NAESat3 V) : SimpleGraph (OutputVertex V) where
+set_option relaxedAutoImplicit false in
+set_option autoImplicit false in
+def NAEtoColor.ReductionGraph {V : Type} (f : NAESat3 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
  • NAEtoColor.OutputVertexThe vertex set of the reduction graph is an inductive type with three constructors:
    • $\mathtt{groundNode}$ --- a…
  • NAEtoColor.NAESat3A NAE-SAT instance over variable type $V$ is defined as a list of NAE clauses, i.e.\…
  • NAEtoColor.EdgeRelationGiven a NAE-SAT instance $\mathit{clauses}$, the directed edge relation on $\texttt{NAEtoColor.OutputVertex}\;V$ is defined by: (1)…
Used by 3
  • NAEtoColor.NAEtoColorReductionCorrectness of the NAE-SAT to 3-coloring reduction. Let $f$ be a NAE-SAT instance over a variable type $V$, and let $\Gamma(f)$ denote its…
  • NAEtoColor.NAEtoColorCompletenessCompleteness of the NAE-SAT to 3-coloring reduction. Let $f$ be a NAE-SAT instance over a variable type $V$, that is, a list of…
  • NAEtoColor.NAEtoColorSoundnessSoundness of the NAE-SAT to 3-coloring reduction. Let $f$ be a NAE-SAT instance over a variable type $V$, that is, a list of Not-All-Equal…

Lean source view module on GitHub

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
/-- Simple graph for reduction from NAE-SAT to 3-Coloring. We symmetrize EdgeRelation manually so proof of symmetry becomes trivial. A SimpleGraph also requires irreflexivity (no self-loops), enforced by `u ≠ v`, so we encode that in adjacency as well. -/
def NAEtoColor.ReductionGraph {V : Type} (f : NAESat3 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