AFTD Auto-Formalizing Theoretical Domains

matroid_full_fiber_oracle_realization

theoremverified

For a partial coloring that uses each of at least two colors, there is a matroid on the full ground set whose independent sets contain at most one entire color class. It is connected exactly when every point is colored. The color set and ground type may be infinite.

Statement

theorem matroid_full_fiber_oracle_realization {α κ : Type*} [Nontrivial κ] (g : α → Option κ)
    (hs : ∀ c, ∃ x, g x = some c) :
    ∃ M : Matroid α, M.E = Set.univ ∧
      (∀ I : Set α, M.Indep I ↔ Set.Subsingleton {c : κ | ∀ x, g x = some c → x ∈ I}) ∧
      (matroid_connected M ↔ ∀ x, g x ≠ none)
Source
https://arxiv.org/abs/2611.23624, Section 3 and the open deterministic decision question OP-1998. Disjoint-path model suggested by experiment 44323.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • matroid_connectedA matroid M on a type α is connected if for all elements e and f of its ground set M.E, either e = f or there is a circuit C of M that…
  • FThe prime field $\mathrm{GF}(p)$, realized as $\mathbb{Z}/p\mathbb{Z}$ via ZMod.
Used by 2

The proof, explained

Summary of the proof. This is a summary.

  1. Step 1 claim

    Step 1 explanation is detailed and explains how this part works.

    lines 7–36

      classical
      let U := Matroid.freeOn (univ : Set Unit)
      let R := U.comapOn D (fun _ => ())
      have hu : SurjOn (fun _ : Option κ => ()) D U.E := by
        rintro ⟨⟩ _
        exact ⟨some (Classical.arbitrary κ), hD ▸ mem_range_self _, rfl⟩
      have hb (A : Set (Option κ)) : R.IsBase A ↔ ∃ c : κ, A = {some c} := by
        rw [show R.IsBase A ↔ _ from Matroid.comapOn_isBase_iff_of_surjOn hu, Matroid.freeOn_isBase_iff]
        constructor
        · rintro ⟨ha, hinj, had⟩
          have huv : () ∈ (fun _ : Option κ => ()) '' A := ha ▸ mem_univ _
          obtain ⟨a, ha', _⟩ := huv
          obtain ⟨c, hc⟩ : ∃ c, some c = a := by
            have hmem := had ha'
            rwa [hD] at hmem
          subst a
          refine ⟨c, Set.eq_singleton_iff_unique_mem.mpr ⟨ha', ?_⟩⟩
          intro x hx
          exact hinj hx ha' rfl
        · rintro ⟨c, rfl⟩
          simp [hD]
          ext u; cases u; simp
      refine ⟨R✶, rfl, fun B => ?_⟩
      rw [Matroid.dual_isBase_iff', hb]
      change ((∃ c, D \ B = {some c}) ∧ B ⊆ D) ↔ _
      constructor
      · rintro ⟨⟨c, hc⟩, hbd⟩
        exact ⟨c, by rw [← hc, Set.sdiff_sdiff_cancel_left hbd]⟩
      · rintro ⟨c, rfl⟩
        exact ⟨⟨c, Set.sdiff_sdiff_cancel_left (by simp [hD])⟩, sdiff_subset⟩
  2. Step 2 claim

    Step 2 explanation is detailed and explains how that part works.

    lines 42–136

      classical
      obtain ⟨P, hP, hb⟩ := arm_base (Set.range (some : κ → Option κ)) rfl
      let N := P.comapOn univ g
      have hs' : SurjOn g univ P.E := by
        rw [hP]
        rintro _ ⟨c, rfl⟩
        obtain ⟨x, hx⟩ := hs c
        exact ⟨x, trivial, hx⟩
      refine ⟨N✶, rfl, fun I => ?_⟩
      rw [Matroid.dual_indep_iff_exists (show I ⊆ N.E from subset_univ _)]
      constructor
      · rintro ⟨B, hB, hd⟩
        obtain ⟨hb', -, -⟩ := (Matroid.comapOn_isBase_iff_of_surjOn hs').mp hB
        obtain ⟨c, hc⟩ := (hb _).mp hb'
        have only (j : κ) (hj : ∀ x, g x = some j → x ∈ I) : j = c := by
          by_contra hne
          have hm : some j ∈ g '' B := by rw [hc]; simp [hne]
          obtain ⟨x, hx, hjx⟩ := hm
          exact Set.disjoint_left.mp hd (hj _ hjx) hx
        exact fun i hi j hj => (only i hi).trans (only j hj).symm
      · intro h
        let F := {c : κ | ∀ x, g x = some c → x ∈ I}
        have ho : ∃ c : κ, ∀ j ∈ F, j = c := by
          by_cases hn : F.Nonempty
          · obtain ⟨c, hc⟩ := hn
            exact ⟨c, fun j hj => h hj hc⟩
          · exact ⟨Classical.arbitrary κ, fun j hj => (hn ⟨j,hj⟩).elim⟩
        obtain ⟨c, hc⟩ := ho
        have hsur : SurjOn g Iᶜ (range some \ {some c}) := by
          rintro _ ⟨⟨j, rfl⟩, hne⟩
          have hj : j ∉ F := fun hj => hne (by simp [hc _ hj])
          change ¬ ∀ x, g x = some j → x ∈ I at hj
          push Not at hj
          obtain ⟨x, hx, hxi⟩ := hj
          exact ⟨x, hxi, hx⟩
        obtain ⟨B, hBI, hbij⟩ := hsur.exists_bijOn_subset
        refine ⟨B, (Matroid.comapOn_isBase_iff_of_surjOn hs').mpr
          ⟨(hb _).mpr ⟨c, hbij.image_eq⟩, hbij.injOn, subset_univ _⟩, ?_⟩
        exact Set.disjoint_left.mpr fun x hx hxB => hBI hxB hx
    
    private theorem arm_circuit {α κ : Type*} {g : α → Option κ}
        (hs : ∀ c, ∃ x, g x = some c) {M : Matroid α} (hE : M.E = univ)
        (hi : ∀ I, M.Indep I ↔ Set.Subsingleton {c : κ | ∀ x, g x = some c → x ∈ I})
        {a b : κ} (hab : a ≠ b) :
        M.IsCircuit {x | g x = some a ∨ g x = some b} := by
      let U := {x | g x = some a ∨ g x = some b}
      change M.IsCircuit U
      have hdep : ¬ M.Indep U := by
        intro h
        have hh := (hi U).mp h
        exact hab (@hh a (fun _ hx => Or.inl hx) b (fun _ hx => Or.inr hx))
      apply Matroid.isCircuit_iff.mpr
      refine ⟨M.dep_of_not_indep hdep (by rw [hE]; exact subset_univ _), ?_⟩
      intro D hD hd
      have hns := mt (hi D).mpr hD.not_indep
      change ¬ ∀ ⦃i⦄, (∀ x, g x = some i → x ∈ D) → ∀ ⦃j⦄,
        (∀ x, g x = some j → x ∈ D) → i = j at hns
      push Not at hns
      obtain ⟨i, hi', j, hj', hij⟩ := hns
      have which (k : κ) (hk : ∀ x, g x = some k → x ∈ D) : k = a ∨ k = b := by
        obtain ⟨x,hx⟩ := hs k
        have hu : g x = some a ∨ g x = some b := hd (hk x hx)
        simpa [hx] using hu
      apply Subset.antisymm hd
      intro x hx
      change g x = some a ∨ g x = some b at hx
      rcases which i hi' with rfl | rfl <;> rcases which j hj' with rfl | rfl <;> grind
    
    theorem matroid_full_fiber_oracle_realization {α κ : Type*} [Nontrivial κ] (g : α → Option κ)
        (hs : ∀ c, ∃ x, g x = some c) :
        ∃ M : Matroid α, M.E = Set.univ ∧
          (∀ I : Set α, M.Indep I ↔ Set.Subsingleton {c : κ | ∀ x, g x = some c → x ∈ I}) ∧
          (matroid_connected M ↔ ∀ x, g x ≠ none) := by
      classical
      obtain ⟨M, he, hi⟩ := arm_matroid g hs
      refine ⟨M, he, hi, ?_⟩
      constructor
      · intro hc x hx
        obtain ⟨z, hz⟩ := hs (Classical.arbitrary κ)
        rcases hc x (he ▸ trivial) z (he ▸ trivial) with h | ⟨C, hC, hxC, _⟩
        · subst z; simp [hx] at hz
        · have hI := hC.ssubset_indep (Set.sdiff_singleton_ssubset.mpr hxC)
          apply hC.not_indep ((hi _).mpr ?_)
          apply ((hi _).mp hI).anti
          intro c hc' t ht
          exact ⟨hc' t ht, by rintro rfl; simp [hx] at ht⟩
      · intro hn x _ y _
        obtain ⟨a, ha⟩ : ∃ a, g x = some a := by cases h : g x <;> simp_all
        obtain ⟨b, hb⟩ : ∃ b, g y = some b := by cases h : g y <;> simp_all
        right
        by_cases h : a = b
        · subst b
          obtain ⟨c, hac⟩ := exists_ne a
          exact ⟨_, arm_circuit hs he hi hac.symm, Or.inl ha, Or.inl hb⟩
        · exact ⟨_, arm_circuit hs he hi h, Or.inl ha, Or.inr hb⟩

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

open Setprivate theorem arm_base {κ : Type*} [Nonempty κ] (D : Set (Option κ))    (hD : D = range some) :    ∃ P : Matroid (Option κ), P.E = D ∧      ∀ B, P.IsBase B ↔ ∃ c : κ, B = D \ {some c} := by  classical  let U := Matroid.freeOn (univ : Set Unit)  let R := U.comapOn D (fun _ => ())  have hu : SurjOn (fun _ : Option κ => ()) D U.E := by    rintro ⟨⟩ _    exact ⟨some (Classical.arbitrary κ), hD ▸ mem_range_self _, rfl⟩  have hb (A : Set (Option κ)) : R.IsBase A ↔ ∃ c : κ, A = {some c} := by    rw [show R.IsBase A ↔ _ from Matroid.comapOn_isBase_iff_of_surjOn hu, Matroid.freeOn_isBase_iff]    constructor    · rintro ⟨ha, hinj, had⟩      have huv : () ∈ (fun _ : Option κ => ()) '' A := ha ▸ mem_univ _      obtain ⟨a, ha', _⟩ := huv      obtain ⟨c, hc⟩ : ∃ c, some c = a := by        have hmem := had ha'        rwa [hD] at hmem      subst a      refine ⟨c, Set.eq_singleton_iff_unique_mem.mpr ⟨ha', ?_⟩⟩      intro x hx      exact hinj hx ha' rfl    · rintro ⟨c, rfl⟩      simp [hD]      ext u; cases u; simp  refine ⟨R✶, rfl, fun B => ?_⟩  rw [Matroid.dual_isBase_iff', hb]  change ((∃ c, D \ B = {some c}) ∧ B ⊆ D) ↔ _  constructor  · rintro ⟨⟨c, hc⟩, hbd⟩    exact ⟨c, by rw [← hc, Set.sdiff_sdiff_cancel_left hbd]⟩  · rintro ⟨c, rfl⟩    exact ⟨⟨c, Set.sdiff_sdiff_cancel_left (by simp [hD])⟩, sdiff_subset⟩private theorem arm_matroid {α κ : Type*} [Nonempty κ] (g : α → Option κ)    (hs : ∀ c, ∃ x, g x = some c) :    ∃ M : Matroid α, M.E = univ ∧ ∀ I, M.Indep I ↔      Set.Subsingleton {c : κ | ∀ x, g x = some c → x ∈ I} := by  classical  obtain ⟨P, hP, hb⟩ := arm_base (Set.range (some : κ → Option κ)) rfl  let N := P.comapOn univ g  have hs' : SurjOn g univ P.E := by    rw [hP]    rintro _ ⟨c, rfl⟩    obtain ⟨x, hx⟩ := hs c    exact ⟨x, trivial, hx⟩  refine ⟨N✶, rfl, fun I => ?_⟩  rw [Matroid.dual_indep_iff_exists (show I ⊆ N.E from subset_univ _)]  constructor  · rintro ⟨B, hB, hd⟩    obtain ⟨hb', -, -⟩ := (Matroid.comapOn_isBase_iff_of_surjOn hs').mp hB    obtain ⟨c, hc⟩ := (hb _).mp hb'    have only (j : κ) (hj : ∀ x, g x = some j → x ∈ I) : j = c := by      by_contra hne      have hm : some j ∈ g '' B := by rw [hc]; simp [hne]      obtain ⟨x, hx, hjx⟩ := hm      exact Set.disjoint_left.mp hd (hj _ hjx) hx    exact fun i hi j hj => (only i hi).trans (only j hj).symm  · intro h    let F := {c : κ | ∀ x, g x = some c → x ∈ I}    have ho : ∃ c : κ, ∀ j ∈ F, j = c := by      by_cases hn : F.Nonempty      · obtain ⟨c, hc⟩ := hn        exact ⟨c, fun j hj => h hj hc⟩      · exact ⟨Classical.arbitrary κ, fun j hj => (hn ⟨j,hj⟩).elim⟩    obtain ⟨c, hc⟩ := ho    have hsur : SurjOn g Iᶜ (range some \ {some c}) := by      rintro _ ⟨⟨j, rfl⟩, hne⟩      have hj : j ∉ F := fun hj => hne (by simp [hc _ hj])      change ¬ ∀ x, g x = some j → x ∈ I at hj      push Not at hj      obtain ⟨x, hx, hxi⟩ := hj      exact ⟨x, hxi, hx⟩    obtain ⟨B, hBI, hbij⟩ := hsur.exists_bijOn_subset    refine ⟨B, (Matroid.comapOn_isBase_iff_of_surjOn hs').mpr      ⟨(hb _).mpr ⟨c, hbij.image_eq⟩, hbij.injOn, subset_univ _⟩, ?_⟩    exact Set.disjoint_left.mpr fun x hx hxB => hBI hxB hxprivate theorem arm_circuit {α κ : Type*} {g : α → Option κ}    (hs : ∀ c, ∃ x, g x = some c) {M : Matroid α} (hE : M.E = univ)    (hi : ∀ I, M.Indep I ↔ Set.Subsingleton {c : κ | ∀ x, g x = some c → x ∈ I})    {a b : κ} (hab : a ≠ b) :    M.IsCircuit {x | g x = some a ∨ g x = some b} := by  let U := {x | g x = some a ∨ g x = some b}  change M.IsCircuit U  have hdep : ¬ M.Indep U := by    intro h    have hh := (hi U).mp h    exact hab (@hh a (fun _ hx => Or.inl hx) b (fun _ hx => Or.inr hx))  apply Matroid.isCircuit_iff.mpr  refine ⟨M.dep_of_not_indep hdep (by rw [hE]; exact subset_univ _), ?_⟩  intro D hD hd  have hns := mt (hi D).mpr hD.not_indep  change ¬ ∀ ⦃i⦄, (∀ x, g x = some i → x ∈ D) → ∀ ⦃j⦄,    (∀ x, g x = some j → x ∈ D) → i = j at hns  push Not at hns  obtain ⟨i, hi', j, hj', hij⟩ := hns  have which (k : κ) (hk : ∀ x, g x = some k → x ∈ D) : k = a ∨ k = b := by    obtain ⟨x,hx⟩ := hs k    have hu : g x = some a ∨ g x = some b := hd (hk x hx)    simpa [hx] using hu  apply Subset.antisymm hd  intro x hx  change g x = some a ∨ g x = some b at hx  rcases which i hi' with rfl | rfl <;> rcases which j hj' with rfl | rfl <;> grindtheorem matroid_full_fiber_oracle_realization {α κ : Type*} [Nontrivial κ] (g : α → Option κ)    (hs : ∀ c, ∃ x, g x = some c) :    ∃ M : Matroid α, M.E = Set.univ ∧      (∀ I : Set α, M.Indep I ↔ Set.Subsingleton {c : κ | ∀ x, g x = some c → x ∈ I}) ∧      (matroid_connected M ↔ ∀ x, g x ≠ none) := by  classical  obtain ⟨M, he, hi⟩ := arm_matroid g hs  refine ⟨M, he, hi, ?_⟩  constructor  · intro hc x hx    obtain ⟨z, hz⟩ := hs (Classical.arbitrary κ)    rcases hc x (he ▸ trivial) z (he ▸ trivial) with h | ⟨C, hC, hxC, _⟩    · subst z; simp [hx] at hz    · have hI := hC.ssubset_indep (Set.sdiff_singleton_ssubset.mpr hxC)      apply hC.not_indep ((hi _).mpr ?_)      apply ((hi _).mp hI).anti      intro c hc' t ht      exact ⟨hc' t ht, by rintro rfl; simp [hx] at ht⟩  · intro hn x _ y _    obtain ⟨a, ha⟩ : ∃ a, g x = some a := by cases h : g x <;> simp_all    obtain ⟨b, hb⟩ : ∃ b, g y = some b := by cases h : g y <;> simp_all    right    by_cases h : a = b    · subst b      obtain ⟨c, hac⟩ := exists_ne a      exact ⟨_, arm_circuit hs he hi hac.symm, Or.inl ha, Or.inl hb⟩    · exact ⟨_, arm_circuit hs he hi h, Or.inl ha, Or.inr hb⟩
See it in the graphDiscuss this resultChallenge it