#10963: More functorial constructions
-------------------------------------+-------------------------------------
Reporter: nthiery | Owner: stumpc5
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.1
Component: categories | Resolution:
Keywords: days54 | Merged in:
Authors: Nicolas M. Thiéry | Reviewers: Simon King, Frédéric
Report Upstream: N/A | Chapoton
Branch: | Work issues:
public/ticket/10963 | Commit:
Dependencies: #11224, #8327, | 8045aa4a4b7ada735b3eb6055382f9b341a39f1e
#10193, #12895, #14516, #14722, | Stopgaps:
#13589, #14471, #15069, #15094, |
#11688, #13394, #15150, #15506 |
-------------------------------------+-------------------------------------
Comment (by SimonKing):
Replying to [comment:402 vbraun]:
> * Independent axioms make them easier to implement since you don't need
to figure out the most basic category that can carry the axiom. I.e. you
don't need a global understanding of the existing categories. You never
have to "move it up the category hierarchy" either.
Really?
A few months ago (see some earlier comments), I suggested to distinguish
between categories that provide certain "features" (such as: addition,
subtraction, multiplication, division, a total ordering) and categories
that provide axioms for these "features" (such as: commutativity,
distributivity, compatibility of an order with arithmetic operations). The
"features" largely correspond to magical Python methods for parents and
their elements---hence, it could be implement by (abstract)
`ParentMethods` and `ElementMethods`.
The axioms then require that the parent/element methods satisfy certain
specifications, that give rise to tests of the test suite, and also (by
mathematical theorems) you may get default implementations of the abstract
parent/element methods, and you might automatically get further axioms
when applying one axiom (such as: division ring plus finite implies
commutative).
This model relies on the observation that you ''must'' have an additive
and a multiplicative magma among the super categories, if you want to have
distributivity: Their join is the most basic category that can carry this
axiom.
> * Its actually a pretty minimal change of the existing code, the only
thing that really changes is that we look for attributes that are tagged
by being subclasses of the axiom class (i.e. in code) instead of having a
blessed adjective as name.
Actually, from a practical point of view, I'd prefer to have something
that works (i.e., this code) and move on to a different (better?) model
later.
For example, I think the approach to use a proper database could also
relatively easily be implemented on top of the existing code. Namely: The
construction digraph will still be encoded by (1) axioms that are stored
as (lazy/nested/...) class attributes of a base category, and (2) by an
attribute of a category-with-axiom providing the default construction
(`_base_category_class_and_axiom`). The only difference is that these
attributes would be provided by the database, and ''only'' the database
(as a single point of truth).
But I think it would be a mistake to do this presumably/hopefully "small"
change now, i.e. before merging Nicolas' code.
> > There is precedency in Python for "magic" attribute names. For
instance, an
> > object gets a length by implementing a `__len__` method on it.
>
> True, and it is really unfair that if Guido van Rossum blesses a name
with magical properties then that is automatically good Python and people
explain it in every book about Python. Whereas if one of us declares a
name special then it is bad practice and no Python book in the world gives
a hoot about it.
+1, provided they the Sage documentation explains our magical methods as
clearly as the Python books document magical Python methods.
--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:403>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.