SATtoColor.sat3Coloring_litNode
theoremverifiedimported Lean
Color of a literal node. Fix a variable type $V$ and a Boolean assignment $\alpha : V \to \{\text{true}, \text{false}\}$, and consider the coloring of the reduction graph induced by $\alpha$, which sends each vertex to a color in $\{0, 1, 2\}$ (with $1$ standing for True and $2$ for False). For every literal $\ell$ over $V$, the literal node of $\ell$ receives color $1$ if $\ell$ is satisfied by $\alpha$, and color $2$ otherwise: \[ \text{color of the literal node of } \ell \;=\; \begin{cases} 1 & \text{if $\ell$ is satisfied by $\alpha$,}\\ 2 & \text{otherwise.}\end{cases} \]
Statement
set_option relaxedAutoImplicit false in set_option autoImplicit false in lemma SATtoColor.sat3Coloring_litNode {V : Type} (assign : V → Bool) (l : Literal V) : sat3Coloring assign (.literalNode l) = if SatisfiesLiteral assign l then 1 else 2
- Source
- TCSlib, `SATtoColor.sat3Coloring_litNode`
- 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.SATtoColor.sat3Coloring_litNode← SATtoColor.sat3Coloring_litNode (TCSlib/Complexity/NPReductions/ThreeSATToColoring.lean:184): adapted
What was changed in
SATtoColor.sat3Coloring_litNode--- TCSlib/Complexity/NPReductions/ThreeSATToColoring.lean:184 (SATtoColor.sat3Coloring_litNode) +++ as compiled here @@ -1,5 +1,7 @@ -private lemma sat3Coloring_litNode {V : Type} (assign : V → Bool) (l : Literal V) : +set_option relaxedAutoImplicit false in +set_option autoImplicit false in +lemma SATtoColor.sat3Coloring_litNode {V : Type} (assign : V → Bool) (l : Literal V) : sat3Coloring assign (.literalNode l) = if SatisfiesLiteral assign l then 1 else 2 := by match l with - | .pos v => simp [sat3Coloring, SatisfiesLiteral] + | .pos v => simp [sat3Coloring, SatisfiesLiteral]; rfl | .neg v => - Verified
- 07 Oct 2026
- Axioms
propext- Built on 6
- SATtoColor.OutputVertexThe vertex set of the reduction graph is the inductive type $\mathrm{OutputVertex}(V)$ with three constructors:
•… - SATtoColor.LiteralA literal for switching-lemma formulas: a variable $\mathtt{var} : \mathrm{Fin}\,n$ with a negation flag $\mathtt{neg} : \mathrm{Bool}$…
- SATtoColor.SatisfiesLiteralGiven a Boolean assignment $\mathrm{assign} : V \to \mathrm{Bool}$, the function $\texttt{SATtoColor.SatisfiesLiteral}$ evaluates a…
- SATtoColor.sat3ColoringGiven a satisfying assignment $\mathrm{assign} : V \to \mathrm{Bool}$, the function $\mathrm{sat3Coloring}(\mathrm{assign})$ maps every…
- SATtoColor.clauseGadgetColorGiven the Boolean truth values $a, b, c_3$ of the three literals of a clause, $\mathrm{clauseGadgetColor}(a, b, c_3, k)$ assigns a color…
- SATtoColor.ClauseA clause over a variable type $V$ is a structure bundling exactly three literals $\ell_1, \ell_2, \ell_3 : \mathrm{Literal}\,V$.…
- SATtoColor.OutputVertexThe vertex set of the reduction graph is the inductive type $\mathrm{OutputVertex}(V)$ with three constructors:
- Used by 1
- 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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option relaxedAutoImplicit false inset_option autoImplicit false inlemma SATtoColor.sat3Coloring_litNode {V : Type} (assign : V → Bool) (l : Literal V) : sat3Coloring assign (.literalNode l) = if SatisfiesLiteral assign l then 1 else 2 := by match l with | .pos v => simp [sat3Coloring, SatisfiesLiteral]; rfl | .neg v => show (if assign v then (2 : Fin 3) else 1) = if !assign v then 1 else 2 match assign v with | true => rfl | false => rfl