Partial equivalences #
This files defines equivalences between subsets of given types.
An element e
of PartialEquiv α β
is made of two maps e.toFun
and e.invFun
respectively
from α to β and from β to α (just like equivs), which are inverse to each other on the subsets
e.source
and e.target
of respectively α and β.
They are designed in particular to define charts on manifolds.
The main functionality is e.trans f
, which composes the two partial equivalences by restricting
the source and target to the maximal set where the composition makes sense.
As for equivs, we register a coercion to functions and use it in our simp normal form: we write
e x
and e.symm y
instead of e.toFun x
and e.invFun y
.
Main definitions #
Equiv.toPartialEquiv
: associating a partial equiv to an equiv, with source = target = univPartialEquiv.symm
: the inverse of a partial equivalencePartialEquiv.trans
: the composition of two partial equivalencesPartialEquiv.refl
: the identity partial equivalencePartialEquiv.ofSet
: the identity on a sets
EqOnSource
: equivalence relation describing the "right" notion of equality for partial equivalences (see below in implementation notes)
Implementation notes #
There are at least three possible implementations of partial equivalences:
- equivs on subtypes
- pairs of functions taking values in
Option α
andOption β
, equal to none where the partial equivalence is not defined - pairs of functions defined everywhere, keeping the source and target as additional data
Each of these implementations has pros and cons.
- When dealing with subtypes, one still need to define additional API for composition and
restriction of domains. Checking that one always belongs to the right subtype makes things very
tedious, and leads quickly to DTT hell (as the subtype
u ∩ v
is not the "same" asv ∩ u
, for instance). - With option-valued functions, the composition is very neat (it is just the usual composition, and
the domain is restricted automatically). These are implemented in
PEquiv.lean
. For manifolds, where one wants to discuss thoroughly the smoothness of the maps, this creates however a lot of overhead as one would need to extend all classes of smoothness to option-valued maps. - The
PartialEquiv
version as explained above is easier to use for manifolds. The drawback is that there is extra useless data (the values oftoFun
andinvFun
outside ofsource
andtarget
). In particular, the equality notion between partial equivs is not "the right one", i.e., coinciding source and target and equality there. Moreover, there are no partial equivs in this sense between an empty type and a nonempty type. Since empty types are not that useful, and since one almost never needs to talk about equal partial equivs, this is not an issue in practice. Still, we introduce an equivalence relationEqOnSource
that captures this right notion of equality, and show that many properties are invariant under this equivalence relation.
Local coding conventions #
If a lemma deals with the intersection of a set with either source or target of a PartialEquiv
,
then it should use e.source ∩ s
or e.target ∩ t
, not s ∩ e.source
or t ∩ e.target
.
Implementation of the mfld_set_tac
tactic for working with the domains of partially-defined
functions (PartialEquiv
, PartialHomeomorph
, etc).
This is in a separate file from Mathlib.Logic.Equiv.MfldSimpsAttr
because attributes need a new
file to become functional.
Common @[simps]
configuration options used for manifold-related declarations.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A very basic tactic to show that sets showing up in manifolds coincide or are included in one another.
Equations
- Tactic.MfldSetTac.mfldSetTac = Lean.ParserDescr.node `Tactic.MfldSetTac.mfldSetTac 1024 (Lean.ParserDescr.nonReservedSymbol "mfld_set_tac" false)
Instances For
Local equivalence between subsets source
and target
of α
and β
respectively. The
(global) maps toFun : α → β
and invFun : β → α
map source
to target
and conversely, and are
inverse to each other there. The values of toFun
outside of source
and of invFun
outside of
target
are irrelevant.
- toFun : α → β
The global function which has a partial inverse. Its value outside of the
source
subset is irrelevant. - invFun : β → α
- source : Set α
The domain of the partial equivalence.
- target : Set β
The codomain of the partial equivalence.
Instances For
Equations
- One or more equations did not get rendered due to their size.
The inverse of a partial equivalence
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- PartialEquiv.instCoeFunPartialEquivForAll = { coe := PartialEquiv.toFun }
See Note [custom simps projection]
Equations
Instances For
Variant of e.map_source
and map_source'
, stated for images of subsets of source
.
Interpret an Equiv
as a PartialEquiv
by restricting it to s
in the domain
and to t
in the codomain.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Associate a PartialEquiv
to an Equiv
.
Equations
- Equiv.toPartialEquiv e = Equiv.toPartialEquivOfImageEq e Set.univ Set.univ (_ : ⇑e '' Set.univ = Set.univ)
Instances For
Equations
- PartialEquiv.inhabitedOfEmpty = { default := Equiv.toPartialEquiv ((Equiv.equivEmpty α).trans (Equiv.equivEmpty β).symm) }
Create a copy of a PartialEquiv
providing better definitional equalities.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Associate to a PartialEquiv
an Equiv
between the source and the target.
Equations
- One or more equations did not get rendered due to their size.
Instances For
We say that t : Set β
is an image of s : Set α
under a partial equivalence if
any of the following equivalent conditions hold:
e '' (e.source ∩ s) = e.target ∩ t
;e.source ∩ e ⁻¹ t = e.source ∩ s
;∀ x ∈ e.source, e x ∈ t ↔ x ∈ s
(this one is used in the definition).
Instances For
Restrict a PartialEquiv
to a pair of corresponding sets.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Alias of the forward direction of PartialEquiv.IsImage.iff_preimage_eq
.
Alias of the reverse direction of PartialEquiv.IsImage.iff_preimage_eq
.
Alias of the reverse direction of PartialEquiv.IsImage.iff_symm_preimage_eq
.
Alias of the forward direction of PartialEquiv.IsImage.iff_symm_preimage_eq
.
Two partial equivs that have the same source
, same toFun
and same invFun
, coincide.
Restricting a partial equivalence to e.source ∩ s
Equations
- PartialEquiv.restr e s = PartialEquiv.IsImage.restr (_ : PartialEquiv.IsImage e s (↑(PartialEquiv.symm e) ⁻¹' s))
Instances For
The identity partial equiv
Equations
Instances For
The identity partial equivalence on a set s
Equations
- One or more equations did not get rendered due to their size.
Instances For
Composing two partial equivs if the target of the first coincides with the source of the second.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Composing two partial equivs, by restricting to the maximal domain where their composition is well defined.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A lemma commonly useful when e
and e'
are charts of a manifold.
EqOnSource e e'
means that e
and e'
have the same source, and coincide there. Then e
and e'
should really be considered the same partial equiv.
Equations
- PartialEquiv.EqOnSource e e' = (e.source = e'.source ∧ Set.EqOn (↑e) (↑e') e.source)
Instances For
EqOnSource
is an equivalence relation. This instance provides the ≈
notation between two
PartialEquiv
s.
Equations
- PartialEquiv.eqOnSourceSetoid = { r := PartialEquiv.EqOnSource, iseqv := (_ : Equivalence PartialEquiv.EqOnSource) }
Two equivalent partial equivs have the same source.
Two equivalent partial equivs coincide on the source.
Two equivalent partial equivs have the same target.
If two partial equivs are equivalent, so are their inverses.
Two equivalent partial equivs have coinciding inverses on the target.
Composition of partial equivs respects equivalence.
Restriction of partial equivs respects equivalence.
Preimages are respected by equivalence.
Composition of a partial equivlance and its inverse is equivalent to the restriction of the identity to the source.
Composition of the inverse of a partial equivalence and this partial equivalence is equivalent to the restriction of the identity to the target.
Two equivalent partial equivs are equal when the source and target are univ
.
The product of two partial equivalences, as a partial equivalence on the product.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Combine two PartialEquiv
s using Set.piecewise
. The source of the new PartialEquiv
is
s.ite e.source e'.source = e.source ∩ s ∪ e'.source \ s
, and similarly for target. The function
sends e.source ∩ s
to e.target ∩ t
using e
and e'.source \ s
to e'.target \ t
using e'
,
and similarly for the inverse function. The definition assumes e.isImage s t
and
e'.isImage s t
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Combine two PartialEquiv
s with disjoint sources and disjoint targets. We reuse
PartialEquiv.piecewise
, then override source
and target
to ensure better definitional
equalities.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The product of a family of partial equivalences, as a partial equivalence on the pi type.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A bijection between two sets s : Set α
and t : Set β
provides a partial equivalence
between α
and β
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A map injective on a subset of its domain provides a partial equivalence.
Equations
- Set.InjOn.toPartialEquiv f s hf = Set.BijOn.toPartialEquiv f s (f '' s) (_ : Set.BijOn f s (f '' s))
Instances For
Precompose a partial equivalence with an equivalence. We modify the source and target to have better definitional behavior.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Postcompose a partial equivalence with an equivalence. We modify the source and target to have better definitional behavior.
Equations
- One or more equations did not get rendered due to their size.