AFTD Auto-Formalizing Theoretical Domains

matroid_hidden_coverage_certificate_without_rainbow

theoremverified

There exists a map A from Fin 3 to the finite subsets of Fin 6 with both properties below. For every assignment f from Fin 6 to Option (Fin 3), if each color c has one row labeled some c in A(c) and another row labeled some c outside A(c), every row has a label different from none. Also, for every nonempty finite subset S of Fin 6, there is no finite subset J of Fin 3 such that every total coloring f from Fin 6 to Fin 3 with each color c appearing both inside and outside A(c) is injective on S and has image f(S) equal to J.

Statement

theorem matroid_hidden_coverage_certificate_without_rainbow :
    ∃ A : Fin 3 → Finset (Fin 6),
      (∀ f : Fin 6 → Option (Fin 3),
        (∀ c, (∃ x ∈ A c, f x = some c) ∧ (∃ y ∉ A c, f y = some c)) →
        ∀ x, f x ≠ none) ∧
      ∀ S : Finset (Fin 6), S.Nonempty → ¬ ∃ J : Finset (Fin 3),
        ∀ f : Fin 6 → Fin 3,
          (∀ c, (∃ x ∈ A c, f x = c) ∧ (∃ y ∉ A c, f y = c)) →
          Set.InjOn f (S : Set (Fin 6)) ∧ S.image f = J
Source
Hidden full-fiber route to OP-1998, based on https://arxiv.org/abs/2611.23624. The certificate model and harmonic counting argument are developed in state/campaigns/matroid-in1302/rainbow.md. For the different exact counting objective with ordinary pooled tests see https://arxiv.org/abs/2001.00441.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • g$g(S,M) = \dim_{\mathbb{F}_p}(S^{\perp}_M) - \dim_{\mathbb{F}_p}(S_M)$.

The proof, explained

The theorem is proved by exhibiting an explicit certificate family A of three subsets of Fin 6: {0,1,2}, {0,1,3}, and {0,2,3}. First, a general counting argument (`bin_count_covers`) shows that requiring each of the 3 colors to appear both inside and outside A(c) produces at least 6 colored entries, so every entry in the 6-element domain must be colored. Second, to rule out any nonempty subset S having a fixed image J under all valid colorings, three explicit valid colorings are introduced; exhaustive check (`decide`) shows no nonempty subset S is injective under the first coloring while having the same image under all three, which refutes the existence of J by contradiction.

  1. There exists a map g from Fin 3 × Bool to Fin 6 whose values under f are given by f(g(c, i)) = some c for all colors c and booleans i.

    From the coverage hypothesis on f, choose for each color c an element a(c) in A(c) with f(a(c)) = some c, and an element b(c) outside A(c) with f(b(c)) = some c. Define g(c, i) to be a(c) when i is true and b(c) when i is false. A case analysis on i confirms that f(g(c, i)) equals some c in both cases.

    lines 4–9

      classical
      choose a ha hfa using fun c => (h c).1
      choose b hb hfb using fun c => (h c).2
      let g (z : Fin 3 × Bool) := if z.2 then a z.1 else b z.1
      have hlabel (c : Fin 3) (i : Bool) : f (g (c,i)) = some c := by
        cases i <;> simp [g,hfa,hfb]
  2. The map g is injective.

    Suppose g(c, i) = g(d, j). Applying f to both sides yields some c = some d, so c = d by injectivity of the some constructor (`Option.some.inj`) and congruence (`congrArg`). Substituting d = c, note that a(c) ≠ b(c) because a(c) ∈ A(c) while b(c) ∉ A(c). Case analysis on the booleans i and j then forces i = j, since g(c, true) = a(c) cannot equal g(c, false) = b(c). Hence (c, i) = (d, j).

    lines 10–15

    uses Option.some.inj, congrArg

      have hinj : Function.Injective g := by
        rintro ⟨c,i⟩ ⟨d,j⟩ he
        have ce : c = d := Option.some.inj ((hlabel c i).symm.trans ((congrArg f he).trans (hlabel d j)))
        subst d
        have hab : a c ≠ b c := fun h' => hb c (h' ▸ ha c)
        cases i <;> cases j <;> simp_all [g]
  3. Every row is colored: f(x) ≠ none for all x in Fin 6.

    Because the domain Fin 3 × Bool and the codomain Fin 6 are finite sets of the same cardinality 6, the injectivity of g implies that g is bijective by `Fintype.bijective_iff_injective_and_card`. In particular, g is surjective. If any x had f(x) = none, surjectivity would give x = g(c, i), implying some c = f(g(c, i)) = f(x) = none, a contradiction.

    lines 16–20

    uses Fintype.bijective_iff_injective_and_card

      have hsur := (Fintype.bijective_iff_injective_and_card g).mpr ⟨hinj,by simp⟩
      intro x hx
      obtain ⟨⟨c,i⟩,rfl⟩ := hsur.surjective x
      rw [hlabel] at hx
      contradiction
  4. The certificate family A and three test colorings are defined, satisfying coverage and having no nonempty subset that is injective under the first model with identical image under all three.

    We define the family A = ![{0,1,2}, {0,1,3}, {0,2,3}] and three colorings `models 0`, `models 1`, and `models 2`. Lean verifies by finite evaluation (`decide`) that every color occurs both inside and outside A(c) in each of the three colorings (`good`). It also verifies by exhaustive search (`decide`) over all nonempty subsets s of Fin 6 that no s is simultaneously mapped injectively by `models 0` and given the exact same image under all three models (`obs`).

    lines 31–37

      let A : Fin 3 → Finset (Fin 6) := ![{0,1,2},{0,1,3},{0,2,3}]
      let models : Fin 3 → Fin 6 → Fin 3 :=
        ![![0,1,1,2,0,2], ![0,1,2,0,2,1], ![1,2,0,2,1,0]]
      have good : ∀ i c, (∃ x ∈ A c, models i x = c) ∧ (∃ y ∉ A c, models i y = c) := by decide
      have obs : ∀ s : Finset (Fin 6), s.Nonempty →
          ¬ ((∀ x ∈ s, ∀ y ∈ s, models 0 x = models 0 y → x = y) ∧
            ∀ i, s.image (models i) = s.image (models 0)) := by decide
  5. The family A satisfies the first condition (full coverage), reducing the theorem to showing that no nonempty subset S has a fixed rainbow image.

    We instantiate the existential witness with A. The first conjunct follows immediately from the helper lemma `bin_count_covers A`. It remains to show the second conjunct.

    line 38

    uses bin_count_covers

      refine ⟨A,bin_count_covers A,?_⟩
  6. For every nonempty subset S of Fin 6, no set of colors J is the image of S under all valid colorings that are injective on S.

    Assume for contradiction that such a nonempty S and target set J exist, so that every valid coloring is injective on S and has image J. Evaluating this condition on the three colorings (which are valid by `good`), it follows that `models 0` is injective on S and each `models i` has image J, meaning all three models have the same image on S. This directly contradicts the exhaustive check `obs`.

    lines 39–42

      rintro S hS ⟨J,hJ⟩
      have h (i : Fin 3) := hJ (models i) (good i)
      exact obs S hS ⟨fun _ hx _ hy he => (h 0).1 hx hy he,
        fun i => (h i).2.trans (h 0).2.symm⟩
Option.some.inj
The constructor `some` is injective: if `some u = some v`, then `u = v`.
congrArg
Equality is preserved under function application: if `a = b`, then `f a = f b`.
Fintype.bijective_iff_injective_and_card
A function between two finite types of the same cardinality is bijective if and only if it is injective.
bin_count_covers
For any family A of subsets of Fin 6 indexed by Fin 3, if a partial coloring assigns each color c at least once inside A(c) and at least once outside A(c), then every element of Fin 6 is assigned a color (none is unassigned).

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

private theorem bin_count_covers (A : Fin 3 → Finset (Fin 6)) (f : Fin 6 → Option (Fin 3))    (h : ∀ c, (∃ x ∈ A c, f x = some c) ∧ (∃ y ∉ A c, f y = some c)) :    ∀ x, f x ≠ none := by  classical  choose a ha hfa using fun c => (h c).1  choose b hb hfb using fun c => (h c).2  let g (z : Fin 3 × Bool) := if z.2 then a z.1 else b z.1  have hlabel (c : Fin 3) (i : Bool) : f (g (c,i)) = some c := by    cases i <;> simp [g,hfa,hfb]  have hinj : Function.Injective g := by    rintro ⟨c,i⟩ ⟨d,j⟩ he    have ce : c = d := Option.some.inj ((hlabel c i).symm.trans ((congrArg f he).trans (hlabel d j)))    subst d    have hab : a c ≠ b c := fun h' => hb c (h' ▸ ha c)    cases i <;> cases j <;> simp_all [g]  have hsur := (Fintype.bijective_iff_injective_and_card g).mpr ⟨hinj,by simp⟩  intro x hx  obtain ⟨⟨c,i⟩,rfl⟩ := hsur.surjective x  rw [hlabel] at hx  contradictiontheorem matroid_hidden_coverage_certificate_without_rainbow :    ∃ A : Fin 3 → Finset (Fin 6),      (∀ f : Fin 6 → Option (Fin 3),        (∀ c, (∃ x ∈ A c, f x = some c) ∧ (∃ y ∉ A c, f y = some c)) →        ∀ x, f x ≠ none) ∧      ∀ S : Finset (Fin 6), S.Nonempty → ¬ ∃ J : Finset (Fin 3),        ∀ f : Fin 6 → Fin 3,          (∀ c, (∃ x ∈ A c, f x = c) ∧ (∃ y ∉ A c, f y = c)) →          Set.InjOn f (S : Set (Fin 6)) ∧ S.image f = J := by  let A : Fin 3 → Finset (Fin 6) := ![{0,1,2},{0,1,3},{0,2,3}]  let models : Fin 3 → Fin 6 → Fin 3 :=    ![![0,1,1,2,0,2], ![0,1,2,0,2,1], ![1,2,0,2,1,0]]  have good : ∀ i c, (∃ x ∈ A c, models i x = c) ∧ (∃ y ∉ A c, models i y = c) := by decide  have obs : ∀ s : Finset (Fin 6), s.Nonempty →      ¬ ((∀ x ∈ s, ∀ y ∈ s, models 0 x = models 0 y → x = y) ∧        ∀ i, s.image (models i) = s.image (models 0)) := by decide  refine ⟨A,bin_count_covers A,?_⟩  rintro S hS ⟨J,hJ⟩  have h (i : Fin 3) := hJ (models i) (good i)  exact obs S hS ⟨fun _ hx _ hy he => (h 0).1 hx hy he,    fun i => (h i).2.trans (h 0).2.symm⟩
See it in the graphDiscuss this resultChallenge it