AFTD Auto-Formalizing Theoretical Domains

ThreeSATToClique.clique_vertices_choose_one_per_clause

theoremverifiedimported Lean

One 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$. Suppose that $s$ has exactly $m$ elements and forms a clique, meaning any two distinct vertices of $s$ are adjacent. Then for every clause index $i \in \mathrm{Fin}\,m$ there is exactly one vertex $u \in s$ whose clause component equals $i$.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
lemma ThreeSATToClique.clique_vertices_choose_one_per_clause {V : Type}
    (f : Formula3 V) (s : Finset (CliqueVertex f.length))
    (hcard : s.card = f.length) (hclique : (toCliqueGraph f).IsClique s) :
    ∀ (i : Fin f.length), ∃! u ∈ s, u.c_idx = i
Source
TCSlib, `ThreeSATToClique.clique_vertices_choose_one_per_clause`
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.
Verified
07 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 6
  • 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.toCliqueGraphThe conflict graph of a 3-CNF formula $f$ is the simple graph on vertex set $\mathtt{CliqueVertex}\,f.\mathtt{length}$ in which two…
  • 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.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…
  • 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…
Used by 1

Lean source view module on GitHub

set_option relaxedAutoImplicit false inset_option autoImplicit false in/-- In an `m`-clique of the conflict graph, every clause index `i` is represented by *exactly one* vertex. *Proof sketch*: the clique has `m` vertices over `m` clauses; the edge condition forbids two vertices from the same clause (they would not be adjacent), so by a counting argument each clause contributes exactly one. -/lemma ThreeSATToClique.clique_vertices_choose_one_per_clause {V : Type}    (f : Formula3 V) (s : Finset (CliqueVertex f.length))    (hcard : s.card = f.length) (hclique : (toCliqueGraph f).IsClique s) :    ∀ (i : Fin f.length), ∃! u ∈ s, u.c_idx = i := by  -- c_idx is injective on the clique: distinct clique vertices come from  -- distinct clauses (forced by the edge condition).  have h_inj_on : Set.InjOn (fun u : CliqueVertex f.length => u.c_idx) ↑s := by    intro u hu v hv heq    by_contra hne    exact (hclique hu hv hne).1 heq  -- Injective + same cardinality ⇒ image is everything.  have h_image_univ : s.image (fun u => u.c_idx) = Finset.univ := by    apply Finset.eq_univ_of_card    rw [Finset.card_image_of_injOn h_inj_on, hcard, Fintype.card_fin]  intro i  obtain ⟨u, hu, hci⟩ := Finset.mem_image.mp (h_image_univ ▸ Finset.mem_univ i)  refine ⟨u, ⟨hu, hci⟩, ?_⟩  rintro v ⟨hv, hvi⟩  exact (h_inj_on (Finset.mem_coe.mpr hu) (Finset.mem_coe.mpr hv)    (hci.trans hvi.symm)).symm
See it in the graphDiscuss this resultChallenge it