#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, | eb7b486c6fecac296052f980788e15e2ad1b59e4
#10193, #12895, #14516, #14722, | Stopgaps:
#13589, #14471, #15069, #15094, |
#11688, #13394, #15150, #15506 |
-------------------------------------+-------------------------------------
Comment (by vbraun):
I'm agreeing with Simon more and more that we should separate out the
whole code for finding the normal form for the catogory-with-axiom. Right
now its buried in the whole category framework, you can't doctest it
independently, and it requires duplicate information. Its also pretty hard
to follow. Not to mention the whole `A_extra_super_categories` business.
Moreover, if we ever want to use pre-computed information we have to do it
anyways. It also parallels the aforementioned abc module, you define your
categories and then register them with a category-axiom-manager. We can
easily have some syntactic sugar to make the registration process
automatic for inner classes.
Once you accept that, I don't see a reason to do category-with-axiom as
composition. Just inherit and use a dynamic metaclass for Category to
* build the category-with-axioms from the Axiom subclasses we inherit from
* for any Axiom attribute: register that as an applicable axiom, generate
a factory method, and register with the category-axiom-manager.
So in an example, the manual construction would be:
{{{#!python
class Test1(Category):
def super_categories(self):
return []
Infinite1 = axioms.Infinite # parsed by the metaclass
Finite1 = axioms.Finite
class FiniteTest1(Test1, axioms.Finite):
# ... extra code if desired ...
assert Test1.Finite1() is FiniteTest1()
Test1.Infinite1() # automatically generated anonymous class
}}}
Or using inner class syntax
{{{#!python
class Test2(Category):
def super_categories(self):
return []
Infinite2 = axioms.Infinite
class Finite2(axioms.Finite):
# ... extra code if desired ...
}}}
Unless you define `FiniteTest1` in a separate module, the metaclass gets
enough information to figure out where we provide a category-with-axioms
and where it has to be dynamically generated. Any further relations must
be provided explicitly. I'm currently working on a proof-of-concept code,
will post that when its finished.
--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:482>
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.