AFTD Auto-Formalizing Theoretical Domains

op861_hypergraph_cover_implies_unbalanced_selectors

theoremverified

Uniform hypergraph coverage and avoidance conditions give proper selectors for (r+s+1)-sets and k-sets.

Statement

theorem op861_hypergraph_cover_implies_unbalanced_selectors
    (α : Type) [Fintype α] [DecidableEq α] (k r s : ℕ)
    (hn : Fintype.card α = k + r + s)
    (H : α → Finset α → Prop)
    (hcover : ∀ X : Finset α, X.card = r + s + 1 →
      ∃ v ∈ X, ∀ Y : Finset α, Y ⊆ X.erase v → Y.card = s + 1 → H v Y)
    (havoid : ∀ R : Finset α, R.card = r + s →
      ∃ v, v ∉ R ∧ ∀ Y : Finset α, H v Y → ¬ Y ⊆ R) :
    ∃ (f : {X : Finset α // X.card = r + s + 1} → α)
      (g : {T : Finset α // T.card = k} → α),
      (∀ X, f X ∈ X.1) ∧ (∀ T, g T ∈ T.1) ∧
      ∀ X T, (X.1 ∩ T.1).card ≤ r → f X ≠ g T
Source
Palette-surplus hypergraph reduction for OP-861; finite examples in experiment 30660.
Verified
18 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 1

The proof, explained

The theorem is proved by constructing the selectors f and g via the axiom of choice from the coverage and avoidance hypotheses. For every k-set T, its complement R(T) in the universe has size r + s, allowing g(T) to be selected outside R(T) (so g(T) ∈ T). If |X ∩ T| ≤ r and f(X) = g(T), the set difference X \ T has size at least s + 1, from which an (s+1)-element subset Y is chosen. This subset Y is disjoint from f(X) (so H(f(X), Y) holds by the covering condition) yet contained in R(T) (which contradicts the avoidance condition for g(T)).

  1. For any k-element subset T ⊆ α, its complement R(T) = α \ T has cardinality r + s.

    Working under classical logic, for each k-set T we define R(T) as the complement of T in α. Since T is a subset of α and |α| = k + r + s, the partition identity |α \ T| + |T| = |α| simplifies to |R(T)| + k = k + r + s, which gives |R(T)| = r + s by linear integer arithmetic.

    lines 13–19

    uses Finset.card_sdiff_add_card_eq_card, Finset.subset_univ, Finset.card_univ

      classical
      let R (T : {T : Finset α // T.card = k}) : Finset α := Finset.univ \ T.1
      have hR (T : {T : Finset α // T.card = k}) : (R T).card = r + s := by
        have hh := Finset.card_sdiff_add_card_eq_card (Finset.subset_univ T.1)
        simp only [Finset.card_univ, T.2, hn] at hh
        dsimp [R]
        omega
  2. The selector functions f and g are defined such that f(X) ∈ X for every (r+s+1)-set X and g(T) ∈ T for every k-set T.

    For each (r+s+1)-set X, the covering hypothesis guarantees a vertex v ∈ X satisfying the covering condition; we pick such an element as f(X) using classical choice, ensuring f(X) ∈ X. For each k-set T, its complement R(T) has cardinality r + s, so the avoidance hypothesis provides an element v ∉ R(T) satisfying the avoidance condition; we pick such an element as g(T). Since g(T) ∉ R(T) = α \ T, it follows that g(T) ∈ T.

    lines 20–28

    uses Classical.choose, Classical.choose_spec

      let f : {X : Finset α // X.card = r + s + 1} → α :=
        fun X => Classical.choose (hcover X.1 X.2)
      let g : {T : Finset α // T.card = k} → α :=
        fun T => Classical.choose (havoid (R T) (hR T))
      have hf (X : {X : Finset α // X.card = r + s + 1}) : f X ∈ X.1 :=
        (Classical.choose_spec (hcover X.1 X.2)).1
      have hg (T : {T : Finset α // T.card = k}) : g T ∈ T.1 := by
        have h := (Classical.choose_spec (havoid (R T) (hR T))).1
        simpa [R, g] using h
  3. To show the selectors avoid each other when |X ∩ T| ≤ r, it suffices to assume for contradiction that f(X) = g(T) and consider W = X \ T.

    We instantiate the existential goal with f and g along with their membership proofs. For the remaining claim, we assume given an (r+s+1)-set X and a k-set T with |X ∩ T| ≤ r, suppose for contradiction that f(X) = g(T), and define W = X \ T.

    lines 29–31

      refine ⟨f, g, hf, hg, ?_⟩
      intro X T hint heq
      let W : Finset α := X.1 \ T.1
  4. The difference set W = X \ T has cardinality at least s + 1, and therefore contains a subset Y of cardinality exactly s + 1.

    Because |X \ T| + |X ∩ T| = |X| = r + s + 1 and |X ∩ T| ≤ r, linear arithmetic shows |W| ≥ s + 1. By Finset.exists_subset_card_eq, there exists a subset Y ⊆ W of size exactly s + 1.

    lines 32–36

    uses Finset.card_sdiff_add_card_inter, Finset.exists_subset_card_eq

      have hW : s + 1 ≤ W.card := by
        have hcard := Finset.card_sdiff_add_card_inter X.1 T.1
        dsimp [W]
        omega
      obtain ⟨Y, hYW, hYcard⟩ := Finset.exists_subset_card_eq hW
  5. The subset Y is contained in X \ {f(X)}.

    Every element y ∈ Y belongs to W = X \ T, so y ∈ X and y ∉ T. If y were equal to f(X), then since f(X) = g(T) ∈ T, we would have y ∈ T, contradicting y ∉ T. Hence y ≠ f(X), showing y ∈ X \ {f(X)}.

    lines 37–45

    uses Finset.mem_sdiff.mp, Finset.mem_erase.mpr

      have hYXR : Y ⊆ X.1.erase (f X) := by
        intro y hy
        have hyW := Finset.mem_sdiff.mp (hYW hy)
        apply Finset.mem_erase.mpr
        refine ⟨?_, hyW.1⟩
        intro hey
        apply hyW.2
        rw [hey, heq]
        exact hg T
  6. The subset Y is contained in R(T).

    Every element y ∈ Y belongs to W = X \ T, which implies y ∉ T. Since R(T) = α \ T consists of all elements of the universe not in T, every y ∈ Y belongs to R(T), so Y ⊆ R(T).

    lines 46–49

    uses Finset.mem_sdiff.mp, Finset.mem_sdiff.mpr, Finset.mem_univ

      have hYR : Y ⊆ R T := by
        intro y hy
        have hyW := Finset.mem_sdiff.mp (hYW hy)
        exact Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, hyW.2⟩
  7. A contradiction is reached: the covering property of f(X) implies H(f(X), Y), which contradicts the avoidance property of g(T).

    Because Y ⊆ X \ {f(X)} and |Y| = s + 1, the specification of f(X) from the covering hypothesis guarantees H(f(X), Y). However, the specification of g(T) from the avoidance hypothesis states that H(g(T), Y) implies Y ⊈ R(T). Since f(X) = g(T), this means H(f(X), Y) implies Y ⊈ R(T). Since we have both H(f(X), Y) and Y ⊆ R(T), this produces a contradiction.

    lines 50–54

    uses Classical.choose_spec

      have hHY : H (f X) Y := (Classical.choose_spec (hcover X.1 X.2)).2 Y hYXR hYcard
      have hbad : H (g T) Y → ¬ Y ⊆ R T :=
        (Classical.choose_spec (havoid (R T) (hR T))).2 Y
      rw [← heq] at hbad
      exact hbad hHY hYR
Finset.card_sdiff_add_card_eq_card
For finite sets s ⊆ t, |t \ s| + |s| = |t|.
Finset.subset_univ
Every finite set is a subset of the universal set.
Finset.card_univ
The cardinality of the universal finset is the cardinality of the underlying finite type.
Classical.choose
Given an existential proposition ∃ x, P x, returns an arbitrary witness x satisfying P.
Classical.choose_spec
The witness produced by Classical.choose satisfies the defining predicate P.
Finset.card_sdiff_add_card_inter
For any two finite sets s and t, |s \ t| + |s ∩ t| = |s|.
Finset.exists_subset_card_eq
If n ≤ |s|, there exists a subset of s of cardinality n.
Finset.mem_sdiff.mp
If x ∈ s \ t, then x ∈ s and x ∉ t.
Finset.mem_erase.mpr
If x ≠ a and x ∈ s, then x ∈ s \ {a}.
Finset.mem_sdiff.mpr
If x ∈ s and x ∉ t, then x ∈ s \ t.
Finset.mem_univ
Every element of a finite type belongs to the universal set.

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 op861_hypergraph_cover_implies_unbalanced_selectors    (α : Type) [Fintype α] [DecidableEq α] (k r s : ℕ)    (hn : Fintype.card α = k + r + s)    (H : α → Finset α → Prop)    (hcover : ∀ X : Finset α, X.card = r + s + 1 →      ∃ v ∈ X, ∀ Y : Finset α, Y ⊆ X.erase v → Y.card = s + 1 → H v Y)    (havoid : ∀ R : Finset α, R.card = r + s →      ∃ v, v ∉ R ∧ ∀ Y : Finset α, H v Y → ¬ Y ⊆ R) :    ∃ (f : {X : Finset α // X.card = r + s + 1} → α)      (g : {T : Finset α // T.card = k} → α),      (∀ X, f X ∈ X.1) ∧ (∀ T, g T ∈ T.1) ∧      ∀ X T, (X.1 ∩ T.1).card ≤ r → f X ≠ g T := by  classical  let R (T : {T : Finset α // T.card = k}) : Finset α := Finset.univ \ T.1  have hR (T : {T : Finset α // T.card = k}) : (R T).card = r + s := by    have hh := Finset.card_sdiff_add_card_eq_card (Finset.subset_univ T.1)    simp only [Finset.card_univ, T.2, hn] at hh    dsimp [R]    omega  let f : {X : Finset α // X.card = r + s + 1} → α :=    fun X => Classical.choose (hcover X.1 X.2)  let g : {T : Finset α // T.card = k} → α :=    fun T => Classical.choose (havoid (R T) (hR T))  have hf (X : {X : Finset α // X.card = r + s + 1}) : f X ∈ X.1 :=    (Classical.choose_spec (hcover X.1 X.2)).1  have hg (T : {T : Finset α // T.card = k}) : g T ∈ T.1 := by    have h := (Classical.choose_spec (havoid (R T) (hR T))).1    simpa [R, g] using h  refine ⟨f, g, hf, hg, ?_⟩  intro X T hint heq  let W : Finset α := X.1 \ T.1  have hW : s + 1 ≤ W.card := by    have hcard := Finset.card_sdiff_add_card_inter X.1 T.1    dsimp [W]    omega  obtain ⟨Y, hYW, hYcard⟩ := Finset.exists_subset_card_eq hW  have hYXR : Y ⊆ X.1.erase (f X) := by    intro y hy    have hyW := Finset.mem_sdiff.mp (hYW hy)    apply Finset.mem_erase.mpr    refine ⟨?_, hyW.1⟩    intro hey    apply hyW.2    rw [hey, heq]    exact hg T  have hYR : Y ⊆ R T := by    intro y hy    have hyW := Finset.mem_sdiff.mp (hYW hy)    exact Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, hyW.2⟩  have hHY : H (f X) Y := (Classical.choose_spec (hcover X.1 X.2)).2 Y hYXR hYcard  have hbad : H (g T) Y → ¬ Y ⊆ R T :=    (Classical.choose_spec (havoid (R T) (hR T))).2 Y  rw [← heq] at hbad  exact hbad hHY hYR
See it in the graphDiscuss this resultChallenge it