Skip to content

Commit efeadfb

Browse files
committed
feat(Data/Matroid/Constructions): Instances for basic matroids (#20886)
We add some instances for the matroids in `Data/Matroid/Constructions`, and also a `RkPos -> Nonempty` instance in `Matroid.Basic`.
1 parent 5ef6d7d commit efeadfb

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

Mathlib/Data/Matroid/Basic.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ instance finiteRk_of_finite (M : Matroid α) [M.Finite] : FiniteRk M :=
263263
/-- The empty set isn't a base -/
264264
empty_not_base : ¬M.Base ∅
265265

266+
instance rkPos_nonempty {M : Matroid α} [M.RkPos] : M.Nonempty := by
267+
obtain ⟨B, hB⟩ := M.exists_base
268+
obtain rfl | ⟨e, heB⟩ := B.eq_empty_or_nonempty
269+
· exact False.elim <| RkPos.empty_not_base hB
270+
exact ⟨e, M.subset_ground B hB heB ⟩
271+
266272
@[deprecated (since := "2025-01-20")] alias rkPos_iff_empty_not_base := rkPos_iff
267273

268274
section exchange

Mathlib/Data/Matroid/Constructions.lean

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ theorem eq_loopyOn_or_rkPos (M : Matroid α) : M = loopyOn M.E ∨ RkPos M := by
128128
theorem not_rkPos_iff : ¬RkPos M ↔ M = loopyOn M.E := by
129129
rw [rkPos_iff, not_iff_comm, empty_base_iff]
130130

131+
instance loopyOn_finiteRk : FiniteRk (loopyOn E) :=
132+
⟨∅, by simp⟩
133+
131134
end LoopyOn
132135

133136
section FreeOn
@@ -183,6 +186,13 @@ theorem restrict_eq_freeOn_iff : M ↾ I = freeOn I ↔ M.Indep I := by
183186
theorem Indep.restrict_eq_freeOn (hI : M.Indep I) : M ↾ I = freeOn I := by
184187
rwa [restrict_eq_freeOn_iff]
185188

189+
instance freeOn_finitary : Finitary (freeOn E) := by
190+
simp only [finitary_iff, freeOn_indep_iff]
191+
exact fun I h e heI ↦ by simpa using h {e} (by simpa)
192+
193+
lemma freeOn_rkPos (hE : E.Nonempty) : RkPos (freeOn E) := by
194+
simp [rkPos_iff, hE.ne_empty.symm]
195+
186196
end FreeOn
187197

188198
section uniqueBaseOn
@@ -243,6 +253,20 @@ theorem uniqueBaseOn_restrict (h : I ⊆ E) (R : Set α) :
243253
(uniqueBaseOn I E) ↾ R = uniqueBaseOn (I ∩ R) R := by
244254
rw [uniqueBaseOn_restrict', inter_right_comm, inter_eq_self_of_subset_left h]
245255

256+
lemma uniqueBaseOn_finiteRk (hI : I.Finite) : FiniteRk (uniqueBaseOn I E) := by
257+
rw [← uniqueBaseOn_inter_ground_eq]
258+
refine ⟨I ∩ E, ?_⟩
259+
rw [uniqueBaseOn_base_iff inter_subset_right, and_iff_right rfl]
260+
exact hI.subset inter_subset_left
261+
262+
instance uniqueBaseOn_finitary : Finitary (uniqueBaseOn I E) := by
263+
refine ⟨fun K hK ↦ ?_⟩
264+
simp only [uniqueBaseOn_indep_iff'] at hK ⊢
265+
exact fun e heK ↦ singleton_subset_iff.1 <| hK _ (by simpa) (by simp)
266+
267+
lemma uniqueBaseOn_rkPos (hIE : I ⊆ E) (hI : I.Nonempty) : RkPos (uniqueBaseOn I E) where
268+
empty_not_base := by simpa [uniqueBaseOn_base_iff hIE] using Ne.symm <| hI.ne_empty
269+
246270
end uniqueBaseOn
247271

248272
end Matroid

0 commit comments

Comments
 (0)