Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 8 (Rivin–Zabih) — exchanging a subset for one with the same lines (corrected: |P₁| = |P| added)

Proved
NQueensComp.NPC.lemma_8

by mikedeng1 · Oct 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

n-queensp2o-batch-pfp2ap2o-correctedp2o-gran-per-chapterp2o-plan-paperp2o-v1

Lemma 8 (Rivin and Zabih), corrected. Let QQQ be a solution to the nnn-Queens problem and P⊆QP\subseteq QP⊆Q. If P1P_1P1​ is a set of queens with ∣P1∣=∣P∣|P_1|=|P|∣P1​∣=∣P∣ that uses the same set of rows, the same set of columns, the same set of sum-diagonals and the same set of difference-diagonals as PPP, then

(Q∖P)∪P1(Q\setminus P)\cup P_1(Q∖P)∪P1​

is also a solution to the nnn-Queens problem.

Definition 10 uses it to replace the copy An′+n′(17,0)A_{n'}+n'(17,0)An′​+n′(17,0) by Bn′+n′(17,0)B_{n'}+n'(17,0)Bn′​+n′(17,0) in Lemma 12.

Differences from the source:

  • correction: Lemma 8 has no hypothesis on the size of P₁ → adds |P₁| = |P|; reason: false as printed: n = 4, Q = P = {(1,0), (3,1), (0,2), (2,3)} and P₁ = Q ∪ {(2,0), (0,1), (3,2), (1,3)} use the same rows, columns, sum-diagonals {1, 2, 4, 5} and difference-diagonals {−2, −1, 1, 2}, but (Q \ P) ∪ P₁ has 8 queens; the paper's use (Lemma 12) has |P₁| = |P| = n′
Preamble
import Mathlib
import Definitions.Def_NQueensComp_NPC_Queens
Formal statement
namespace NQueensComp.NPC

/-- Lemma 8 (Rivin and Zabih), p. 823, corrected: if `Q` is a solution to the `n`-Queens
problem, `P ⊆ Q`, and `P₁` is a set of queens with `|P₁| = |P|` (added; the printed lemma is false
without it) that uses the same sets of rows, columns, sum-diagonals and difference-diagonals as `P`,
then `(Q \ P) ∪ P₁` is a solution to the `n`-Queens problem. -/
theorem lemma_8 (n : ℕ) (Q P P₁ : Finset Queen) (hQ : IsNQueensSol n Q) (hPQ : P ⊆ Q)
    (hcard : P₁.card = P.card)
    (hrow : P₁.image row = P.image row) (hcol : P₁.image col = P.image col)
    (hsum : P₁.image sumDiag = P.image sumDiag) (hdiff : P₁.image diffDiag = P.image diffDiag) :
    IsNQueensSol n ((Q \ P) ∪ P₁) := by sorry

end NQueensComp.NPC
Source
Gent, Jefferson & Nightingale, Complexity of n-Queens Completion, J. Artif. Intell. Res. 59 (2017), p. 823, Lemma 8 (Rivin & Zabih 1992, Thm. 2.4)
Human review
  • Endorsed by Shuze Chen · Oct 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 24, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me