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.matroidturnsM' : IndepMatroid αintoM : Matroid αwithM'.Indep = M.Indep.IndepMatroid.ofFinitaryconstructs anIndepMatroidwhose associatedMatroidisFinitaryin the special case where independence of a set is determined only by that of its finite subsets. This construction uses Zorn's lemma.IndepMatroid.ofFinitaryCardAugmentis a variant ofIndepMatroid.ofFinitarywhere the augmentation axiom resembles the finite augmentation axiom.IndepMatroid.ofBddconstructs anIndepMatroidin 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 correspondingMatroidisRankFinite.IndepMatroid.ofBddAugmentis the same as the above, but with a finite augmentation axiom.IndepMatroid.ofFiniteconstructs anIndepMatroidfrom a finite ground set in terms of its independent sets.IndepMatroid.ofFinsetconstructs anIndepMatroid αwhose corresponding matroid isFinitaryfrom an independence predicate onFinset α.Matroid.ofExistsMatroidconstructs a 'copy' of a matroid that is known only existentially, but whose independence predicate is known explicitly.Matroid.ofExistsFiniteIsBaseconstructs a matroid from its bases, if it is known that one of them is finite. This gives aRankFinitematroid.Matroid.ofIsBaseOfFiniteconstructs aFinitematroid from its bases.
A matroid as defined by a ground set and an independence predicate.
This definition is an implementation detail whose purpose is to organize the multiple
different versions of the independence axioms;
usually, terms of type IndepMatroid should either be directly piped into IndepMatroid.matroid,
or should be constructed as a private definition
which is then converted into a matroid via IndepMatroid.matroid.
To define a Matroid α from a known independence predicate
MyIndep : Set α → Prop and ground set E : Set α, one can either write
def myMatroid (…) : Matroid α :=
IndepMatroid.matroid <| IndepMatroid.ofFoo E MyIndep _ _ … _
or, slightly more indirectly,
private def myIndepMatroid (…) : IndepMatroid α := IndepMatroid.ofFoo E MyIndep _ _ … _
def myMatroid (…) : Matroid α := (myIndepMatroid …).matroid
In both cases, IndepMatroid.ofFoo is either IndepMatroid.mk,
or one of the several other available constructors for IndepMatroid,
and the _ represent the proofs that this constructor requires.
After such a definition is made, the facts that myMatroid.Indep = myIndep and myMatroid.E = E
are true by either rfl or simp [myMatroid], and can be made directly into @[simp] lemmas.
- E : Set α
The ground set
The independence predicate
- indep_maximal (X : Set α) : 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
If Indep has the 'compactness' property that each set I satisfies Indep I if and only if
Indep J for every finite subset J of I,
then an IndepMatroid can be constructed without proving the maximality axiom.
This 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
An independence predicate satisfying the finite matroid axioms determines a matroid, provided independence is determined by its behaviour on finite sets.
Equations
- IndepMatroid.ofFinitaryCardAugment E Indep indep_empty indep_subset indep_aug indep_compact subset_ground = IndepMatroid.ofFinitary E Indep indep_empty indep_subset ⋯ indep_compact subset_ground
Instances For
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 RankFinite matroid.
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
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
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.ofFinitaryCardAugment 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 = (have 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.ofExistsFiniteIsBase E IsBase exists_finite_base isBase_exchange subset_ground = Matroid.ofBase E IsBase ⋯ isBase_exchange ⋯ subset_ground
Instances For
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.ofIsBaseOfFinite hE IsBase exists_isBase isBase_exchange subset_ground = Matroid.ofExistsFiniteIsBase E IsBase ⋯ isBase_exchange subset_ground