Opened 12 months ago
Closed 11 months ago
#31877 closed enhancement (fixed)
Refine category of RealSet
Reported by:  mkoeppe  Owned by:  

Priority:  major  Milestone:  sage9.4 
Component:  categories  Keywords:  
Cc:  ghmjungmath, egourgoulhon, tscrim  Merged in:  
Authors:  Matthias Koeppe  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  5b0f85d (Commits, GitHub, GitLab)  Commit:  5b0f85d4ef4734c89701c1d0144fae2e9dc6b408 
Dependencies:  #31880  Stopgaps: 
Description
we should put it in a suitable subcategory of TopologicalSpaces
.
Change History (22)
comment:1 Changed 12 months ago by
comment:2 Changed 12 months ago by
 Branch set to u/mkoeppe/refine_category_of_realset
comment:3 Changed 12 months ago by
 Commit set to 4b09685667a8dddec24847dd14067abbe2d50076
 Status changed from new to needs_review
New commits:
4b09685  RealSet: Put it in a suitable subcategory of TopologicalSpaces()

comment:4 Changed 12 months ago by
I personally don't like adding RealSet
to TopologicalSpaces
. Imo the difference between RealSet
and OpenInterval
should be exactly that: seeing them as sets or manifolds (i.e. top. spaces).
Then a forgetful functor would also make more sense.
comment:5 Changed 12 months ago by
A RealSet
instance is a union of finitely many (possibly degenerate) intervals, so it is always a topological subspace of the real line, but not always a manifold. It would belong to the category of manifolds with corners of mixed dimension, but I think it's a long way until we have implemented that.
comment:6 followups: ↓ 8 ↓ 10 ↓ 14 Changed 12 months ago by
I think this is good. As Matthias said, they are naturally topological spaces from the subspace topology. The only question I have is why is ambient()
a @staticmethod
? I feel like it should be a normal method because the ambient space is associated with the instance rather than as a constructor function (cf. open_closed
).
@ghmjungmath I don't understand what you mean by forgetful functor. These are parents, and have nothing to do with functors. For example, there is a forgetful functor from Rings > Sets
, and applying that functor to ZZ
still obtains ZZ
. It still has all of the behavior of an object in Sets
, but there is no reason to actually forget about the ring structure.
comment:7 Changed 12 months ago by
 Reviewers set to Travis Scrimshaw
comment:8 in reply to: ↑ 6 Changed 12 months ago by
Replying to tscrim:
The only question I have is why is
ambient()
a@staticmethod
? I feel like it should be a normal method
OK, I'll make this change.
comment:9 Changed 12 months ago by
 Commit changed from 4b09685667a8dddec24847dd14067abbe2d50076 to 46eed0eeb3fc4e9509b7c55df967455ae49984d0
Branch pushed to git repo; I updated commit sha1. New commits:
46eed0e  RealSet.ambient: Change to a normal method

comment:10 in reply to: ↑ 6 ; followup: ↓ 11 Changed 12 months ago by
Replying to tscrim:
I don't understand what you mean by forgetful functor. These are parents, and have nothing to do with functors. For example, there is a forgetful functor from
Rings > Sets
, and applying that functor toZZ
still obtainsZZ
. It still has all of the behavior of an object inSets
, but there is no reason to actually forget about the ring structure.
I think the idea would be that after applying the functor to the parent, asking for example for the homset would give a different answer.
comment:11 in reply to: ↑ 10 Changed 12 months ago by
Replying to mkoeppe:
Replying to tscrim:
I don't understand what you mean by forgetful functor. These are parents, and have nothing to do with functors. For example, there is a forgetful functor from
Rings > Sets
, and applying that functor toZZ
still obtainsZZ
. It still has all of the behavior of an object inSets
, but there is no reason to actually forget about the ring structure.I think the idea would be that after applying the functor to the parent, asking for example for the homset would give a different answer.
IMO, it is better to pass that category information to the homset construction (which you can do) if you want to consider morphisms in a weaker category. This way you have less proliferation of "equal" parents and dealing with elements that maybe shouldn't have the additional structure. In this example, should you be able to add two integers that are in the ZZ
as a Sets
object? Plus, the category you want for the morphisms is a property of the morphism, not the parent.
comment:12 Changed 12 months ago by
 Status changed from needs_review to positive_review
Thanks for the change.
comment:13 Changed 12 months ago by
Thanks!
comment:14 in reply to: ↑ 6 ; followup: ↓ 16 Changed 12 months ago by
Replying to tscrim:
I think this is good. As Matthias said, they are naturally topological spaces from the subspace topology.
Just because it comes with a natural topology doesn't mean it is the topology the user wants.
If you argument like that, every set must be seen in the category of topological spaces, because every set is endowed with a topology.
@ghmjungmath I don't understand what you mean by forgetful functor. These are parents, and have nothing to do with functors. For example, there is a forgetful functor from
Rings > Sets
, and applying that functor toZZ
still obtainsZZ
. It still has all of the behavior of an object inSets
, but there is no reason to actually forget about the ring structure.
IMO, it is better to pass that category information to the homset construction (which you can do) if you want to consider morphisms in a weaker category. This way you have less proliferation of "equal" parents and dealing with elements that maybe shouldn't have the additional structure. In this example, should you be able to add two integers that are in the
ZZ
as aSets
object? Plus, the category you want for the morphisms is a property of the morphism, not the parent.
Then I don't understand why we even have a forgetful functor if it technically just represents the identity functor...
comment:15 Changed 12 months ago by
But I agree, for structures like rings, groups etc. this approach makes total sense. Though, I still don't understand why ForgetfulFunctor
was introduced in the first place.
But for manifolds, things are slightly different. It would be good to have a functor that forgets about the topological structure, for example to impose another one. Like I said, I don't like the idea of enforcing a preferred topology on a set if we see it just as set (what we clearly do with RealSet
as the name indicates).
comment:16 in reply to: ↑ 14 ; followup: ↓ 17 Changed 12 months ago by
Replying to ghmjungmath:
Replying to tscrim:
I think this is good. As Matthias said, they are naturally topological spaces from the subspace topology.
Just because it comes with a natural topology doesn't mean it is the topology the user wants.
RealSet
provides constructors for certain subsets of the reals. The "set" of real numbers comes with a distinguished topology, which is reflected by the names of the RealSet
constructors for intervals such as open
, closed
.
In #31881 (RealSet
: Extend constructors so that they can build manifold objects) I plan to add a category
keyword argument. Then also the rather specialized use case that a subset of the real numbers is to be treated merely as a set can be achieved by passing category=Sets()
to the constructors.
comment:17 in reply to: ↑ 16 Changed 12 months ago by
Replying to mkoeppe:
RealSet
provides constructors for certain subsets of the reals. The "set" of real numbers comes with a distinguished topology, which is reflected by the names of theRealSet
constructors for intervals such asopen
,closed
.
Good point!
In #31881 (
RealSet
: Extend constructors so that they can build manifold objects) I plan to add acategory
keyword argument. Then also the rather specialized use case that a subset of the real numbers is to be treated merely as a set can be achieved by passingcategory=Sets()
to the constructors.
+1
comment:18 Changed 12 months ago by
Just because it acts as the identity on parents, doesn't mean it is the identity functor. Be very careful with confusing abstract and concrete mathematics. If I said ZZ
the set is the same as ZZ
the ring, would you agree or disagree? Or would you be like Bill Clinton and state "That depends on what the definition of 'is' is."? The forgetful functor does carry some information, and that is the category you obtain at the end. It could also be used as a base class when you do have some more canonical implementations, but currently it doesn't seem to be used.
By being in the category of topological spaces, you are stating there is a preferred topology. This is akin to the WithBasis
category saying there is a distinguished basis. This is why TopologicalSpaces
is constructed as a functor construction category.
For the manifold code, while it is dynamic, each manifold is not meant to be treated as something that can change. So if you go from differentiable to topological, you either are actually constructing a different object because the maximal atlas is different or it has the same maximal atlas and you still require the maps to be differentiable. We just may not have provided enough information yet to see that difference.
comment:19 Changed 11 months ago by
 Dependencies set to #31880
comment:20 Changed 11 months ago by
 Commit changed from 46eed0eeb3fc4e9509b7c55df967455ae49984d0 to 5b0f85d4ef4734c89701c1d0144fae2e9dc6b408
 Status changed from positive_review to needs_review
Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:
5b8ceca  InternalRealInterval, RealSet: Add _latex_ methods

69ca854  RealSet._repr_: Use unicode cup sign instead of +

dbdfc06  InternalRealInterval, RealSet: Remove extra whitespace in latex, add documentation

7f56338  PiecewiseFunction: Adjust doctests for changed RealSet repr

8abdc8b  src/sage/functions/piecewise.py: Add coding header

5b0f85d  Merge #31880

comment:21 Changed 11 months ago by
 Status changed from needs_review to positive_review
Merged to resolve merge conflict
comment:22 Changed 11 months ago by
 Branch changed from u/mkoeppe/refine_category_of_realset to 5b0f85d4ef4734c89701c1d0144fae2e9dc6b408
 Resolution set to fixed
 Status changed from positive_review to closed
Possibly a good idea to consider: https://trac.sagemath.org/ticket/30832#comment:6.