Opened 2 years ago
Last modified 5 weeks ago
#30092 new enhancement
Categories of normed additive monoids/groups, normed modules/rings/fields, add FreeQuadraticModule to normed vector spaces
Reported by:  Matthias Köppe  Owned by:  

Priority:  major  Milestone:  sage9.8 
Component:  linear algebra  Keywords:  
Cc:  Travis Scrimshaw, Simon Brandhorst, gourgoulhon, Michael Jung  Merged in:  
Authors:  Reviewers:  
Report Upstream:  N/A  Work issues:  
Branch:  public/categories/normed_monoids30092 (Commits, GitHub, GitLab)  Commit:  656612e56a585f70da156db3ccd35ff74e2bfa63 
Dependencies:  #30062  Stopgaps: 
Description (last modified by )
sage: VectorSpace(QQ, 5, inner_product_matrix=matrix.identity(5)).category() Category of finite dimensional vector spaces with basis over (number fields and quotient fields and metric spaces)
As noted in #30061, it is not in the category MetricSpaces
, and thus the element methods dist
and abs
(?!) are missing...
The methods __abs__
, norm
, and dot_product
are unrelated to the inner product matrix; only inner_product
uses inner_product_matrix
.
We define a category NormedVectorSpaces
with element method abs
.
We deprecate the MetricSpaces
element method abs
.
Followup: #30218: Category InnerProductSpaces
Random references:
Change History (57)
comment:1 Changed 2 years ago by
comment:2 Changed 2 years ago by
Description:  modified (diff) 

comment:3 Changed 2 years ago by
Dependencies:  → #30062 

comment:4 Changed 2 years ago by
Cc:  gourgoulhon Michael Jung added 

Description:  modified (diff) 
comment:5 Changed 2 years ago by
Branch:  → u/mkoeppe/category_inner_product_spaces 

comment:6 Changed 2 years ago by
Commit:  → 26e9c8fe08f75c52ed79c43e5ead09320e6485b6 

I have here a preliminary implementation (trying to learn from FilteredModules
and MetricSpaces
) of NormedSpacesCategory
and NormedVectorSpaces
.
Travis, if you could take a quick look to see if this seems to be going in the right direction...
New commits:
1f4f942  Provide EuclideanSpace with dist() method and add it to category of metric space

7a92b60  sage.categories.metric_spaces.MetricSpaces: Rename metric to metric_function with deprecation

3ee003a  Merge branch 't/30062/public/manifolds/euclidean_metric_space' into t/30092/category_inner_product_spaces

26e9c8f  NormedVectorSpaces: New

comment:7 Changed 2 years ago by
Why is this a functorial construction and not an axiom? I don't see why this wouldn't commute with other axioms, such as WithBasis
.
comment:9 Changed 2 years ago by
Ah, no, this is good. I thought I implemented metric spaces as an axiom, but it is a functorial construction. So please keep the current approach.
comment:10 Changed 2 years ago by
Thanks. I am still quite confused about many basic things in the category system, thanks for your patience. I am getting this:
sage: VectorSpaces(QQ).Filtered().Normed() Join of Category of filtered vector spaces over Rational Field and Category of metric spaces
What am I missing for "normed spaces" to show up?
comment:11 Changed 2 years ago by
Try
class NormedSpacesCategory(RegressiveCovariantConstructionCategory, Category_over_base_ring): +class NormedSpacesCategory(RegressiveCovariantConstructionCategory):
comment:13 Changed 2 years ago by
Commit:  26e9c8fe08f75c52ed79c43e5ead09320e6485b6 → 5eee4c108479901439003f8061cc09b6df77d605 

comment:14 Changed 2 years ago by
I also have a question. Do we need this to be be a subcategory for vector spaces? I would think it would be sufficient for a module structure for the definition to make sense. For example, Z is naturally a normed Zmodule that is not a vector space.
Addendum  Well, we actually need normed fields and rings as well for this to make sense. In fact, any additive monoid with a metric (function) becomes naturally normed. So we should also set that additional category link. I am not sure how to do that offhand.
comment:15 Changed 2 years ago by
Well, I wanted NormedSpacesCategory
to actually work also for modules, but I did not want to introduce the word "normed module"  because this does not seem to be in widespread use.
comment:16 Changed 2 years ago by
However, moving it up one category level higher is a nocost operation. Plus it means you don't have to deal with distinguishing the two categories (which can be slightly annoying at times).
comment:17 Changed 2 years ago by
Still getting
sage: VectorSpaces(QQ).Filtered().Normed() Join of Category of filtered vector spaces over Rational Field and Category of metric spaces
after the changes from your comments 11/12
comment:18 Changed 2 years ago by
Commit:  5eee4c108479901439003f8061cc09b6df77d605 → c06735c5c380254f4d332981e60d3f74c6568e79 

comment:19 Changed 2 years ago by
Of course, there's always more generality. Here's one: https://mathworld.wolfram.com/NormedBanachModule.html
comment:20 Changed 2 years ago by
and we could do https://en.wikipedia.org/wiki/Normed_algebra (which places a restriction on the norm wrt multiplication)
... but I was hoping to first implement things that would be useful in a first course in linear algebra.
comment:21 Changed 2 years ago by
Another direction of generalization is, of course, through valuations on the field; instead of just informally using the absolute value function...
comment:22 followup: 25 Changed 2 years ago by
I am not really sure at this point why it is not working from looking at the code. The only thing I can think of at this point is that default_super_categories
is not picking up the vector spaces category somehow. Perhaps something to look at is what is happening here
return Category.join([getattr(cat, cls._functor_category)(*args) for cat in category._super_categories if hasattr(cat, cls._functor_category)])
in CovariantConstructionCategory.default_super_categories
. I can do some experimentation when I get back to my office on Monday.
I generally prefer to implement things in the first category where they make sense, which then follows up to the category that I really want it.
The other issue here is that you need the other normed categories in order for the definition of a norm to make sense. So they kind of have to come along for the ride. However, it should be easy enough to use the same functorial construction, the meaning of the word "normed" changes slightly, but everything is compatible, so there is no issue (and it is something we regularly do in the math).
comment:24 Changed 2 years ago by
Commit:  c06735c5c380254f4d332981e60d3f74c6568e79 → 5fe03807ec7eb95f9363cad6e9462ffad3eed228 

Branch pushed to git repo; I updated commit sha1. New commits:
5fe0380  Draft of _test_norm_function

comment:25 Changed 2 years ago by
Replying to tscrim:
I generally prefer to implement things in the first category where they make sense, which then follows up to the category that I really want it.
Right. It looks it's best to start with normed additive groups (https://ncatlab.org/nlab/show/normed+group)  which use slightly weaker conditions.
The other issue here is that you need the other normed categories in order for the definition of a norm to make sense. So they kind of have to come along for the ride. However, it should be easy enough to use the same functorial construction, the meaning of the word "normed" changes slightly, but everything is compatible, so there is no issue (and it is something we regularly do in the math).
I agree, this type of overloading seems unproblematic in this case.
comment:26 followup: 27 Changed 2 years ago by
I didn't have time to look at this. Just in case: Please be aware that there are no restrictions whatsoever on the inner product. It is just a bilinear form. For instance it could be zero.
comment:27 Changed 2 years ago by
Replying to sbrandhorst:
Please be aware that there are no restrictions whatsoever on the inner product. It is just a bilinear form. For instance it could be zero.
Thanks. This is important to keep it mind.
comment:28 Changed 2 years ago by
I figured out the problem: There is no link to the NormedVectorSpaces
. So you need to add this to VectorSpaces
:
Normed = LazyImport('sage.categories.normed_vector_spaces', 'NormedVectorSpaces', 'Normed')
However, as we discussed, we wanted to lift this up. Are you currently working on this or would you like me to do it?
comment:31 Changed 2 years ago by
Branch:  u/mkoeppe/category_inner_product_spaces → public/categories/normed_monoids30092 

Commit:  5fe03807ec7eb95f9363cad6e9462ffad3eed228 → cc9d23417d643ff095537ade7d5a8bdb171be2ba 
It is still lacking a bit in implementation, but here is a proofofconcept for the normed (additive) monoids and various other subcategories with concrete implementations for ZZ
and QQ
(which likely require more trivial doctest changes throughout Sage, but we should get all of the categories that we want done first in case it causes the output to change).
New commits:
cc9d234  Creating category for normed (additive) monoids, groups, modules, and rings.

comment:32 Changed 2 years ago by
Thanks very much! Looks great on a quick glance  I'll take a closer look soon
comment:33 followup: 35 Changed 2 years ago by
Some quick thoughts on the test functions.
_test_norm_additive
inAdditiveSemigroups
... perhaps change to_test_norm_on_additive_monoid
 the one in additive groups  perhaps just have
_test_norm_symmetric
and use the inherited_test_norm_on_additive_monoid
 if that makes sense _test_norm_multiplication
... likewise change totest_norm_on_multiplicative_monoid
comment:34 Changed 2 years ago by
Commit:  cc9d23417d643ff095537ade7d5a8bdb171be2ba → 6bc0264f49583f232fcb778e456a52508673b6bd 

Branch pushed to git repo; I updated commit sha1. New commits:
6bc0264  Separating the inverse norm tests into a separate test method.

comment:35 followup: 36 Changed 2 years ago by
Replying to mkoeppe:
Some quick thoughts on the test functions.
_test_norm_additive
inAdditiveSemigroups
... perhaps change to_test_norm_on_additive_monoid
_test_norm_multiplication
... likewise change totest_norm_on_multiplicative_monoid
I don't want to do that for the multiplicative test because a ring, which is a monoid, does not satisfy the normed monoid properties because the norm of the multiplicative identity is not 0
. I guess that actually means this is not a regressive functorial construction. We only get a semigroup with a "weak norm," a function S > R
that satisfies ab <= a + b
(do you know if something like this has a name?). Or we just have to acknowledge the abuse somewhere.
 the one in additive groups  perhaps just have
_test_norm_symmetric
and use the inherited_test_norm_on_additive_monoid
 if that makes sense
That is a good idea. Done.
comment:36 Changed 2 years ago by
Replying to tscrim:
Replying to mkoeppe:
Some quick thoughts on the test functions.
_test_norm_additive
inAdditiveSemigroups
... perhaps change to_test_norm_on_additive_monoid
_test_norm_multiplication
... likewise change totest_norm_on_multiplicative_monoid
I don't want to do that for the multiplicative test because a ring, which is a monoid, does not satisfy the normed monoid properties because the norm of the multiplicative identity is not
0
. I guess that actually means this is not a regressive functorial construction. We only get a semigroup with a "weak norm," a functionS > R
that satisfiesab <= a + b
(do you know if something like this has a name?). Or we just have to acknowledge the abuse somewhere.
Let's see. I think this just means that there should be a separate category/functor for normed multiplicatively written monoids  satisfying ab <= a + b
(and then multiplicative identities necessarily have norm 0). Call it MultiplicativeNormed
. Just like AdditiveCommutative
and Commutative
are distinguished.
This has nothing to do with the positive homogeneity property of norms on modules.
comment:37 Changed 2 years ago by
... OK, I forgot about rings.
Yes, there needs to be a _test_norm_submultiplicative
that tests the ring multiplication. (That's in the category Normed
 not MultiplicativeNormed
.)
comment:39 Changed 2 years ago by
Commit:  6bc0264f49583f232fcb778e456a52508673b6bd → 8b9ba0bafba2fa7f687dae16d1e9c14d0a5a356f 

Branch pushed to git repo; I updated commit sha1. New commits:
8b9ba0b  Rename/split some test methods

comment:41 followup: 42 Changed 2 years ago by
I am 1 on calling the test norm_symmetric
since I think that is too vague of a name. Are there objects that satisfy both the multiplicative and additive inverse norm properties? If so, then there will be a name clash too.
I think splitting the tests into finer pieces with finer categories is the right way to do things. The submultiplicative can then go into a new normed semigroups (maybe magmas?) category, etc.
comment:42 followup: 43 Changed 2 years ago by
Replying to tscrim:
I am 1 on calling the test
norm_symmetric
since I think that is too vague of a name.
OK, I agree.
Are there objects that satisfy both the multiplicative and additive inverse norm properties? If so, then there will be a name clash too.
Haven't seen and I don't think it would be useful.
I think splitting the tests into finer pieces with finer categories is the right way to do things. The submultiplicative can then go into a new normed semigroups (maybe magmas?) category, etc.
We could also make norm
a map and then go through #30193...
comment:43 followups: 44 47 Changed 2 years ago by
Replying to mkoeppe:
Replying to tscrim:
Are there objects that satisfy both the multiplicative and additive inverse norm properties? If so, then there will be a name clash too.
Haven't seen and I don't think it would be useful.
I agree, but sometimes you never know...
I think splitting the tests into finer pieces with finer categories is the right way to do things. The submultiplicative can then go into a new normed semigroups (maybe magmas?) category, etc.
We could also make
norm
a map and then go through #30193...
Possibly. Although at least for now we can implement everything here in the respective categories and refine it later on (well, just moving the respective methods around).
comment:44 followup: 45 Changed 2 years ago by
Replying to tscrim:
Although at least for now we can implement everything here in the respective categories and refine it later on (well, just moving the respective methods around).
OK, sounds like a plan. I'll work on it a little bit now
comment:45 followup: 48 Changed 2 years ago by
Replying to mkoeppe:
Replying to tscrim:
Although at least for now we can implement everything here in the respective categories and refine it later on (well, just moving the respective methods around).
OK, sounds like a plan. I'll work on it a little bit now
Thank you. I can probably do it today too if you want.
comment:46 Changed 2 years ago by
Commit:  8b9ba0bafba2fa7f687dae16d1e9c14d0a5a356f → 656612e56a585f70da156db3ccd35ff74e2bfa63 

Branch pushed to git repo; I updated commit sha1. New commits:
656612e  Rename test functions, avoid 'symmetric'

comment:47 Changed 2 years ago by
Replying to tscrim:
Replying to mkoeppe:
Replying to tscrim:
Are there objects that satisfy both the multiplicative and additive inverse norm properties? If so, then there will be a name clash too.
I would suggest that we just ignore norms on multiplicative monoids on this ticket.
Then we can decide later whether we want the shared code to go through axioms on functionals, or through other means.
Also, norms on multiplicative monoids have a close connection to valuations on fields  and getting all of that right on one ticket is too large a scope.
comment:48 Changed 2 years ago by
Replying to tscrim:
I can probably do it today too if you want.
Feel free to take over  I have to take a break for dinner now anyway
comment:49 Changed 2 years ago by
Description:  modified (diff) 

Summary:  FreeQuadraticModule needs richer categories → Categories of normed additive monoids/groups, normed modules/rings/fields, add FreeQuadraticModule to normed vector spaces 
comment:51 Changed 2 years ago by
Description:  modified (diff) 

comment:52 Changed 2 years ago by
Milestone:  sage9.2 → sage9.3 

comment:53 Changed 20 months ago by
Milestone:  sage9.3 → sage9.4 

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.
comment:54 Changed 15 months ago by
Milestone:  sage9.4 → sage9.5 

comment:55 Changed 10 months ago by
Milestone:  sage9.5 → sage9.6 

comment:56 Changed 7 months ago by
Milestone:  sage9.6 → sage9.7 

comment:57 Changed 5 weeks ago by
Milestone:  sage9.7 → sage9.8 

Also, the classes in
sage.modules
do not make it possible to pass acategory
argument at initialization.