#10667: Morphisms and Objects of Categories
---------------------------+------------------------------------------------
   Reporter:  SimonKing    |          Owner:  nthiery                      
       Type:  enhancement  |         Status:  needs_work                   
   Priority:  major        |      Milestone:  sage-5.0                     
  Component:  categories   |       Keywords:  objects morphisms containment
Work_issues:  doctests     |       Upstream:  N/A                          
   Reviewer:               |         Author:  Simon King                   
     Merged:               |   Dependencies:  #9138, #11115                
---------------------------+------------------------------------------------

Comment(by SimonKing):

 I am making some progress.

 Testsuites are really a good thing! By adding tests for morphisms, I found
 a couple of bugs. And that's why my patch can not just be a short work-
 around (unless I make the Testsuites skip some tests). It will contain
 fixes in different parts of sage.

 Just one example:
 {{{
 sage: E = CombinatorialFreeModule(ZZ, [1,2,3])
 sage: F = CombinatorialFreeModule(ZZ, [2,3,4])
 sage: H = Hom(E, F)
 sage: TestSuite(H).run()
 Failure in _test_additive_associativity:
 Traceback (most recent call last):
   File "/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
 packages/sage/misc/sage_unittest.py", line 275, in run
     test_method(tester = tester)
   File "/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
 packages/sage/categories/commutative_additive_semigroups.py", line 80, in
 _test_additive_associativity
     tester.assert_((x + y) + z == x + (y + z))
 TypeError: unsupported operand type(s) for +: 'ModuleMorphismByLinearity'
 and 'ModuleMorphismByLinearity'
 ------------------------------------------------------------
 Failure in _test_an_element:
 Traceback (most recent call last):
   File "/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
 packages/sage/misc/sage_unittest.py", line 275, in run
     test_method(tester = tester)
   File "/mnt/local/king/SAGE/broken/local/lib/python2.6/site-
 packages/sage/categories/sets_cat.py", line 388, in _test_an_element
     tester.assertEqual(self(an_element), an_element, "element construction
 is not idempotent")
 ...
 }}}

 The reason is that `dumps(H.zero())` fails:
 {{{
 sage: dumps(H.zero())
 ---------------------------------------------------------------------------
 PicklingError                             Traceback (most recent call
 last)

 /home/king/SAGE/work/categories/objects/<ipython console> in <module>()

 /mnt/local/king/SAGE/broken/local/lib/python2.6/site-
 packages/sage/structure/sage_object.so in sage.structure.sage_object.dumps
 (sage/structure/sage_object.c:8274)()

 /mnt/local/king/SAGE/broken/local/lib/python2.6/site-
 packages/sage/structure/sage_object.so in
 sage.structure.sage_object.SageObject.dumps
 (sage/structure/sage_object.c:2183)()

 PicklingError: Can't pickle <type 'function'>: attribute lookup
 __builtin__.function failed
 }}}

 There are more of those bugs.

 The good news: I think I found a stable way to get the method resolution
 order of hom category parent classes right.

 I even tried to get rid of the odd explicit `__new__` method in
 `sage.categories.rings.Rings.HomCategory.ParentMethods`. But I am not sure
 if I will succeed.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10667#comment:42>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to