Hi! We are talking about rings that mathematically are multivariate polynomial rings over a commutative ring R. So, R[x,y], R[y,x], R[x][y], R[y][x], PolynomialRing(R,['x','y'],'lex'), PolynomialRing(R,['x','y'], 'degrevlex'),...
About conversions: They can basically be anything. But: i) There is of course a default conversion that should be reasonably chosen (in particular using "least surprise"). ii) If there is a coercion than it must coincide with the default conversion. iii) It should be easy to define further conversion maps (by defining the images of generators), but of course they have nothing to do with coercion. Let A,B be two polynomial rings over a commutative ring R. What should be the default conversion? Some people argue that the k-th variable of A should always be mapped to the k-th variable of B. Some people say that a variable of A named x should only be mapped to a variable of the same name in B. In that case, there could be no globally defined conversion from A to B (and in particular there can be no coercion) if the variable names of A are not a subset of the variable names of B (of course, one is free to have a partial name or position preserving conversion in that case, say, from R[x,z] to R[y,x]). My personal feeling is that name preserving maps are less surprising than position preserving maps. In any case, there MUST be a global consensus on which rule to choose! As Jeroen has pointed out, the chosen rule partially currently depends on the base ring, and that's a clear bug. About coercions: - Coercions have to be canonical, but that can be meant in a programmatical sense. I.e., there have to be consistent rules concerning which conversions should be coercions. These rules should follow the principle of least surprise and should (when possible) take into account efficiency -- however, mathematical rigour being of most importance. - R[x,y] is A LOT more efficient than R[x][y]. Therefore, there must be no coercion from R[x,y] to R[x][y], but there may be a coercion in the opposite direction. - Identity is a coercion; composition of two coercions is a coercion. - We have certain construction functors in Sage, and in most (all?) cases if F is a construction functor applied to an object A then there is a coercion c:A->F(A). I believe we should go futher: If f:A->B is a coercion then F(f): F(A)->F(B) has to be a coercion as well, so that in addition the following square of coercions commutes: A -> B | | v v F(A)->F(B) The last point is tricky. As coercions are supposed to be morphisms in some category, we should think about what category applies here: The category of commutative R-algebras, or the category of "monomial R-algebras with a monomial ordering"? In the former case, the chosen monomial ordering ('lex', 'degrevlex',...) must play no role, in the latter case, there must be no coercion from 'lex' rings to 'degrevlex' rings. I guess most users won't care about ordering and thus taking the ordering into account is arguably a violation of the principle of least surprise. And now think about quotients of polynomial rings. Let A,B have the same variable names in the same positions, but let the monomial orderings be different. Let I be an ideal in A and J the corresponding ideal in B. So, if we say that there is a name and position preserving COERCION from A to B, then by applying the quotient construction (that's a construction functor!), we have to have a name and position preserving coercion from A/I to B/J. However, when doing computations in A/I and B/J, we are interested in normal forms of elements of A wrt I and of B wrt J. And if the monomial orderings are different, a name and position preserving map would not be compatible with normal forms. Therefore, NOT taking the ordering into acount is arguably a violation of the principle of least surprise. So far, I hardly mentioned iterated constructions such as R[x][y][z], that are obtained by applying several construction functors. Hence, the pushout construction comes into play, respectively merging and/or commutating construction functors, and concatenation of construction functors. As R[x][z] corresponds to an ordered sub-ring of R[x][y][z] by a name preserving map, one could argue that there should be a coercion. However, these iterated polynomial ring constructions are quite inefficient. So, wouldn't it be better to have instead some kind of push-out, which would be R[x,y,z] with a suitable monomial ordering? This could be achieved by merging several PolynomialFunctor into a single MultiPolynomialFunctor. Both R[x][z] and R[x][y][z] would coerce into R[x,y,z]. However, what should be that ordering? I guess lexicographic with z>y>x, right? On the other hand, we do want that construction functors give rise to coercions. Thus, there ought to be a coercion directly from R[x][y] to R[x][y][z]. And that's where the worms start to leave their can: It would be highly counter-intuitive to say that there is *no* coercion from R[x][z] to R[x][y][z] (because we prefer to coerce both into a more efficient pushout R[x,y,z]), whereas there *is* a coercion from R[x][y] to R[x][y][z] (because the construction functor "PolynomialFunctor('z')" is applied). So, wouldn't it be better to *not* merge severeal univariate PolynomialFunctor into a MultiPolynomialFunctor after all? But keep in mind that there should still be a coercion from PolynomialFunctor('x')(R) to MultiPolynomialFunctor(['x','z'],'lex')(R). So, the former construction functor should be merged into the latter. I thus tend to kind of proposing the following: - All default (partial) conversions between polynomial rings are preserving names, as that's less surprising than position preserving maps. - If P1,P2 are polynomial rings over R, then a coercion from P1 to P2 is a *name* preserving homomorphism of graded-rings-with-monomial-ordering. Hence, it is name preserving, degree preserving, and maps P1 to an ordered sub-ring of P2. That's of course very strict, but I think this would work best with categorial constructions. - Constructing a polynomial ring is related with a (Multi)PolynomialFunctor F. Hence, if there is a coercion c between commutative rings R1 to R2, there has to be a coercion between F(R1) and F(R2) induced by c. - If F1,F2,...,Fm and G1,...,Gn are (Multi)PolynomialFunctors applied to the same base ring, then simply the usual pushout construction should be applied, merging F1 into G1 iff F1(R) has a name-preserving map to an ordered sub-ring of G1(R) for all R. Problem: It is currently possible to create the polynomial ring R[x][x] (hence, x occurs twice). If "x" has two different meanings in the same ring, the notion "name preserving map" makes no sense. I believe it should be made impossible to create such ring. Perhaps the .__mul__ method of PolynomialRing and MultiPolynomialRing could be utilised for this, when needed. Kind regards, Simon -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.