#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 SimonKing):

 Replying to [comment:431 nthiery]:
 > Now, I am actually surprised that you get that many. Can you give a
 > couple examples where this fails?

 The `TestCategoryModel()` from [attachment:consistency.py] returns (among
 other things) a list of all category classes for which `an_instance()`
 does not return an instance of the class. This list seems to be stable.

 Side-note: The other tests do not seem stable yet: They differ from run to
 run. Anyway, I'll work on it.

 Here are the classes and the errors I am getting:
 {{{
 0 sage.combinat.ncsym.bases.NCSymDualBases AttributeError
 1 sage.categories.modules_with_basis.ModulesWithBasis.DualObjects
 TypeError
 2 sage.categories.algebra_functor.AlgebrasCategory AssertionError
 3 sage.categories.additive_magmas.AdditiveMagmas.Algebras AssertionError
 4 sage.categories.hopf_algebras.HopfAlgebras.DualCategory
 NotImplementedError
 5 sage.categories.additive_semigroups.AdditiveSemigroups.Algebras
 AssertionError
 6 sage.categories.category_types.AbelianCategory NotImplementedError
 7 sage.combinat.ncsf_qsym.qsym.QuasiSymmetricFunctions.Bases
 AttributeError
 8 sage.combinat.descent_algebra.DescentAlgebraBases AttributeError
 9 sage.categories.quotients.QuotientsCategory TypeError
 10 sage.combinat.ncsf_qsym.ncsf.NonCommutativeSymmetricFunctions.Bases
 AttributeError
 11 sage.categories.additive_magmas.AdditiveCommutative.Algebras
 AssertionError
 12 sage.categories.realizations.RealizationsCategory TypeError
 13 sage.combinat.ncsym.bases.MultiplicativeNCSymBases AttributeError
 14 sage.categories.sets_cat.Sets.CartesianProducts TypeError
 15 sage.categories.graded_modules.GradedModulesCategory KeyError
 16 sage.categories.sets_cat.Sets.Subobjects TypeError
 17 sage.categories.cartesian_product.CartesianProductsCategory TypeError
 18 sage.categories.magmas.Magmas.Realizations TypeError
 19 sage.categories.hopf_algebras.HopfAlgebras.Realizations TypeError
 20 sage.categories.groups.Groups.Algebras AssertionError
 21 sage.categories.magmas.Magmas.Algebras AssertionError
 22 sage.categories.isomorphic_objects.IsomorphicObjectsCategory TypeError
 23 sage.categories.sets_with_partial_maps.SetsWithPartialMaps.HomCategory
 TypeError
 24
 
sage.combinat.ncsf_qsym.generic_basis_code.GradedModulesWithInternalProduct.Realizations
 TypeError
 25 sage.combinat.sf.sfa.SymmetricFunctionsBases AttributeError
 26 sage.categories.category.HomCategory TypeError
 27 sage.categories.sets_cat.Sets.Subquotients TypeError
 28 sage.categories.algebras_with_basis.AlgebrasWithBasis.CartesianProducts
 TypeError
 29
 sage.categories.finite_enumerated_sets.FiniteEnumeratedSets.IsomorphicObjects
 TypeError
 30 sage.categories.sets_cat.Sets.Realizations TypeError
 31 sage.categories.realizations.Category_realization_of_parent
 NotImplementedError
 32 sage.categories.category_with_axiom.BrokenTestObjects
 NotImplementedError
 33 sage.categories.category.CategoryWithParameters NotImplementedError
 34 sage.categories.magmas.Commutative.Algebras AssertionError
 35 sage.categories.vector_spaces.VectorSpaces.DualObjects TypeError
 36 sage.categories.hopf_algebras.HopfAlgebras.Morphism NotImplementedError
 37 sage.categories.category_types.Category_in_ambient TypeError
 38 sage.categories.objects.Objects.HomCategory TypeError
 39
 
sage.combinat.ncsf_qsym.ncsf.NonCommutativeSymmetricFunctions.MultiplicativeBasesOnGroupLikeElements
 AttributeError
 40 sage.categories.schemes.Schemes.HomCategory TypeError
 41
 
sage.combinat.ncsf_qsym.ncsf.NonCommutativeSymmetricFunctions.MultiplicativeBases
 AttributeError
 42 sage.categories.semigroups.Semigroups.Subquotients TypeError
 43 sage.categories.sets_cat.Sets.Algebras AssertionError
 44 sage.categories.coalgebras.Coalgebras.TensorProducts TypeError
 45 sage.categories.hecke_modules.HeckeModules.HomCategory TypeError
 46 sage.categories.category_types.Category_module NotImplementedError
 47 sage.categories.algebras.Algebras.CartesianProducts TypeError
 48 sage.categories.algebras_with_basis.AlgebrasWithBasis.TensorProducts
 TypeError
 49 sage.combinat.ncsym.bases.NCSymOrNCSymDualBases AttributeError
 50 sage.categories.subquotients.SubquotientsCategory TypeError
 51 sage.categories.algebras.Algebras.TensorProducts TypeError
 52 sage.categories.coalgebras.Coalgebras.DualObjects TypeError
 53 sage.categories.magmas.Unital.Algebras AssertionError
 54 sage.categories.additive_magmas.AdditiveUnital.Algebras AssertionError
 55 sage.categories.category_types.Category_ideal NotImplementedError
 56 sage.categories.modules_with_basis.ModulesWithBasis.HomCategory
 TypeError
 57 sage.categories.tensor.TensorProductsCategory TypeError
 58 sage.categories.algebras.Algebras.DualObjects TypeError
 59 sage.categories.semigroups.Semigroups.Quotients TypeError
 60
 sage.categories.hopf_algebras_with_basis.HopfAlgebrasWithBasis.TensorProducts
 TypeError
 61 sage.categories.finite_sets.FiniteSets.Subquotients TypeError
 62 sage.categories.category_types.Category_over_base_ring
 NotImplementedError
 63 sage.categories.category_with_axiom.SmallTestObjects
 NotImplementedError
 64 sage.categories.hopf_algebras.HopfAlgebras.TensorProducts TypeError
 65
 
sage.combinat.ncsf_qsym.ncsf.NonCommutativeSymmetricFunctions.MultiplicativeBasesOnPrimitiveElements
 AttributeError
 66
 sage.categories.covariant_functorial_construction.CovariantConstructionCategory
 TypeError
 67 sage.categories.magmas.Magmas.CartesianProducts TypeError
 68 sage.categories.semigroups.Semigroups.CartesianProducts TypeError
 69 sage.categories.dual.DualObjectsCategory TypeError
 70 sage.categories.modules.Modules.EndCategory TypeError
 71 sage.categories.finite_sets.FiniteSets.Algebras AssertionError
 72 sage.algebras.iwahori_hecke_algebra.IwahoriHeckeAlgebra._BasesCategory
 AttributeError
 73 sage.categories.coalgebras.Coalgebras.WithRealizations TypeError
 74 sage.categories.subobjects.SubobjectsCategory TypeError
 75 sage.categories.sets_cat.Sets.WithRealizations TypeError
 76 sage.categories.additive_magmas.AdditiveUnital.WithRealizations
 TypeError
 77
 sage.categories.finite_enumerated_sets.FiniteEnumeratedSets.CartesianProducts
 TypeError
 78 sage.categories.modules_with_basis.ModulesWithBasis.CartesianProducts
 TypeError
 79 sage.categories.semigroups.Semigroups.Algebras AssertionError
 80 <class 'sage.categories.modules.Modules'> yields instance of <class
 'sage.categories.vector_spaces.VectorSpaces_with_category'>
 81 sage.categories.modules.Modules.HomCategory TypeError
 82 sage.categories.category_with_axiom.TestObjectsOverBaseRing.Commutative
 TypeError
 83 sage.categories.monoids.Monoids.WithRealizations TypeError
 84
 
sage.categories.covariant_functorial_construction.RegressiveCovariantConstructionCategory
 TypeError
 85 sage.categories.rings.Rings.HomCategory TypeError
 86 sage.categories.category_singleton.Category_singleton AssertionError
 87 sage.categories.category.Category NotImplementedError
 88 sage.categories.monoids.Monoids.Subquotients TypeError
 89 sage.combinat.ncsym.bases.NCSymBases AttributeError
 90 sage.categories.coalgebras.Coalgebras.Realizations TypeError
 91 sage.categories.with_realizations.WithRealizationsCategory TypeError
 92 sage.categories.sets_cat.Sets.IsomorphicObjects TypeError
 93 sage.categories.sets_cat.Sets.Quotients TypeError
 94 sage.categories.monoids.Monoids.CartesianProducts TypeError
 95 sage.combinat.ncsf_qsym.generic_basis_code.BasesOfQSymOrNCSF
 AttributeError
 96 sage.categories.modules_with_basis.ModulesWithBasis.TensorProducts
 TypeError
 97 sage.categories.magmas.Magmas.Subquotients TypeError
 98 sage.categories.category.JoinCategory TypeError
 99
 
sage.categories.graded_hopf_algebras_with_basis.GradedHopfAlgebrasWithBasis.WithRealizations
 TypeError
 100
 
sage.algebras.iwahori_hecke_algebra.IwahoriHeckeAlgebra_nonstandard._BasesCategory
 AttributeError
 101 sage.categories.sets_cat.Sets.HomCategory TypeError
 102 sage.categories.monoids.Monoids.Algebras AssertionError
 103 sage.categories.category_types.Category_over_base NotImplementedError
 104
 sage.categories.commutative_additive_groups.CommutativeAdditiveGroups.Algebras
 AssertionError
 105 sage.categories.category_with_axiom.BrokenTestObjects.Commutative
 NotImplementedError
 106 <class 'sage.categories.modules_with_basis.ModulesWithBasis'> yields
 instance of <class
 'sage.categories.vector_spaces.VectorSpaces.WithBasis_with_category'>
 107 sage.categories.category_with_axiom.TestObjectsOverBaseRing.Unital
 TypeError
 108
 sage.categories.category_with_axiom.TestObjectsOverBaseRing.FiniteDimensional
 TypeError
 109 sage.categories.category_with_axiom.BrokenTestObjects.Finite
 NotImplementedError
 110 sage.categories.category_with_axiom.Commutative.Facade TypeError
 111 <class
 
'sage.categories.finite_dimensional_modules_with_basis.FiniteDimensionalModulesWithBasis'>
 yields instance of <class
 'sage.categories.category.JoinCategory_with_category'>
 112 sage.categories.category_with_axiom.Commutative.FiniteDimensional
 TypeError
 113 <class 'sage.categories.modules.Modules.FiniteDimensional'> yields
 instance of <class 'sage.categories.category.JoinCategory_with_category'>
 114 sage.categories.category_with_axiom.SmallTestObjects.Finite
 NotImplementedError
 115 sage.categories.category_with_axiom.Commutative.Finite TypeError
 116 sage.categories.category_with_axiom.FiniteDimensional.Finite TypeError
 117 sage.categories.category_with_axiom.Commutative.Finite
 NotImplementedError
 118 sage.categories.category_with_axiom.FiniteDimensional.Unital TypeError
 119 sage.categories.category_with_axiom.Finite.Commutative
 NotImplementedError
 120 sage.categories.category_with_axiom.Unital.Commutative TypeError
 }}}

 In examples 80, 106, 111 and 113, `C.an_instance()` does return something,
 but it does not return an instance of C.

 And please don't forget:
 {{{
 sage: type(sage.categories.category_with_axiom.SmallTestObjects.Connected)
 <type 'int'>
 sage:
 type(sage.categories.category_with_axiom.SmallTestObjects.Commutative)
 <type 'classobj'>
 }}}
 which are bugs, too.

 > Have you tried the category_sample
 > function?

 Never heard of it before, hence: No.

 > I am not sure. If there is some inconsistency, you can always work in
 > a sublattice (with bottom) that contains all the involved categories,
 > rather than the full lattice. And I would not be surprised if it could
 > be argued that one could always choose such a sublattice with a
 > category that is actually implemented in Sage.

 Sublattice it is. But how big do you need to choose the sublattice in
 order to
 detect the inconsistency? Since we already have Gröbner bases in this
 thread:
 Generally you'll need to consider elements of rather high degree in order
 to
 detect all relations in small degree. Sure, in a boolean polynomial ring
 the
 order is bounded by the number of generators, as they are idempotent.

 > Right. But Sage's startup would still require being able to manipulate
 > such a Gröbner basis in one form or the other. And one needs to make
 > sure the Gröbner basis is consistent with all the code (that is Sage's
 > compilation might require a Gröbner basis computation). And that it
 > can be extended dynamically if users introduce new categories in their
 > own library.

 Exactly. If I had to choose between a Gröbner basis computation in a
 boolean
 polynomial ring (which is a relatively moderate task due to idempotency)
 and
 the requirement to manually do local choices that are globally consistent,
 I'd
 do the former.

 > I am certainly not saying it's not doable. But it introduces some
 > complexity which has to be well motivated.

 Are you talking about ''mathematical'' complexity? Then my answer is that
 the
 complexity of the underlying local--global problem is there, whether we
 want
 it or not. And I'd rather have the complexity dealt with by a mathematical
 theory (commutative algebra) than by the inspiration of all future
 developers
 of categories.

 > Sorry, I can't resist; let me use the very argument that soo many
 > people have raised when saying that all that category stuff was just
 > overdesign. «Before introducing non trivial design to solve a scaling
 > issue, one needs to be sure there is one in practice».  So far, I
 > haven't had a single time where I got bothered by that.

 With exception of the `Blahs.Unital.Blue` example, you mean...

 > For Fields vs Division rings, the asymmetry is *very* natural. You put
 > the class in Fields.Finite, because it's about stuff valid for finite
 > fields. And you put in DivisionRings the theorem which tells you that
 > in the context of division rings, the "Finite" axiom implies the
 > "commutative" axioms.

 Then consider the axiom `a*b==a*c => b==c` (I don't know an English word
 for
 it, thus call it "kürzbar"). There are infinite "kürzbare" rings that
 aren't
 division ring (e.g., the ring of integers). However, for finite rings,
 being
 "kürzbar" and "division" are equivalent.

 So, you have a perfectly symmetric formulation:
 `Rings.Finite.Kürzbar==Rings.Finite.Division`. So, how to choose a
 default? In
 this particular example you could argue that both are equal to
 `Fields.Finite`. But generally?

 Next, imagine you have several of such symmetric statements. You ''can''
 do a
 consistent symmetry break---but that's probably equivalent to chosing a
 monomial order in a polynomial ring.

 >  And
 > second DivisionRings().Finite() would not coincide with
 > Fields().Finite(); and this is the first thing you would test.

 Why not? If I do
 {{{
 DivisionRings.Finite = FiniteFields # lazily imported from
 sage.categories.finite_fields
 }}}
 and
 {{{
 Fields.Finite = FiniteFields # lazily imported from
 sage.categories.finite_fields
 }}}
 then of course both are the same!

 The only problem is that the current ''implementation'' would complain.
 And
 that's what I think is a deficiency of the current implementation. Doing
 the
 above is natural and easy syntax, and it should be supported.

 > I believe, and will work on proving formally, that the current
 > implementation is perfectly well-defined and gives normal forms.

 I am talking about people who want to extend the current implementation:
 Add
 new axioms, new basic categories, and in particular new mathematical
 theorems
 about categorial identities.

 > No I did not do wrong. It does demonstrates *on
 > purpose* a *missing feature*: namely that you currently can't use the
 > Blue_extra_super_categories mechanism in the category where the Blue
 > axiom is defined.

 You talk about an implementation detail (`Blue_extra_super_categories`). I
 am
 talking about the fact that in this example (made up) mathematical axioms
 do not commute.

--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:433>
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.

Reply via email to