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
On Saturday 13 April 2024 at 13:30:23 UTC+2 julian...@fsfe.org wrote:

> 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
>
> On Saturday, April 13, 2024 at 1:58:47 PM UTC+3 axio...@yahoo.de wrote:
>
>> 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
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/6cfa3c5d-90cd-4989-8aad-81d2e006d99fn%40googlegroups.com.

Reply via email to