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
The proposition that elements of source
are mapped to elements of target
.
The proposition that elements of target
are mapped to elements of source
.
The proposition that invFun
is a left-inverse of toFun
on source
.
The proposition that invFun
is a right-inverse of toFun
on target
.
Equations
- One or more equations did not get rendered due to their size.
The inverse of a partial equivalence
Equations
- e.symm = { toFun := e.invFun, invFun := ↑e, source := e.target, target := e.source, map_source' := ⋯, map_target' := ⋯, left_inv' := ⋯, right_inv' := ⋯ }
Instances For
Equations
- PartialEquiv.instCoeFunForall = { coe := PartialEquiv.toFun }
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
- e.toPartialEquivOfImageEq s t h = { toFun := ⇑e, invFun := ⇑e.symm, source := s, target := t, map_source' := ⋯, map_target' := ⋯, left_inv' := ⋯, right_inv' := ⋯ }
Instances For
Associate a PartialEquiv
to an Equiv
.
Equations
- e.toPartialEquiv = e.toPartialEquivOfImageEq Set.univ Set.univ ⋯
Instances For
Equations
- PartialEquiv.inhabitedOfEmpty = { default := ((Equiv.equivEmpty α).trans (Equiv.equivEmpty β).symm).toPartialEquiv }
Create a copy of a PartialEquiv
providing better definitional equalities.
Equations
- e.copy f hf g hg s hs t ht = { toFun := f, invFun := g, source := s, target := t, map_source' := ⋯, map_target' := ⋯, left_inv' := ⋯, right_inv' := ⋯ }
Instances For
Associate to a PartialEquiv
an Equiv
between the source and the target.
Equations
- e.toEquiv = { toFun := fun (x : ↑e.source) => ⟨↑e ↑x, ⋯⟩, invFun := fun (y : ↑e.target) => ⟨↑e.symm ↑y, ⋯⟩, left_inv := ⋯, right_inv := ⋯ }
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
Instances For
Alias of the reverse direction of PartialEquiv.IsImage.iff_preimage_eq
.
Alias of the forward direction of PartialEquiv.IsImage.iff_preimage_eq
.
Alias of the forward direction of PartialEquiv.IsImage.iff_symm_preimage_eq
.
Alias of the reverse 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
- e.restr s = ⋯.restr
Instances For
The identity partial equivalence on a set s
Equations
- PartialEquiv.ofSet s = { toFun := id, invFun := id, source := s, target := s, map_source' := ⋯, map_target' := ⋯, left_inv' := ⋯, right_inv' := ⋯ }
Instances For
Composing two partial equivs if the target of the first coincides with the source of the second.
Equations
Instances For
Composing two partial equivs, by restricting to the maximal domain where their composition is well defined.
Equations
- e.trans e' = (e.symm.restr e'.source).symm.trans' (e'.restr e.target) ⋯
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.
Instances For
EqOnSource
is an equivalence relation. This instance provides the ≈
notation between two
PartialEquiv
s.
Equations
- PartialEquiv.eqOnSourceSetoid = { r := PartialEquiv.EqOnSource, iseqv := ⋯ }
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 equivalence 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
- Set.BijOn.toPartialEquiv f s t hf = { toFun := f, invFun := Function.invFunOn f s, source := s, target := t, map_source' := ⋯, map_target' := ⋯, left_inv' := ⋯, right_inv' := ⋯ }
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) ⋯
Instances For
Precompose a partial equivalence with an equivalence. We modify the source and target to have better definitional behavior.
Equations
Instances For
Postcompose a partial equivalence with an equivalence. We modify the source and target to have better definitional behavior.