ThreeSATToClique.toCliqueGraph
defimported Lean
The conflict graph of a 3-CNF formula $f$ is the simple graph on vertex set $\mathtt{CliqueVertex}\,f.\mathtt{length}$ in which two vertices $u$ and $v$ are adjacent if and only if they come from different clauses ($u.c\_idx \ne v.c\_idx$) and their respective literals do not conflict.
Statement
set_option relaxedAutoImplicit false in set_option autoImplicit false in def ThreeSATToClique.toCliqueGraph {V : Type} (f : Formula3 V) : SimpleGraph (CliqueVertex f.length)
- Defined in
- TCSlib, `ThreeSATToClique.toCliqueGraph`
- Lean proof
- By Yangshuo Zou, from github.com/Shilun-Allan-Li/tcslib at
c8a02591b1e5(Copyright (c) 2026 Yangshuo Zou. 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.ThreeSATToClique.toCliqueGraph← ThreeSATToClique.toCliqueGraph (TCSlib/Complexity/NPReductions/ThreeSATToClique.lean:156): adapted
What was changed in
ThreeSATToClique.toCliqueGraph--- TCSlib/Complexity/NPReductions/ThreeSATToClique.lean:156 (ThreeSATToClique.toCliqueGraph) +++ as compiled here @@ -1,10 +1,8 @@ -/-- The conflict graph of a 3-CNF formula `f`: - * **vertices**: `CliqueVertex f.length`, i.e. pairs `(clause index, literal position)`. - * **edges**: two vertices are adjacent iff they belong to *different* clauses - and their respective literals do not conflict. -/ -def toCliqueGraph {V : Type} (f : Formula3 V) : SimpleGraph (CliqueVertex f.length) where +set_option relaxedAutoImplicit false in +set_option autoImplicit false in +def ThreeSATToClique.toCliqueGraph {V : Type} (f : Formula3 V) : SimpleGraph (CliqueVertex f.length) where Adj u v := u.c_idx ≠ v.c_idx ∧ ¬ (literalsConflict (getLitAt f u) (getLitAt f v)) - symm u v := by + symm := ⟨fun u v => by intro ⟨hne, hnc⟩ - exact ⟨hne.symm, by rwa [literalsConflict_symm] at hnc⟩ - loopless u := by simp + exact ⟨hne.symm, by rwa [literalsConflict_symm] at hnc⟩⟩ + loopless := ⟨fun u => by simp⟩ - Verified
- 07 Oct 2026
- Axioms
- none listed
- Built on 6
- ThreeSATToClique.getLitAtGiven a 3-CNF formula $f$ and a vertex $v : \mathtt{CliqueVertex}\,f.\mathtt{length}$, returns the literal at position $v.l\_idx$ within…
- ThreeSATToClique.Formula3A 3-CNF formula over $V$ is a list of 3-clauses, representing their conjunction.
- ThreeSATToClique.CliqueVertexA vertex of the conflict graph for a formula with $m$ clauses is a pair $\langle c\_idx, l\_idx \rangle$ where $c\_idx : \mathrm{Fin}\,m$…
- ThreeSATToClique.literalsConflictTwo literals $l_1$ and $l_2$ conflict if one is the positive and the other the negative occurrence of the same variable, i.e.\…
- ThreeSATToClique.literalsConflict_symmSymmetry of literal conflict. Call two literals over a variable set *conflicting* when one is the positive and the other the negative…
- ThreeSATToClique.Clause3A 3-clause over $V$ is a structure with exactly three literals $l_1, l_2, l_3 : \mathtt{Literal}\,V$, representing a disjunction of…
- Used by 4
- ThreeSATToClique.clique_vertices_choose_one_per_clauseOne clique vertex per clause. Let $f$ be a 3-CNF formula with $m$ clauses, and let $s$ be a set of vertices of the conflict graph of $f$.…
- ThreeSATToClique.ThreeSAT_to_Clique_soundnessSoundness of the 3-SAT to clique reduction. Let $f$ be a 3-CNF formula consisting of $m$ clauses. If the conflict graph of $f$ has an…
- ThreeSATToClique.ThreeSAT_to_Clique_equivalenceCorrectness of the 3-SAT to Clique reduction. Let $f$ be a 3-CNF formula with $m$ clauses. Then $f$ is satisfiable if and only if its…
- ThreeSATToClique.ThreeSAT_to_Clique_completenessCompleteness of the 3-SAT to clique reduction. Let $f$ be a 3-CNF formula consisting of $m$ clauses, and let its conflict graph be the…
Lean source view module on GitHub
set_option relaxedAutoImplicit false in set_option autoImplicit false in /-- The conflict graph of a 3-CNF formula `f`: * **vertices**: `CliqueVertex f.length`, i.e. pairs `(clause index, literal position)`. * **edges**: two vertices are adjacent iff they belong to *different* clauses and their respective literals do not conflict. -/ def ThreeSATToClique.toCliqueGraph {V : Type} (f : Formula3 V) : SimpleGraph (CliqueVertex f.length) where Adj u v := u.c_idx ≠ v.c_idx ∧ ¬ (literalsConflict (getLitAt f u) (getLitAt f v)) symm := ⟨fun u v => by intro ⟨hne, hnc⟩ exact ⟨hne.symm, by rwa [literalsConflict_symm] at hnc⟩⟩ loopless := ⟨fun u => by simp⟩