Question about change_ring

76 views
Skip to first unread message

Martin R

unread,
Apr 13, 2024, 6:58:47 AM4/13/24
to sage-devel
Dear all,

For parents in the category `Set`, sage has a method `construction`, which yields either None, or a functor F and a parent R, such that F(R) yields the original parent, see below for the docstring.

Many parents implement a method `change_ring`, which returns the parent with the base ring replaced.  For example:

sage: R.<x> = QQ[]
sage: R.change_ring(ZZ)
Univariate Polynomial Ring in x over Integer Ring

What I wonder: shouldn't `change_ring` be also a parent method in some category, e.g. in Category_over_base_ring, which defaults to

def change_ring(self, R):
    c = self.construction()
    if c is None:
        raise NotImplementedError
    return c[0](R)

Martin

Signature:      Sets.ParentMethods.construction(self)
Docstring:    
   Return a pair "(functor, parent)" such that "functor(parent)"
   returns "self". If "self" does not have a functorial construction,
   return "None".

   EXAMPLES:

      sage: QQ.construction()
      (FractionField, Integer Ring)
      sage: f, R = QQ['x'].construction()
      sage: f
      Poly[x]
      sage: R
      Rational Field
      sage: f(R)
      Univariate Polynomial Ring in x over Rational Field

julian...@fsfe.org

unread,
Apr 13, 2024, 7:30:23 AM4/13/24
to sage-devel
Dear Martin,

I don't know much about this area but I don't think construction() is always implemented like that. For example FreeAlgebra(QQ, 2).tensor(FreeAlgebra(QQ, 2)).construction() returns a functor and two arguments.
As a default implementation in the category this might still well work for a lot of cases. Curiously, in the tensor example, change_ring() is actually implemented using construction() (and fails.)

julian

Martin R

unread,
Apr 14, 2024, 3:56:26 AM4/14/24
to sage-devel
Ah, yes!  There are constructions of parents where the second argument is not the base ring, and there are also constructions with higher arity.

So, I guess that, to be on the safe side, a generic change_ring method would have to check `self.construction()[1] == self.base_ring()`.

Martin
Reply all
Reply to author
Forward
0 new messages