AFTD Auto-Formalizing Theoretical Domains

SATtoColor.clauseGadgetColor

defimported Lean

Given 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 in $\mathrm{Fin}\,3$ to gadget node $k \in \{0,\ldots,5\}$. In particular, node $5$ always receives color $1$ (True), and the remaining nodes are colored so that all internal gadget edges receive distinct colors whenever at least one literal is true.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
def SATtoColor.clauseGadgetColor (a b c3 : Bool) (k : Fin 6) : Fin 3
Defined in
TCSlib, `SATtoColor.clauseGadgetColor`
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
none listed
Used by 3
  • SATtoColor.sat3Coloring_litNodeColor of a literal node. Fix a variable type $V$ and a Boolean assignment $\alpha : V \to \{\text{true}, \text{false}\}$, and consider the…
  • 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.sat3ColoringGiven a satisfying assignment $\mathrm{assign} : V \to \mathrm{Bool}$, the function $\mathrm{sat3Coloring}(\mathrm{assign})$ maps every…

Lean source view module on GitHub

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
/-- Coloring of clause gadget nodes given the boolean values of the three literals. -/
def SATtoColor.clauseGadgetColor (a b c3 : Bool) (k : Fin 6) : Fin 3 :=
  let ff3 := !a && !b && !c3
  let ff  := !a && !b
  match k with
  | ⟨5, _⟩ => 1
  | ⟨4, _⟩ => if ff3 then 0 else if ff then 2 else 0
  | ⟨3, _⟩ => if ff3 then 0 else if ff then 0 else 2
  | ⟨2, _⟩ => if ff3 then 0 else if ff then 2 else 1
  | ⟨1, _⟩ => if ff3 then 0 else if ff then 1 else if !b then 0 else 2
  | ⟨0, _⟩ => if ff3 then 0 else if ff then 0 else if !a then 0 else if !b then 2 else 0
See it in the graphDiscuss this resultChallenge it