Sage: Ticket #31877: Refine category of RealSet
https://trac.sagemath.org/ticket/31877
<p>
we should put it in a suitable subcategory of <code>TopologicalSpaces</code>.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/31877
Trac 1.1.6gh-mjungmathSat, 29 May 2021 22:00:19 GMT
https://trac.sagemath.org/ticket/31877#comment:1
https://trac.sagemath.org/ticket/31877#comment:1
<p>
Possibly a good idea to consider: <a class="ext-link" href="https://trac.sagemath.org/ticket/30832#comment:6"><span class="icon"></span>https://trac.sagemath.org/ticket/30832#comment:6</a>.
</p>
TicketmkoeppeSat, 29 May 2021 22:05:32 GMTbranch set
https://trac.sagemath.org/ticket/31877#comment:2
https://trac.sagemath.org/ticket/31877#comment:2
<ul>
<li><strong>branch</strong>
set to <em>u/mkoeppe/refine_category_of_realset</em>
</li>
</ul>
TicketmkoeppeSat, 29 May 2021 22:07:27 GMTstatus changed; commit, author set
https://trac.sagemath.org/ticket/31877#comment:3
https://trac.sagemath.org/ticket/31877#comment:3
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>commit</strong>
set to <em>4b09685667a8dddec24847dd14067abbe2d50076</em>
</li>
<li><strong>author</strong>
set to <em>Matthias Koeppe</em>
</li>
</ul>
<p>
New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit?id=4b09685667a8dddec24847dd14067abbe2d50076"><span class="icon"></span>4b09685</a></td><td><code>RealSet: Put it in a suitable subcategory of TopologicalSpaces()</code>
</td></tr></table>
Ticketgh-mjungmathSun, 30 May 2021 09:20:52 GMT
https://trac.sagemath.org/ticket/31877#comment:4
https://trac.sagemath.org/ticket/31877#comment:4
<p>
I personally don't like adding <code>RealSet</code> to <code>TopologicalSpaces</code>. Imo the difference between <code>RealSet</code> and <code>OpenInterval</code> should be exactly that: seeing them as sets or manifolds (i.e. top. spaces).
</p>
<p>
Then a forgetful functor would also make more sense.
</p>
TicketmkoeppeSun, 30 May 2021 17:00:34 GMT
https://trac.sagemath.org/ticket/31877#comment:5
https://trac.sagemath.org/ticket/31877#comment:5
<p>
A <code>RealSet</code> 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.
</p>
TickettscrimSun, 30 May 2021 23:18:36 GMT
https://trac.sagemath.org/ticket/31877#comment:6
https://trac.sagemath.org/ticket/31877#comment:6
<p>
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 <code>ambient()</code> a <code>@staticmethod</code>? 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. <code>open_closed</code>).
</p>
<p>
@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 <code>Rings -> Sets</code>, and applying that functor to <code>ZZ</code> still obtains <code>ZZ</code>. It still has all of the behavior of an object in <code>Sets</code>, but there is no reason to actually forget about the ring structure.
</p>
TickettscrimSun, 30 May 2021 23:18:45 GMTreviewer set
https://trac.sagemath.org/ticket/31877#comment:7
https://trac.sagemath.org/ticket/31877#comment:7
<ul>
<li><strong>reviewer</strong>
set to <em>Travis Scrimshaw</em>
</li>
</ul>
TicketmkoeppeSun, 30 May 2021 23:19:58 GMT
https://trac.sagemath.org/ticket/31877#comment:8
https://trac.sagemath.org/ticket/31877#comment:8
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/31877#comment:6" title="Comment 6">tscrim</a>:
</p>
<blockquote class="citation">
<p>
The only question I have is why is <code>ambient()</code> a <code>@staticmethod</code>? I feel like it should be a normal method
</p>
</blockquote>
<p>
OK, I'll make this change.
</p>
TicketgitSun, 30 May 2021 23:25:40 GMTcommit changed
https://trac.sagemath.org/ticket/31877#comment:9
https://trac.sagemath.org/ticket/31877#comment:9
<ul>
<li><strong>commit</strong>
changed from <em>4b09685667a8dddec24847dd14067abbe2d50076</em> to <em>46eed0eeb3fc4e9509b7c55df967455ae49984d0</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=46eed0eeb3fc4e9509b7c55df967455ae49984d0"><span class="icon"></span>46eed0e</a></td><td><code>RealSet.ambient: Change to a normal method</code>
</td></tr></table>
TicketmkoeppeSun, 30 May 2021 23:27:50 GMT
https://trac.sagemath.org/ticket/31877#comment:10
https://trac.sagemath.org/ticket/31877#comment:10
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/31877#comment:6" title="Comment 6">tscrim</a>:
</p>
<blockquote class="citation">
<p>
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 <code>Rings -> Sets</code>, and applying that functor to <code>ZZ</code> still obtains <code>ZZ</code>. It still has all of the behavior of an object in <code>Sets</code>, but there is no reason to actually forget about the ring structure.
</p>
</blockquote>
<p>
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.
</p>
TickettscrimMon, 31 May 2021 00:21:52 GMT
https://trac.sagemath.org/ticket/31877#comment:11
https://trac.sagemath.org/ticket/31877#comment:11
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/31877#comment:10" title="Comment 10">mkoeppe</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/31877#comment:6" title="Comment 6">tscrim</a>:
</p>
<blockquote class="citation">
<p>
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 <code>Rings -> Sets</code>, and applying that functor to <code>ZZ</code> still obtains <code>ZZ</code>. It still has all of the behavior of an object in <code>Sets</code>, but there is no reason to actually forget about the ring structure.
</p>
</blockquote>
<p>
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.
</p>
</blockquote>
<p>
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 <code>ZZ</code> as a <code>Sets</code> object? Plus, the category you want for the morphisms is a property of the morphism, not the parent.
</p>
TickettscrimMon, 31 May 2021 00:22:20 GMTstatus changed
https://trac.sagemath.org/ticket/31877#comment:12
https://trac.sagemath.org/ticket/31877#comment:12
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
</ul>
<p>
Thanks for the change.
</p>
TicketmkoeppeMon, 31 May 2021 00:30:00 GMT
https://trac.sagemath.org/ticket/31877#comment:13
https://trac.sagemath.org/ticket/31877#comment:13
<p>
Thanks!
</p>
Ticketgh-mjungmathMon, 31 May 2021 07:55:25 GMT
https://trac.sagemath.org/ticket/31877#comment:14
https://trac.sagemath.org/ticket/31877#comment:14
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/31877#comment:6" title="Comment 6">tscrim</a>:
</p>
<blockquote class="citation">
<p>
I think this is good. As Matthias said, they are naturally topological spaces from the subspace topology.
</p>
</blockquote>
<p>
Just because it comes with a natural topology doesn't mean it is the topology the user wants.
</p>
<p>
If you argument like that, every set must be seen in the category of topological spaces, because every set is endowed with a topology.
</p>
<blockquote class="citation">
<p>
@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 <code>Rings -> Sets</code>, and applying that functor to <code>ZZ</code> still obtains <code>ZZ</code>. It still has all of the behavior of an object in <code>Sets</code>, but there is no reason to actually forget about the ring structure.
</p>
</blockquote>
<blockquote class="citation">
<p>
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 <code>ZZ</code> as a <code>Sets</code> object? Plus, the category you want for the morphisms is a property of the morphism, not the parent.
</p>
</blockquote>
<p>
Then I don't understand why we even have a forgetful functor if it technically just represents the identity functor...
</p>
Ticketgh-mjungmathMon, 31 May 2021 08:11:01 GMT
https://trac.sagemath.org/ticket/31877#comment:15
https://trac.sagemath.org/ticket/31877#comment:15
<p>
But I agree, for structures like rings, groups etc. this approach makes total sense. Though, I still don't understand why <code>ForgetfulFunctor</code> was introduced in the first place.
</p>
<p>
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 <code>RealSet</code> as the name indicates).
</p>
TicketmkoeppeMon, 31 May 2021 17:10:29 GMT
https://trac.sagemath.org/ticket/31877#comment:16
https://trac.sagemath.org/ticket/31877#comment:16
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/31877#comment:14" title="Comment 14">gh-mjungmath</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/31877#comment:6" title="Comment 6">tscrim</a>:
</p>
<blockquote class="citation">
<p>
I think this is good. As Matthias said, they are naturally topological spaces from the subspace topology.
</p>
</blockquote>
<p>
Just because it comes with a natural topology doesn't mean it is the topology the user wants.
</p>
</blockquote>
<p>
<code>RealSet</code> 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 <code>RealSet</code> constructors for intervals such as <code>open</code>, <code>closed</code>.
</p>
<p>
In <a class="closed ticket" href="https://trac.sagemath.org/ticket/31881" title="enhancement: RealSet: Extend constructors so that they can build manifold objects (closed: fixed)">#31881</a> (<code>RealSet</code>: Extend constructors so that they can build manifold objects) I plan to add a <code>category</code> 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 <code>category=Sets()</code> to the constructors.
</p>
Ticketgh-mjungmathMon, 31 May 2021 17:20:07 GMT
https://trac.sagemath.org/ticket/31877#comment:17
https://trac.sagemath.org/ticket/31877#comment:17
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/31877#comment:16" title="Comment 16">mkoeppe</a>:
</p>
<blockquote class="citation">
<p>
<code>RealSet</code> 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 <code>RealSet</code> constructors for intervals such as <code>open</code>, <code>closed</code>.
</p>
</blockquote>
<p>
Good point!
</p>
<blockquote class="citation">
<p>
In <a class="closed ticket" href="https://trac.sagemath.org/ticket/31881" title="enhancement: RealSet: Extend constructors so that they can build manifold objects (closed: fixed)">#31881</a> (<code>RealSet</code>: Extend constructors so that they can build manifold objects) I plan to add a <code>category</code> 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 <code>category=Sets()</code> to the constructors.
</p>
</blockquote>
<p>
+1
</p>
TickettscrimMon, 31 May 2021 23:43:02 GMT
https://trac.sagemath.org/ticket/31877#comment:18
https://trac.sagemath.org/ticket/31877#comment:18
<p>
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 <code>ZZ</code> the set is the same as <code>ZZ</code> 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.
</p>
<p>
By being in the category of topological spaces, you are stating there is a preferred topology. This is akin to the <code>WithBasis</code> category saying there is a distinguished basis. This is why <code>TopologicalSpaces</code> is constructed as a functor construction category.
</p>
<p>
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.
</p>
TicketmkoeppeSat, 19 Jun 2021 21:01:34 GMTdependencies set
https://trac.sagemath.org/ticket/31877#comment:19
https://trac.sagemath.org/ticket/31877#comment:19
<ul>
<li><strong>dependencies</strong>
set to <em>#31880</em>
</li>
</ul>
TicketgitSat, 19 Jun 2021 21:02:39 GMTstatus, commit changed
https://trac.sagemath.org/ticket/31877#comment:20
https://trac.sagemath.org/ticket/31877#comment:20
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>needs_review</em>
</li>
<li><strong>commit</strong>
changed from <em>46eed0eeb3fc4e9509b7c55df967455ae49984d0</em> to <em>5b0f85d4ef4734c89701c1d0144fae2e9dc6b408</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=5b8ceca516427f34634ab0eeb17a53a70d62f0bd"><span class="icon"></span>5b8ceca</a></td><td><code>InternalRealInterval, RealSet: Add _latex_ methods</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=69ca8543ccd948f9c01143dda49f574710efe0c4"><span class="icon"></span>69ca854</a></td><td><code>RealSet._repr_: Use unicode cup sign instead of +</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=dbdfc068f2d2ac39ae8171ea8737b2b1a535e021"><span class="icon"></span>dbdfc06</a></td><td><code>InternalRealInterval, RealSet: Remove extra whitespace in latex, add documentation</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=7f563381617c2b016a8b849f83d3387ccc25d621"><span class="icon"></span>7f56338</a></td><td><code>PiecewiseFunction: Adjust doctests for changed RealSet repr</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=8abdc8b16f9762041c1c60bcb4672fefea12f4b4"><span class="icon"></span>8abdc8b</a></td><td><code>src/sage/functions/piecewise.py: Add coding header</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=5b0f85d4ef4734c89701c1d0144fae2e9dc6b408"><span class="icon"></span>5b0f85d</a></td><td><code>Merge #31880</code>
</td></tr></table>
TicketmkoeppeSat, 19 Jun 2021 21:03:05 GMTstatus changed
https://trac.sagemath.org/ticket/31877#comment:21
https://trac.sagemath.org/ticket/31877#comment:21
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
</ul>
<p>
Merged to resolve merge conflict
</p>
TicketvbraunTue, 29 Jun 2021 23:08:33 GMTstatus, branch changed; resolution set
https://trac.sagemath.org/ticket/31877#comment:22
https://trac.sagemath.org/ticket/31877#comment:22
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>branch</strong>
changed from <em>u/mkoeppe/refine_category_of_realset</em> to <em>5b0f85d4ef4734c89701c1d0144fae2e9dc6b408</em>
</li>
</ul>
Ticket