introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
4.45 kB
import OAI.Combinatorics.InfiniteMatroid.Basic
namespace OAI
section
open Set Matroid
namespace InfiniteMatroidCounterexample
def IntervalAlternative {Ξ± : Type*} (Bases : Set (Set Ξ±)) : Prop :=
βˆ€ I Y, I βŠ† Y β†’ (Y \ I).Infinite β†’
βˆƒ B ∈ Bases, B βŠ† I ∨ (I βŠ† B ∧ B βŠ† Y) ∨ Y βŠ† B
/-- The purely set-theoretic assumptions supplied by the prototype assembly. -/
structure BasisSystem (Ξ± : Type*) where
bases : Set (Set Ξ±)
nonempty : bases.Nonempty
antichain : βˆ€ ⦃B C⦄, B ∈ bases β†’ C ∈ bases β†’ B βŠ† C β†’ B = C
compl_closed : βˆ€ ⦃B⦄, B ∈ bases β†’ Bᢜ ∈ bases
swap : βˆ€ ⦃B⦄, B ∈ bases β†’ βˆ€ e ∈ B, βˆ€ f βˆ‰ B, insert f (B \ {e}) ∈ bases
intervals : IntervalAlternative bases
namespace BasisSystem
variable {Ξ± : Type*} (S : BasisSystem Ξ±)
def Independent (I : Set Ξ±) : Prop := βˆƒ B ∈ S.bases, I βŠ† B
lemma independent_mono {I J : Set Ξ±} (hJ : S.Independent J) (hIJ : I βŠ† J) :
S.Independent I := by
obtain ⟨B, hB, hJB⟩ := hJ
exact ⟨B, hB, hIJ.trans hJB⟩
lemma maximal_of_base {B : Set Ξ±} (hB : B ∈ S.bases) {Y : Set Ξ±} (hBY : B βŠ† Y) :
Maximal (fun K ↦ S.Independent K ∧ K βŠ† Y) B := by
refine ⟨⟨⟨B, hB, Subset.rfl⟩, hBY⟩, ?_⟩
intro C hC hBC
obtain ⟨B', hB', hCB'⟩ := hC.1
have heq := S.antichain hB hB' (hBC.trans hCB')
exact heq β–Έ hCB'
lemma exists_maximal_finite_gap {I Y : Set Ξ±} (hI : S.Independent I) (hIY : I βŠ† Y)
(hgap : (Y \ I).Finite) :
βˆƒ J, I βŠ† J ∧ Maximal (fun K ↦ S.Independent K ∧ K βŠ† Y) J := by
let F : Set (Set Ξ±) := {J | I βŠ† J ∧ S.Independent J ∧ J βŠ† Y}
have hF : F.Finite := by
apply ((hgap.finite_subsets).image (fun H ↦ I βˆͺ H)).subset
intro J hJ
refine ⟨J \ I, (fun x hx ↦ ⟨hJ.2.2 hx.1, hx.2⟩), ?_⟩
ext x
simp only [Set.mem_union, Set.mem_sdiff]
have := @hJ.1 x
tauto
obtain ⟨J, hJ, hmax⟩ := hF.exists_maximal ⟨I, Subset.rfl, hI, hIY⟩
refine ⟨J, hJ.1, ⟨hJ.2, ?_⟩⟩
intro K hK hJK
exact hmax ⟨hJ.1.trans hJK, hK⟩ hJK
lemma exists_maximal {I Y : Set Ξ±} (hI : S.Independent I) (hIY : I βŠ† Y) :
βˆƒ J, I βŠ† J ∧ Maximal (fun K ↦ S.Independent K ∧ K βŠ† Y) J := by
by_cases hgap : (Y \ I).Finite
Β· exact S.exists_maximal_finite_gap hI hIY hgap
obtain ⟨B, hB, hBI | ⟨hIB, hBY⟩ | hYB⟩ := S.intervals I Y hIY hgap
· obtain ⟨B', hB', hIB'⟩ := hI
have heq := S.antichain hB hB' (hBI.trans hIB')
have hIB : I βŠ† B := heq β–Έ hIB'
exact ⟨B, hIB, S.maximal_of_base hB (hBI.trans hIY)⟩
· exact ⟨B, hIB, S.maximal_of_base hB hBY⟩
· refine ⟨Y, hIY, ⟨⟨⟨B, hB, hYB⟩, Subset.rfl⟩, ?_⟩⟩
exact fun _ h _ ↦ h.2
lemma exchange : Matroid.ExchangeProperty (· ∈ S.bases) := by
intro B C hB hC e he
have hn : Β¬ C βŠ† B := by
intro hCB
have heq := S.antichain hC hB hCB
exact he.2 (heq β–Έ he.1)
obtain ⟨f, hfC, hfB⟩ := Set.not_subset.mp hn
exact ⟨f, ⟨hfC, hfB⟩, S.swap hB e he.1 f hfB⟩
noncomputable def matroid : Matroid Ξ± :=
Matroid.ofBase univ (· ∈ S.bases) S.nonempty S.exchange
(fun _ _ _ hI hIY ↦ S.exists_maximal hI hIY)
(fun _ _ ↦ subset_univ _)
@[simp] lemma ground : S.matroid.E = univ := rfl
@[simp] lemma isBase_iff (B : Set Ξ±) : S.matroid.IsBase B ↔ B ∈ S.bases := Iff.rfl
@[simp] lemma indep_iff (I : Set Ξ±) : S.matroid.Indep I ↔ S.Independent I := Iff.rfl
lemma self_dual : S.matroid.dual = S.matroid := by
apply Matroid.ext_isBase Matroid.dual_ground
intro B _
rw [Matroid.dual_isBase_iff, ground, ← Set.compl_eq_univ_sdiff, isBase_iff, isBase_iff]
exact ⟨fun h ↦ by simpa using S.compl_closed h, fun h ↦ S.compl_closed h⟩
lemma insert_indep_of_not_base {I : Set Ξ±} (hI : S.matroid.Indep I)
(hnot : Β¬ S.matroid.IsBase I) (e : Ξ±) : S.matroid.Indep (insert e I) := by
obtain ⟨B, hB, hIB⟩ := hI
by_cases heB : e ∈ B
· exact ⟨B, hB, Set.insert_subset heB hIB⟩
have hn : Β¬ B βŠ† I := by
intro hBI
exact hnot ((Subset.antisymm hIB hBI) β–Έ hB)
obtain ⟨f, hfB, hfI⟩ := Set.not_subset.mp hn
refine ⟨insert e (B \ {f}), S.swap hB f hfB e heB, ?_⟩
intro x hx
rcases hx with rfl | hx
Β· exact Set.mem_insert _ _
Β· right
exact ⟨hIB hx, fun hxf ↦ hfI (Set.mem_singleton_iff.mp hxf β–Έ hx)⟩
end BasisSystem
end InfiniteMatroidCounterexample
end
end OAI