Opened 6 months ago

Closed 5 months ago

#31877 closed enhancement (fixed)

Refine category of RealSet

Reported by: mkoeppe Owned by:
Priority: major Milestone: sage-9.4
Component: categories Keywords:
Cc: gh-mjungmath, 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:

Status badges

Description

we should put it in a suitable subcategory of TopologicalSpaces.

Change History (22)

comment:1 Changed 6 months ago by gh-mjungmath

Possibly a good idea to consider: https://trac.sagemath.org/ticket/30832#comment:6.

comment:2 Changed 6 months ago by mkoeppe

  • Branch set to u/mkoeppe/refine_category_of_realset

comment:3 Changed 6 months ago by mkoeppe

  • Authors set to Matthias Koeppe
  • Commit set to 4b09685667a8dddec24847dd14067abbe2d50076
  • Status changed from new to needs_review

New commits:

4b09685RealSet: Put it in a suitable subcategory of TopologicalSpaces()

comment:4 Changed 6 months ago by gh-mjungmath

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 6 months ago by mkoeppe

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 follow-ups: Changed 6 months ago by tscrim

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).

@gh-mjungmath 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 6 months ago by tscrim

  • Reviewers set to Travis Scrimshaw

comment:8 in reply to: ↑ 6 Changed 6 months ago by mkoeppe

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 6 months ago by git

  • Commit changed from 4b09685667a8dddec24847dd14067abbe2d50076 to 46eed0eeb3fc4e9509b7c55df967455ae49984d0

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

46eed0eRealSet.ambient: Change to a normal method

comment:10 in reply to: ↑ 6 ; follow-up: Changed 6 months ago by 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 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.

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 6 months ago by tscrim

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 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.

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 6 months ago by tscrim

  • Status changed from needs_review to positive_review

Thanks for the change.

comment:13 Changed 6 months ago by mkoeppe

Thanks!

comment:14 in reply to: ↑ 6 ; follow-up: Changed 6 months ago by gh-mjungmath

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.

@gh-mjungmath 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.

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.

Then I don't understand why we even have a forgetful functor if it technically just represents the identity functor...

Last edited 6 months ago by gh-mjungmath (previous) (diff)

comment:15 Changed 6 months ago by gh-mjungmath

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).

Last edited 6 months ago by gh-mjungmath (previous) (diff)

comment:16 in reply to: ↑ 14 ; follow-up: Changed 6 months ago by mkoeppe

Replying to gh-mjungmath:

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 6 months ago by gh-mjungmath

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 the RealSet constructors for intervals such as open, closed.

Good point!

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.

+1

comment:18 Changed 6 months ago by tscrim

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.

Last edited 6 months ago by tscrim (previous) (diff)

comment:19 Changed 6 months ago by mkoeppe

  • Dependencies set to #31880

comment:20 Changed 6 months ago by git

  • 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:

5b8cecaInternalRealInterval, RealSet: Add _latex_ methods
69ca854RealSet._repr_: Use unicode cup sign instead of +
dbdfc06InternalRealInterval, RealSet: Remove extra whitespace in latex, add documentation
7f56338PiecewiseFunction: Adjust doctests for changed RealSet repr
8abdc8bsrc/sage/functions/piecewise.py: Add coding header
5b0f85dMerge #31880

comment:21 Changed 6 months ago by mkoeppe

  • Status changed from needs_review to positive_review

Merged to resolve merge conflict

comment:22 Changed 5 months ago by vbraun

  • Branch changed from u/mkoeppe/refine_category_of_realset to 5b0f85d4ef4734c89701c1d0144fae2e9dc6b408
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.