New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor axioms #22965
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Branch: u/nthiery/refactor_axioms |
comment:4
I know it's not ready for review, but something I've been bit by in the past is only defining an New commits:
|
Commit: |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:12
If you're going to override "eq" and "hash" you should probably define the thing to be ( |
This comment has been minimized.
This comment has been minimized.
comment:14
Replying to @nbruin:
That's a good question. The In terms of speed, I believe the only important thing is fast equality and hash (which calls for Cythonizing them). Axioms will rarely be recreated. Cheers, |
comment:16
Replying to @tscrim:
Yeah, I pondered about this. Accepting |
comment:17
If you want to keep the Also, |
comment:18
I'm not really commenting on whether you should define an |
comment:19
Also, why does |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:21
Replying to @tscrim:
I believe none at this stage. I just put that by default, mostly for consistency with Category. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
This comment has been minimized.
This comment has been minimized.
comment:24
Hi; any comment on the questions raised in the description? |
comment:25
I say
I would go for the latter since it is a container object and
No, but rich comparisons are good.
Definitely Index/definition time as this will allow us to control the printing in a more straightforward way.
I am inclined to say Cythonize it to keep the categories as fast as possible. I feel like even if highly optimized, this switch will slow down category creation because the string operations are lightweight and optimized at the machine level. However, I haven't done any timings. Also, it would be good if you could get rid of the
I don't think the hyphen there is completely grammatically correct, at least it is strange to me. So I'm -1.
I would like the latter to be
as this is more concise and easier to parse.
I would get rid of it all together and (mildly) break encapsulation here by using |
comment:27
Looks like there are a lot of things in the comments to still be addressed and merge conflicts that need to be resolved. |
This ticket brings:
a catalog of axioms
axioms.XXX
in the global namespaceaxioms as objects rather than plain strings. This had been wished
for during the review Axioms and more functorial constructions #10963, and some of the code is reminiscent of
Volker's draft at floor(), ceil(), trunc(), round() for AA #15501. The main advantage for now is to enable
the definition of axioms with custom printing, thus getting rid of the
crapy monolithic customization section.
The bijection axiom <-> "axiom name" remains mandatory to support
the syntax for implementing axioms in a category.
improved heuristic for printing categories with axioms. E.g.:
improved printing of
AssociativeXXX
:This was discussed and requested on sage-devel for better
readability when there are many axioms printed. E.g. in
The above are the reasons why the commits touch many files)
some simplifications in the code (e.g. no more
_repr_object_names_static
)The code is essentially backward compatible, at the price of having
axioms.Associative == "Associative"
, with compatible hash values.Using axioms as strings is deprecated in code. In particular, the
ticket updates the Sage library in a few places to use the preferred
idiom
P in C.Axiom
rather than"Axiom" in P.category().axioms()
.Remaining questions:
Inside the code, do we want to call the catalog of axioms
all_axioms
oraxioms
? The latter is more ambiguous,but consistent with the name exported in global name space.
To fetch an existing axiom from a variable containing either the
axiom or its name, the current idiom is
all_axioms(name)
; that'ssomewhat consistent with the
P(xx)
idiom to create elements of aparent. Would we want some other idiom?
all_axioms[name]
?Do we want to implement a
cmp
method for axioms?sorted(...,key=str)
in our documentationmeaningful (axioms shown in some natural order). And simplify
a very tiny bit the one place where this sorting order is used in
the code.
Do we want to Cythonize axiom.py? Now? Later?
Do we want to import
all_axioms
fromcategory_with_axiom
rather thanaxiom
? This would avoid a double import in all the files specifying_base_category_and_axiom
Do we want "additive magmas" to be renamed to "additive-magmas" for consistency?
Do we want to fix the inconsistency below by adding
additive-
inthe first output?
To recover the string associated to an axiom in the code, is it fine
to use
str(axiom)
, or do we want something more explicit andpossibly distinct from printing like
axiom.name()
?Any better name for
axiom.index()
? It's only used internally,and in a single place; we could also just use
axiom._index
.Work for followup tickets:
Improve the guessing to avoid having to specify
_base_category_class_and_axiom
inFiniteDimensionalLieAlgebrasWithBasis
and friends.Improve the pretty printing to get:
CC: @tscrim @simon-king-jena @vbraun @jpflori
Component: categories
Author: Nicolas M. Thiéry
Branch/Commit: u/nthiery/refactor_axioms @
f4ce06a
Issue created by migration from https://trac.sagemath.org/ticket/22965
The text was updated successfully, but these errors were encountered: