Matroid Independence and Basis axioms #
Matroids in mathlib are defined axiomatically in terms of bases,
but can be described just as naturally via their collections of independent sets,
and in fact such a description, being more 'verbose', can often be useful.
As well as this, the definition of a Matroid
uses an unwieldy 'maximality'
axiom that can be dropped in cases where there is some finiteness assumption.
This file provides several ways to do define a matroid in terms of its independence or base
predicates, using axiom sets that are appropriate in different settings,
and often much simpler than the general definition.
It also contains simp
lemmas and typeclasses as appropriate.
All the independence axiom sets need nontriviality (the empty set is independent),
monotonicity (subsets of independent sets are independent),
and some form of 'augmentation' axiom, which allows one to enlarge a non-maximal independent set.
This augmentation axiom is still required when there are finiteness assumptions, but is simpler.
It just states that if I
is a finite independent set and J
is a larger finite
independent set, then there exists e ∈ J \ I
for which insert e I
is independent.
This is the axiom that appears in most of the definitions.
Implementation Details #
To facilitate building a matroid from its independent sets, we define a structure IndepMatroid
which has a ground set E
, an independence predicate Indep
, and some axioms as its fields.
This structure is another encoding of the data in a Matroid
; the function IndepMatroid.matroid
constructs a Matroid
from an IndepMatroid
.
This is convenient because if one wants to define M : Matroid α
from a known independence
predicate Ind
, it is easier to define an M' : IndepMatroid α
so that M'.Indep = Ind
and
then set M = M'.matroid
than it is to directly define M
with the base axioms.
The simp lemma IndepMatroid.matroid_indep_iff
is important here; it shows that M.Indep = Ind
,
so the Matroid
constructed is the right one, and the intermediate IndepMatroid
can be
made essentially invisible by the simplifier when working with M
.
Because of this setup, we don't define any API for IndepMatroid
, as it would be
a redundant copy of the existing API for Matroid.Indep
.
(In particular, one could define a natural equivalence e : IndepMatroid α ≃ Matroid α
with e.toFun = IndepMatroid.matroid
, but this would be pointless, as there is no need
for the inverse of e
).
Main definitions #
IndepMatroid α
is a matroid structure onα
described in terms of its independent sets in full generality, using infinite versions of the axioms.IndepMatroid.matroid
turnsM' : IndepMatroid α
intoM : Matroid α
withM'.Indep = M.Indep
.IndepMatroid.ofFinitary
constructs anIndepMatroid
whose associatedMatroid
isFinitary
in the special case where independence of a set is determined only by that of its finite subsets. This construction uses Zorn's lemma.IndepMatroid.ofBdd
constructs anIndepMatroid
in the case where there is some known absolute upper bound on the size of an independent set. This uses the infinite version of the augmentation axiom; the correspondingMatroid
isFiniteRk
.IndepMatroid.ofBddAugment
is the same as the above, but with a finite augmentation axiom.IndepMatroid.ofFinite
constructs anIndepMatroid
from a finite ground set in terms of its independent sets.IndepMatroid.ofFinset
constructs anIndepMatroid α
whose corresponding matroid isFinitary
from an independence predicate onFinset α
.Matroid.ofExistsMatroid
constructs a 'copy' of a matroid that is known only existentially, but whose independence predicate is known explicitly.Matroid.ofExistsFiniteBase
constructs a matroid from its bases, if it is known that one of them is finite. This gives aFiniteRk
matroid.Matroid.ofBaseOfFinite
constructs aFinite
matroid from its bases.
A matroid as defined by the independence axioms. This is the same thing as a Matroid
,
and so does not need its own API; it exists to make it easier to construct a matroid from its
independent sets. The constructed IndepMatroid
can then be converted into a matroid
with IndepMatroid.matroid
.
- E : Set α
The ground set
The independence predicate
- indep_empty : self.Indep ∅
- indep_maximal : ∀ X ⊆ self.E, Matroid.ExistsMaximalSubsetProperty self.Indep X
Instances For
An M : IndepMatroid α
gives a Matroid α
whose bases are the maximal M
-independent sets.
Equations
Instances For
An independence predicate satisfying the finite matroid axioms determines a matroid, provided independence is determined by its behaviour on finite sets. This fundamentally needs choice, since it can be used to prove that every vector space has a basis.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- ⋯ = ⋯
If there is an absolute upper bound on the size of an independent set, then the maximality axiom isn't needed to define a matroid by independent sets.
Equations
- One or more equations did not get rendered due to their size.
Instances For
IndepMatroid.ofBdd
constructs a FiniteRk
matroid.
Equations
- ⋯ = ⋯
If there is an absolute upper bound on the size of an independent set, then matroids can be defined using an 'augmentation' axiom similar to the standard definition of finite matroids for independent sets.
Equations
- IndepMatroid.ofBddAugment E Indep indep_empty indep_subset indep_aug indep_bdd subset_ground = IndepMatroid.ofBdd E Indep indep_empty indep_subset ⋯ subset_ground indep_bdd
Instances For
Equations
- ⋯ = ⋯
If E
is finite, then any collection of subsets of E
satisfying
the usual independence axioms determines a matroid
Equations
- IndepMatroid.ofFinite hE Indep indep_empty indep_subset indep_aug subset_ground = IndepMatroid.ofBddAugment E Indep indep_empty indep_subset ⋯ ⋯ subset_ground
Instances For
Equations
- ⋯ = ⋯
An independence predicate on Finset α
that obeys the finite matroid axioms determines a
finitary matroid on α
.
Equations
- IndepMatroid.ofFinset E Indep indep_empty indep_subset indep_aug subset_ground = IndepMatroid.ofFinitary E (fun (I : Set α) => ∀ (J : Finset α), ↑J ⊆ I → Indep J) ⋯ ⋯ ⋯ ⋯ ⋯
Instances For
This can't be @[simp]
, because it would cause the more useful
Matroid.ofIndepFinset_apply
not to be in simp normal form.
Construct an Matroid
from an independence predicate that agrees with that of some matroid M
.
This is computable even if M
is only known existentially, or when M
exists for different
reasons in different cases. This can also be used to change the independence predicate to a
more useful definitional form.
Equations
- Matroid.ofExistsMatroid E Indep hM = (let_fun hex := ⋯; { E := E, Indep := Indep, indep_empty := ⋯, indep_subset := ⋯, indep_aug := ⋯, indep_maximal := ⋯, subset_ground := ⋯ }).matroid
Instances For
A matroid defined purely in terms of its bases.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A collection of bases with the exchange property and at least one finite member is a matroid
Equations
- Matroid.ofExistsFiniteBase E Base exists_finite_base base_exchange subset_ground = Matroid.ofBase E Base ⋯ base_exchange ⋯ subset_ground
Instances For
Equations
- ⋯ = ⋯
If E
is finite, then any nonempty collection of its subsets
with the exchange property is the collection of bases of a matroid on E
.
Equations
- Matroid.ofBaseOfFinite hE Base exists_base base_exchange subset_ground = Matroid.ofExistsFiniteBase E Base ⋯ base_exchange subset_ground
Instances For
Equations
- ⋯ = ⋯