sagemath/sage

Pullbacks (preimages) of manifold subsets under continuous maps

mkoeppe opened this issue · 115 comments

Similar to #31653, given a continuous map \Phi: N -> M and a manifold subset S of M, we define the pullback (preimage) of S as the subset of N of points p with \Phi(p) in S.

Given a real scalar field Phi: N -> R and a RealSet S, we define the pullback in the same way.

Also, we view a chart C as a continuous function Phi: C.domain() -> R^n and allow pulling back any subset of R^n (an object with a __contains__ method; for example polyhedra, lattices, linear subspaces, tensor modules) by it as well.

In all cases, because Phi is continuous, topological closures/interiors pull back.

An application is in #31981.

Depends on #31883
Depends on #31904
Depends on #31653
Depends on #31916
Depends on #31644
Depends on #31959
Depends on #31990
Depends on #21243

CC: @egourgoulhon @tscrim @mjungmath

Component: manifolds

Author: Matthias Koeppe

Branch/Commit: 4558e26

Reviewer: Eric Gourgoulhon

Issue created by migration from https://trac.sagemath.org/ticket/31688

Description changed:

--- 
+++ 
@@ -1,2 +1,7 @@
 Similar to #31653, given a continuous map `\Phi: N -> M` and a manifold subset `S` of `M`, we define the pullback (preimage) of `S` as the subset of `N` of points `p` with `\Phi(p)` in `S`.
 
+Given a real scalar field `Phi: N -> R` and a RealSet `S`, we define the pullback in the same way.
+
+In both cases, because `Phi` is continuous, topological closures/interiors pull back.
+
+

Dependencies: #31883

Branch pushed to git repo; I updated commit sha1. New commits:

1942c71ScalarField.codomain: New, put scalar fields in category of continuous maps
8829d72Merge #31883
941001bManifoldSubsetPullback: More WIP

Author: Matthias Koeppe

Description changed:

--- 
+++ 
@@ -1,6 +1,6 @@
 Similar to #31653, given a continuous map `\Phi: N -> M` and a manifold subset `S` of `M`, we define the pullback (preimage) of `S` as the subset of `N` of points `p` with `\Phi(p)` in `S`.
 
-Given a real scalar field `Phi: N -> R` and a RealSet `S`, we define the pullback in the same way.
+Given a real scalar field `Phi: N -> R` and a `RealSet` `S`, we define the pullback in the same way.
 
 In both cases, because `Phi` is continuous, topological closures/interiors pull back.
 

Changed commit from 941001b to 90f763f

Branch pushed to git repo; I updated commit sha1. New commits:

90f763fManifoldSubsetPullback.__contains__: New

Branch pushed to git repo; I updated commit sha1. New commits:

ff34765ManifoldSubsetPullback: In `__classcall_private__`, make immutable copies of the maps
b8dadf3ScalarField.pullback, ContinuousMap.pullback: New

Changed commit from 90f763f to b8dadf3

Branch pushed to git repo; I updated commit sha1. New commits:

5abb86dManifoldSubsetPullback: More WIP

Changed commit from b8dadf3 to 5abb86d

Branch pushed to git repo; I updated commit sha1. New commits:

e597e6dManifoldSubsetPullback: Allow pulling back by charts, pulling back polyehdra

Changed commit from 5abb86d to e597e6d

Description changed:

--- 
+++ 
@@ -2,6 +2,8 @@
 
 Given a real scalar field `Phi: N -> R` and a `RealSet` `S`, we define the pullback in the same way.
 
-In both cases, because `Phi` is continuous, topological closures/interiors pull back.
+Also, we view a chart `C` as a continuous function `Phi: C.domain() -> R^n` and allow pulling back by it as well. 
+
+In all cases, because `Phi` is continuous, topological closures/interiors pull back.
 
 

Description changed:

--- 
+++ 
@@ -2,7 +2,7 @@
 
 Given a real scalar field `Phi: N -> R` and a `RealSet` `S`, we define the pullback in the same way.
 
-Also, we view a chart `C` as a continuous function `Phi: C.domain() -> R^n` and allow pulling back by it as well. 
+Also, we view a chart `C` as a continuous function `Phi: C.domain() -> R^n` and allow pulling back any subset of `R^n` (an object with a `__contains__` method; for example polyhedra) by it as well. 
 
 In all cases, because `Phi` is continuous, topological closures/interiors pull back.
 

Branch pushed to git repo; I updated commit sha1. New commits:

1623cc5ManifoldSubsetPullback: Move computation of names to __classcall_private__

Changed commit from e597e6d to 1623cc5

Branch pushed to git repo; I updated commit sha1. New commits:

dcc1f9aManifoldSubsetPullback: Prepare for pullbacks of opens

Changed commit from 1623cc5 to dcc1f9a

Changed commit from dcc1f9a to a2dd182

Branch pushed to git repo; I updated commit sha1. New commits:

a2dd182ManifoldSubsetPullback: Recognize more closed sets

Changed dependencies from #31883 to #31883, #31904

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

459758eImageManifoldSubset, ContinuousMap.image: Add optional 'inverse' argument, use it in __contains__
26c7e56src/sage/manifolds/continuous_map_image.py: Update doctests
3e273bbTopologicalSubmanifold.as_subset: New
9726d36Docstring work
19762aeImageManifoldSubset: New parameter domain_subset, use it in ContinuousMap.image
964f9f7src/sage/manifolds/continuous_map.py: Update copyright
e711215src/sage/manifolds/continuous_map_image.py: Add tests
0f3e36dLink in documentation of sage.manifolds.continuous_map_image
4a13d8bMerge #31653
79232dbContinuousMap.preimage: New, make pullback an alias; add example

Changed commit from a2dd182 to 79232db

Changed dependencies from #31883, #31904 to #31883, #31904, #31653

Description changed:

Branch pushed to git repo; I updated commit sha1. New commits:

3c6666aManifoldSubsetPullback: Make pullback of open RealSet under a ScalarField an open set

Changed commit from 79232db to 3c6666a

Changed commit from 3c6666a to e95c897

Branch pushed to git repo; I updated commit sha1. New commits:

235d75aManifoldSubsetPullback.closure: Adjust doctest
aea4554#31904: Fix indentation in _pullback_chart
e95c897Merge #31904

Description changed:

--- 
+++ 
@@ -2,7 +2,7 @@
 
 Given a real scalar field `Phi: N -> R` and a `RealSet` `S`, we define the pullback in the same way.
 
-Also, we view a chart `C` as a continuous function `Phi: C.domain() -> R^n` and allow pulling back any subset of `R^n` (an object with a `__contains__` method; for example polyhedra) by it as well. 
+Also, we view a chart `C` as a continuous function `Phi: C.domain() -> R^n` and allow pulling back any subset of `R^n` (an object with a `__contains__` method; for example polyhedra, lattices, or linear subspaces) by it as well. 
 
 In all cases, because `Phi` is continuous, topological closures/interiors pull back.
 

Changed commit from e95c897 to ff5eb8b

Branch pushed to git repo; I updated commit sha1. New commits:

ff5eb8bManifoldSubsetPullback: Add doctests

Changed commit from ff5eb8b to c268d34

Branch pushed to git repo; I updated commit sha1. New commits:

c268d34ManifoldSubsetPullback: Fix example using the embedding map

Branch pushed to git repo; I updated commit sha1. New commits:

56b22a3ManifoldSubsetPullback.__classcall_private__: Add doc
762e0a8ManifoldSubsetPullback.__init__: Add tests
2a01a07ManifoldSubsetPullback._an_element_: New

Changed commit from c268d34 to 2a01a07

comment:24

This is not quite ready yet, but comments are very welcome

Changed commit from 2a01a07 to acc71c3

Branch pushed to git repo; I updated commit sha1. New commits:

e9c670csage.geometry.polyhedron.relint, Polyhedron_base.relative_interior, Polyhedron_base.interior: New
86fc6cdMerge #31916
acc71c3ManifoldSubsetPullback: Pulling back interiors of polyhedra

Changed dependencies from #31883, #31904, #31653 to #31883, #31904, #31653, #31916

comment:27

For a possible follow-up, it might be a good idea to bear in mind that the preimage of a regular value of a differentiable map between manifolds of dimension n and m respectively is a differentiable manifold of dimension n-m again.

Branch pushed to git repo; I updated commit sha1. New commits:

9df2104sage.geometry.relative_interior: Move here from sage.geometry.polyhedron.relint
b8bfe20ConvexRationalPolyhedralCone: Add methods interior, relative_interior
6869673relative_interior: Fix for dimension 0
021d073RelativeInterior: Add documentation, tests, comparison methods, method relative_interior
8f38e04ConvexRationalPolyhedralCone.interior, relative_interior: Add doctests
3a5870eMerge #31916

Changed commit from acc71c3 to 3a5870e

Description changed:

--- 
+++ 
@@ -2,7 +2,7 @@
 
 Given a real scalar field `Phi: N -> R` and a `RealSet` `S`, we define the pullback in the same way.
 
-Also, we view a chart `C` as a continuous function `Phi: C.domain() -> R^n` and allow pulling back any subset of `R^n` (an object with a `__contains__` method; for example polyhedra, lattices, or linear subspaces) by it as well. 
+Also, we view a chart `C` as a continuous function `Phi: C.domain() -> R^n` and allow pulling back any subset of `R^n` (an object with a `__contains__` method; for example polyhedra, lattices, linear subspaces, tensor modules) by it as well. 
 
 In all cases, because `Phi` is continuous, topological closures/interiors pull back.
 

Branch pushed to git repo; I updated commit sha1. New commits:

d11280esrc/sage/manifolds/subsets/pullback.py: Fixup import
cd3ca79Update doctests for refined category of ScalarField
105bb8bMerge #31883
5f9c852RelativeInterior.interior: New
5c089ecRelativeInterior.__eq__, __ne__: Handle comparisons with objects of other types
86ce301Polyhedron_base.is_relatively_open: New; fix relative_interior for affine subspaces
216cb81ConvexRationalPolyhedralCone.is_relatively_open: New, fix ConvexRationalPolyhedralCone.relative_interior for linear subspaces
44cde1esrc/doc/en/reference/discrete_geometry/index.rst: Add sage/geometry/relative_interior
fa4c2d2Whitespace fixes
e802a21Merge #31916

Changed commit from 3a5870e to e802a21

Description changed:

--- 
+++ 
@@ -7,3 +7,5 @@
 In all cases, because `Phi` is continuous, topological closures/interiors pull back.
 
 
+An application is in #31981.
+

Changed dependencies from #31883, #31904, #31653, #31916 to #31883, #31904, #31653, #31916, #31959

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

6bef52bConvexSet_base._test_convex_set: Run the testsuite of relint
6ab5677RelativeInterior.is_universe: New
c085d30Polyhedron_base.interior: Handle the empty polyhedron correctly
686d0afPolyhedron_base.product: Add doctest for alias 'cartesian_product'
2b1d108Merge #31919
7323b10ConvexSet_base._test_contains: Only test extension to AA for exact base rings
e0d2eebMerge #31959
e6c3ed5RelativeInterior.__hash__: New
4c7d57fsrc/sage/geometry/relative_interior.py: Fix doctest output
9ea0ceaManifoldSubsetPullback: Do not trip over relative interiors of cones

Changed commit from e802a21 to 9ea0cea

comment:34

As revealed by the patchbot, there are some doctest failures, as well as some coverage and pyflakes issues.

Changed commit from 9ea0cea to d591234

Branch pushed to git repo; I updated commit sha1. New commits:

94e6858RelativeInterior.ambient, ambient_vector_space, is_universe: New
0c9bc94ConvexSet_base: Add default implementations of ambient, ambient_dim; add doctests
d591234Merge #31959
comment:36

Thanks for taking a look! Yes, I'll have to add more documentation and examples.

Branch pushed to git repo; I updated commit sha1. New commits:

87f3e30ManifoldSubsetPullback: Add documentation and tests

Changed commit from d591234 to 87f3e30

Changed dependencies from #31883, #31904, #31653, #31916, #31959 to #31883, #31904, #31653, #31916, #31959, #31990

Branch pushed to git repo; I updated commit sha1. New commits:

7d3ae5cMerge #31959
2b1040cConvexSet_base.{an_element,some_elements}, Polyhedron.some_elements, RelativeInterior.some_elements: New
a884517PolyhedronFace.some_elements: New
f6cc8f7Merge #31990
1a4805cManifoldSubsetPullback: For charts, use .point as the inverse
754e002ManifoldSubsetPullback._an_element_, some_elements: Implement

Changed commit from 87f3e30 to 754e002

Changed commit from 754e002 to a8e607c

Branch pushed to git repo; I updated commit sha1. New commits:

a8e607cManifoldSubsetPullback._coord_def: Add documentation and examples

Branch pushed to git repo; I updated commit sha1. New commits:

ce91e44src/sage/geometry/relative_interior.py: Fix doctest output
b19b3ccMerge #31959
c49ab33Merge #31990

Changed commit from a8e607c to c49ab33

Changed commit from c49ab33 to 7ae21da

Branch pushed to git repo; I updated commit sha1. New commits:

f0e7c58ambient_vector_space docstring: Fix bad blocks
200d967ConvexSet_base.ambient doctest: Actually test the method
1c2bef5Merge #31959
ed898e6ConvexSet_base.an_element, some_elements: Go through generator method `_some_elements_`, make some_elements return a list
7ae21daMerge #31990

Reviewer: Eric Gourgoulhon

comment:44

Thanks for the last changes.
Some comments regarding the documentation:

  • there is no entry for the class ManifoldSubsetPullback in the reference manual
  • in the files continuous_map.py and subsets/pullback.py, each instance of :class:`ManifoldSubset` should be replaced by :class:`~sage.manifolds.subset.ManifoldSubset`
  • the docstring of ScalarField.pullback should have an INPUT and OUTPUT sections similar to those of ContinuousMap.preimage. By the way, to be consistent with ContinuousMap.preimage, shouldn't ScalarField.pullback be renamed to ScalarField.preimage, with pullback defined as an alias to preimage?
  • the INPUT and OUTPUT sections of DiffMap.pullback should be updated to take into account the new arguments.

Changed commit from 7ae21da to 3877c5f

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

8d3ad85Merge #31764
60505b0Merge #31798
b9909c0ManifoldSubsetClosure: Add examples, fix docstring markup
16c6a72ManifoldSubsetClosure, ManifoldSubset.closure: Improve documentation
2514586Merge #31644
3ca139asrc/doc/en/reference/manifolds: Add pullback
1d430eesrc/sage/manifolds/continuous_map.py, src/sage/manifolds/subsets: Use qualified class name in docstrings
1266de9src/sage/geometry/convex_set.py: Fix docstring markup
df64125ScalarField.preimage: Make pullback an alias; expand documentation
3877c5fManifoldSubsetPullback.is_closed: Remove unfinished NNC_Polyhedron example

Branch pushed to git repo; I updated commit sha1. New commits:

0c549f0Chart.pullback, preimage: New
7bb720eManifoldSubsetPullback.__contains__: Handle the case of charts, which return tuples of coordinates, not vectors
60ea044ContinuousMap.preimage, ScalarField.preimage: Document that output can also be a manifold

Changed commit from 3877c5f to 60ea044

Branch pushed to git repo; I updated commit sha1. New commits:

5b8cecaInternalRealInterval, RealSet: Add `_latex_` methods
69ca854RealSet._repr_: Use unicode cup sign instead of +
dbdfc06InternalRealInterval, RealSet: Remove extra whitespace in latex, add documentation
a0e3bf5Merge #31880
181b128RealSet.is_open, is_closed, closure, interior, boundary: New
7f56338PiecewiseFunction: Adjust doctests for changed RealSet repr
8cd74b5Merge #31880
8fdb104RealSet.boundary: Add another doctest
9d41f0esrc/sage/sets/real_set.py: Remove unnecessary import
c36e43bMerge #21243

Changed commit from 60ea044 to c36e43b

comment:50

In the docstring of ManifoldSubsetPullback:

  • in the INPUT section, there seems to be no entry for ConvexSet_base in the documentation

  • in the following part of the EXAMPLES block:

sage: r_squared = M.scalar_field(x^2+y^2)
sage: r_squared.set_immutable()
sage: cl_I = RealSet((1, 4)); cl_I
(1, 4)
sage: cl_O = ManifoldSubsetPullback(r_squared, None, I); cl_O

I guess I in the last line (which, at this stage, is the imaginary number i) should be replaced by cl_I and the subsequent True and False should become False and True respectively. But then, cl_I and cl_O are identical to I and O in the example that follows...

Changed commit from c36e43b to c540d35

Branch pushed to git repo; I updated commit sha1. New commits:

c540d35ManifoldSubsetPullback: Fix up some doctests with closed intervals
comment:52

Thanks for spotting this - I have fixed this and a similar example

comment:53

Replying to @egourgoulhon:

In the docstring of ManifoldSubsetPullback:

  • in the INPUT section, there seems to be no entry for ConvexSet_base in the documentation

You may need to run ./sage -docbuild reference/discrete_geometry html

comment:54

Replying to @mkoeppe:

Replying to @egourgoulhon:

In the docstring of ManifoldSubsetPullback:

  • in the INPUT section, there seems to be no entry for ConvexSet_base in the documentation

You may need to run ./sage -docbuild reference/discrete_geometry html

Yes indeed!

comment:55

Replying to @mkoeppe:

Thanks for spotting this - I have fixed this and a similar example

Thanks.

At the moment, we have

sage: M = Manifold(2, 'M')                                                                          
sage: X.<x,y> = M.chart()                                                                           
sage: M.identity_map().preimage(M)                                                                  
Subset Id_M_inv_M of the 2-dimensional differentiable manifold M
sage: M.identity_map().preimage(M) is M                                                             
False
sage: M.zero_scalar_field().preimage(RealSet.point(0))                                              
Subset zero_inv_{0} of the 2-dimensional differentiable manifold M
sage: M.zero_scalar_field().preimage(RealSet.point(0)) is M                                         
False

Do you think it would be easy to have both answers to be True? If no, this should not hamper the current ticket, but be differed to another ticket.

Changed commit from c540d35 to facad97

Branch pushed to git repo; I updated commit sha1. New commits:

facad97ContinuousMap.preimage: Handle identity_map specially
comment:57

Sure, that's easy to do and certainly a good idea. Here it is for ContinuousMap.preimage already, I'll look into the case of the scalar fields

Branch pushed to git repo; I updated commit sha1. New commits:

c2ecf3eScalarField.preimage: Handle the case of the zero scalar field

Changed commit from facad97 to c2ecf3e

comment:59

More general things such as detecting that the preimage of [0,oo) under squaring is the full domain will have to wait until a follow-up ticket

comment:60

Replying to @mkoeppe:

Sure, that's easy to do and certainly a good idea. Here it is for ContinuousMap.preimage already,

Thanks. Maybe one can add

if self._is_isomorphism and codomain_subset == self._codomain:
    return self._domain
comment:61

The patchbot reports a doctest error in src/sage/geometry/polyhedron/base.py as well as pyflakes errors in src/sage/manifolds/subsets/pullback.py.

comment:62

Replying to @egourgoulhon:

Maybe one can add

if self._is_isomorphism and codomain_subset == self._codomain:
    return self._domain

I think I can do more generally

  if self._codomain.is_subset(codomain_subset):
      return self._domain
comment:63

Replying to @egourgoulhon:

The patchbot reports a doctest error in src/sage/geometry/polyhedron/base.py

I've seen this one before locally, I don't think it's coming from this ticket, but I have opened #32030 for it

Changed commit from c2ecf3e to 3b1c428

Branch pushed to git repo; I updated commit sha1. New commits:

3b1c428ManifoldSubsetPullback: Make codomain_subset required 2nd init arg; fix pycodestyle/pyflakes warnings
comment:65

Replying to @mkoeppe:

Replying to @egourgoulhon:

Maybe one can add

if self._is_isomorphism and codomain_subset == self._codomain:
    return self._domain

I think I can do more generally

  if self._codomain.is_subset(codomain_subset):
      return self._domain

Yes, indeed! Being an isomorphism is not necessary in that case.

Changed commit from 3b1c428 to d321b93

Branch pushed to git repo; I updated commit sha1. New commits:

d321b93ContinuousMap: Return domain if the map's codomain is contained in the given subset