AFTD Auto-Formalizing Theoretical Domains

op874_many_disjoint_palette_collisions

theoremverified

For any finite list of two-color palette assignments on at least twice the list length plus five vertices, choose a disjoint pair for every assignment whose two palettes agree.

Statement

theorem op874_many_disjoint_palette_collisions
    {V : Type*} [DecidableEq V] (m : ℕ) (S : Finset V)
    (P : Fin m → V → Finset (Fin 4))
    (hP : ∀ i v, v ∈ S → (P i v).card = 2)
    (hS : 2*m+5 ≤ S.card) :
    ∃ p : Fin m → Finset V,
      (∀ i, p i ⊆ S ∧ (p i).card = 2 ∧
        ∀ u ∈ p i, ∀ v ∈ p i, P i u = P i v) ∧
      (∀ i j, i ≠ j → Disjoint (p i) (p j))
Source
Matching-adversarial factor-word construction for OP-874, https://arxiv.org/abs/2610.41950.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1

The proof, explained

The proof proceeds by induction on m, generalizing over the vertex set S. In the inductive step for m + 1, the condition |S| ≥ 2(m + 1) + 5 ≥ 7 ensures, via the pigeonhole principle on 2-element subsets of a 4-element set (op874_two_color_palettes_repeat), that there exist two distinct vertices u, v ∈ S sharing the same palette under P 0. Removing this pair T = {u, v} leaves a subset S' = S \ T of size |S'| ≥ 2m + 5, allowing us to apply the induction hypothesis to the remaining m palette assignments on S'. Prepending T to the resulting family of m disjoint pairs yields m + 1 mutually disjoint pairs in S with monochromatic palette assignments.

  1. The theorem holds vacuously in the base case m = 0.

    We argue by induction on m, generalizing over the vertex set S. When m = 0, there are no palette assignments to satisfy and no pairs of indices to compare, so the empty family (Fin.elim0) vacuously fulfills all conditions.

    lines 10–15

    uses Fin.elim0

      classical
      induction m generalizing S with
      | zero =>
        refine ⟨Fin.elim0, ?_, ?_⟩
        · intro i; exact Fin.elim0 i
        · intro i; exact Fin.elim0 i
  2. For the induction step, there exists a 2-element subset T = {u, v} ⊆ S on which the first palette assignment P 0 agrees.

    In the induction step for m + 1, the size hypothesis gives |S| ≥ 2(m + 1) + 5 ≥ 7. By the pigeonhole principle on 2-element subsets of a 4-element set (op874_two_color_palettes_repeat), there exist distinct vertices u, v ∈ S with P 0 u = P 0 v. Setting T = {u, v}, we check that T ⊆ S and |T| = 2.

    lines 16–25

    uses op874_two_color_palettes_repeat, Finset.mem_insert, Finset.mem_singleton

      | succ m ih =>
        have hs7 : 7 ≤ S.card := by omega
        obtain ⟨u, hu, v, hv, huv, hp⟩ :=
          op874_two_color_palettes_repeat S (P 0) (fun w hw => hP 0 w hw) hs7
        let T : Finset V := {u,v}
        have hTsub : T ⊆ S := by
          intro x hx
          simp only [T, Finset.mem_insert, Finset.mem_singleton] at hx
          rcases hx with rfl | rfl <;> assumption
        have hTcard : T.card = 2 := by simp [T, huv]
  3. The induction hypothesis on S' = S \ T yields m pairwise disjoint pairs satisfying the conditions for the remaining assignments P 1, ..., P m.

    We remove T to form S' = S \ T. Since |T| = 2 and T ⊆ S, we have |S'| = |S| - 2 ≥ 2m + 5. Every vertex in S' still belongs to S (by Finset.mem_sdiff.mp), so its palette size under each shifted assignment P (i + 1) remains 2. Applying the induction hypothesis to S' and the shifted assignments produces a family q of m pairwise disjoint 2-element subsets of S', each monochromatic under its corresponding palette assignment.

    lines 26–37

    uses Finset.card_sdiff_of_subset, Finset.card_le_card, Finset.mem_sdiff.mp

        let S' := S \ T
        have hcard : S'.card + 2 = S.card := by
          dsimp [S']
          rw [Finset.card_sdiff_of_subset hTsub, hTcard]
          have := Finset.card_le_card hTsub
          rw [hTcard] at this
          omega
        have hP' : ∀ (i : Fin m) (v : V), v ∈ S' → (P i.succ v).card = 2 := by
          intro i w hw
          exact hP i.succ w ((Finset.mem_sdiff.mp hw).1)
        have hS' : 2*m+5 ≤ S'.card := by omega
        obtain ⟨q, hq, hqdis⟩ := ih S' (fun i => P i.succ) hP' hS'
  4. The combined family p = (T, q 0, ..., q (m - 1)) consists of 2-element subsets of S whose vertices share their palettes under the respective assignments.

    We construct the candidate family p of length m + 1 by prepending T to q via Fin.cons. To check that every pair p i is a subset of S, has cardinality 2, and is monochromatic under P i, we perform case analysis on i using Fin.cases. For index 0, p 0 = T satisfies all three conditions by construction. For successor indices j + 1, p (j + 1) = q j ⊆ S' ⊆ S (by Finset.sdiff_subset) inherits cardinality 2 and palette agreement from the induction hypothesis.

    lines 38–48

    uses Fin.cons, Fin.cases, Fin.cons_zero, Fin.cons_succ, Finset.mem_insert, Finset.mem_singleton, Finset.sdiff_subset

        refine ⟨Fin.cons T q, ?_, ?_⟩
        · intro i
          refine Fin.cases ?_ (fun j => ?_) i
          · simp only [Fin.cons_zero]
            refine ⟨hTsub, hTcard, ?_⟩
            intro x hx y hy
            simp only [T, Finset.mem_insert, Finset.mem_singleton] at hx hy
            rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> simp_all
          · simp only [Fin.cons_succ]
            obtain ⟨hsub, hc, heq⟩ := hq j
            exact ⟨hsub.trans (Finset.sdiff_subset), hc, heq⟩
  5. All distinct pairs in the family p are disjoint, completing the proof.

    Given distinct indices i ≠ j, we show that p i and p j are disjoint by case analysis on both indices with Fin.cases. If both are 0, they are equal, contradicting i ≠ j. If one index is 0 and the other is a successor j' + 1, then p 0 = T and p (j' + 1) = q j' ⊆ S \ T, which are disjoint by the definition of set difference (Finset.mem_sdiff.mp). If both are successors i' + 1 and j' + 1, the assumption i' + 1 ≠ j' + 1 implies i' ≠ j' (by congrArg Fin.succ), so q i' and q j' are disjoint by the induction hypothesis.

    lines 49–73

    uses Fin.cases, Fin.cons_zero, Fin.cons_succ, Finset.disjoint_left.mpr, Finset.mem_sdiff.mp, congrArg, Fin.succ

        · intro i
          refine Fin.cases ?_ (fun i' => ?_) i
          · intro j
            refine Fin.cases ?_ (fun j' => ?_) j
            · intro hij; exact (hij rfl).elim
            · intro _
              simp only [Fin.cons_zero, Fin.cons_succ]
              apply Finset.disjoint_left.mpr
              intro x hx hqmem
              have hxS' := (hq j').1 hqmem
              exact (Finset.mem_sdiff.mp hxS').2 hx
          · intro j
            refine Fin.cases ?_ (fun j' => ?_) j
            · intro _
              simp only [Fin.cons_succ, Fin.cons_zero]
              apply Finset.disjoint_left.mpr
              intro x hx hTmem
              have hxS' := (hq i').1 hx
              exact (Finset.mem_sdiff.mp hxS').2 hTmem
            · intro hij
              simp only [Fin.cons_succ]
              apply hqdis i' j'
              intro heq
              apply hij
              exact congrArg Fin.succ heq
Fin.elim0
Eliminates an element of the empty type Fin 0; given any index in Fin 0, produces a proof of any goal.
op874_two_color_palettes_repeat
If a set S has at least 7 vertices, each assigned a 2-element subset of a 4-element set, then there exist two distinct vertices in S with the same palette.
Finset.mem_insert
An element belongs to insert b s if and only if it equals b or belongs to s.
Finset.mem_singleton
An element belongs to the singleton {a} if and only if it equals a.
Finset.card_sdiff_of_subset
If s ⊆ t, the cardinality of the set difference t \ s is |t| - |s|.
Finset.card_le_card
If s ⊆ t, then |s| ≤ |t|.
Finset.mem_sdiff.mp
If an element belongs to s \ t, then it belongs to s and does not belong to t.
Fin.cons
Constructs a sequence indexed by Fin (n + 1) by placing a given head at index 0 and a given tail at successor indices.
Fin.cases
Performs case analysis on Fin (n + 1), reducing a property to its value at 0 and at successor indices.
Fin.cons_zero
The head element Fin.cons x p 0 evaluates to x.
Fin.cons_succ
Evaluating Fin.cons x p at a successor index i.succ yields p i.
Finset.sdiff_subset
The set difference s \ t is a subset of s.
Finset.disjoint_left.mpr
Two sets s and t are disjoint if every element of s does not belong to t.
congrArg
Equal arguments to a function yield equal results: if a₁ = a₂, then f(a₁) = f(a₂).
Fin.succ
The successor embedding mapping an index in Fin n to the corresponding index plus one in Fin (n + 1).

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem op874_many_disjoint_palette_collisions    {V : Type*} [DecidableEq V] (m : ℕ) (S : Finset V)    (P : Fin m → V → Finset (Fin 4))    (hP : ∀ i v, v ∈ S → (P i v).card = 2)    (hS : 2*m+5 ≤ S.card) :    ∃ p : Fin m → Finset V,      (∀ i, p i ⊆ S ∧ (p i).card = 2 ∧        ∀ u ∈ p i, ∀ v ∈ p i, P i u = P i v) ∧      (∀ i j, i ≠ j → Disjoint (p i) (p j)) := by  classical  induction m generalizing S with  | zero =>    refine ⟨Fin.elim0, ?_, ?_⟩    · intro i; exact Fin.elim0 i    · intro i; exact Fin.elim0 i  | succ m ih =>    have hs7 : 7 ≤ S.card := by omega    obtain ⟨u, hu, v, hv, huv, hp⟩ :=      op874_two_color_palettes_repeat S (P 0) (fun w hw => hP 0 w hw) hs7    let T : Finset V := {u,v}    have hTsub : T ⊆ S := by      intro x hx      simp only [T, Finset.mem_insert, Finset.mem_singleton] at hx      rcases hx with rfl | rfl <;> assumption    have hTcard : T.card = 2 := by simp [T, huv]    let S' := S \ T    have hcard : S'.card + 2 = S.card := by      dsimp [S']      rw [Finset.card_sdiff_of_subset hTsub, hTcard]      have := Finset.card_le_card hTsub      rw [hTcard] at this      omega    have hP' : ∀ (i : Fin m) (v : V), v ∈ S' → (P i.succ v).card = 2 := by      intro i w hw      exact hP i.succ w ((Finset.mem_sdiff.mp hw).1)    have hS' : 2*m+5 ≤ S'.card := by omega    obtain ⟨q, hq, hqdis⟩ := ih S' (fun i => P i.succ) hP' hS'    refine ⟨Fin.cons T q, ?_, ?_⟩    · intro i      refine Fin.cases ?_ (fun j => ?_) i      · simp only [Fin.cons_zero]        refine ⟨hTsub, hTcard, ?_⟩        intro x hx y hy        simp only [T, Finset.mem_insert, Finset.mem_singleton] at hx hy        rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> simp_all      · simp only [Fin.cons_succ]        obtain ⟨hsub, hc, heq⟩ := hq j        exact ⟨hsub.trans (Finset.sdiff_subset), hc, heq⟩    · intro i      refine Fin.cases ?_ (fun i' => ?_) i      · intro j        refine Fin.cases ?_ (fun j' => ?_) j        · intro hij; exact (hij rfl).elim        · intro _          simp only [Fin.cons_zero, Fin.cons_succ]          apply Finset.disjoint_left.mpr          intro x hx hqmem          have hxS' := (hq j').1 hqmem          exact (Finset.mem_sdiff.mp hxS').2 hx      · intro j        refine Fin.cases ?_ (fun j' => ?_) j        · intro _          simp only [Fin.cons_succ, Fin.cons_zero]          apply Finset.disjoint_left.mpr          intro x hx hTmem          have hxS' := (hq i').1 hx          exact (Finset.mem_sdiff.mp hxS').2 hTmem        · intro hij          simp only [Fin.cons_succ]          apply hqdis i' j'          intro heq          apply hij          exact congrArg Fin.succ heq
See it in the graphDiscuss this resultChallenge it