Download data/lean/OAI/Combinatorics/InfiniteMatroid/Matroid.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.45 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/InfiniteMatroid/Matroid.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/InfiniteMatroid/Matroid.lean
-
curl -L -o Matroid.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/InfiniteMatroid/Matroid.lean
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 | |