Le dimanche 11 mars 2012 à 17:39 +0100, Joachim Durchholz a écrit : > Am 11.03.2012 05:21, schrieb Aaron Meurer: > >>> * There is a categorical oversight in your analysis: in mathematical > >>> terms, 'Monoid' and 'Ring' are categories, while specific algebraic > >>> structures (e.g. the ring of integers (ZZ, +, *)) are members of these > >>> categories. > >> > >> I'm aware of that. > >> The problem is that the class names get unwieldy if you name them > >> MonoidElement. > >> Besides, the class for whole numbers is Integer, not IntegerElement. I'm in > >> good company with that category error ;-) > > > > You could use Integer to name an element and Integers to name the whole > > class. > > That won't work. A class name of "Monoids" has all the wrong connotations. > Besides, all programming languages that I know about says "Integer", not > "Integers". I'm talking to programmers there, not to category theorists, > so I'm sticking with established terminology with that.
'Monoid' is a kind of structure, 'integer' is a kind of number. They aren't on the same level. But I agree that the name of a class should be the (uppercase version of the) name designating an arbitrary instance of the class, so the parallels are Integer/MonoidElement and Ring/Monoid. However, there's another fundamental cause of confusion here. Mathematically, a set and an algebraic structure over that set aren't the same thing. If you call the set of integers ZZ, the ring of integers is (ZZ, +, *), which "contains" 2 monoids: (ZZ, +) and (ZZ, *). So, integers should be instances of the class Integer and we should, separately, have an integer_ring object which is an instance of the class Ring(). On the monoid side, things are a bit different because MonoidElement is presumably a generic class that should work for any monoid. So, MonoidElement instances need a reference to the instance of Monoid they belong to. To have integers fit with this generic framework, we need a similar RingElement class, with signature RingElement(ring, *params) and Integer should subclass it, so that Integer(n) is Liskov-substitutable for RingElement(integer_ring, n). -- You received this message because you are subscribed to the Google Groups "sympy" 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/sympy?hl=en.
