Hi!

On 24 Apr., 19:03, "Nathan O'Treally" <not.rea...@online.de> wrote:
> What really would be nice, too, were a chart (or multple charts)
> showing the dependencies, i.e. the "parent" relation(s), so one could
> easily see potential coercion target domains, what domains are
> "incompatible" etc.

I think I have once seen a graph of classes in Sage, and how they
depend on / inherit from each other.

But Parents are different from classes. They are "creative" in the
linguistic sense. Hence, you can create arbitrarily complex parent
structures:
PolynomialRing(MatrixSpace(FractionField(PolynomialRing(ZZ,'x')),
2),'y') etc.So, it seems impossible to me to simply list all parents.

However, one could try to depict something that happens in the
background: There are so-called ConstructionFunctors.

For example:
  sage: R.<x,y> = QQ[]
  sage: R.construction()
  (MPoly[x,y], Rational Field)
  sage: QQ.construction()
  (FractionField, Integer Ring)

So, in order to construct R, one starts with the integers (which is
"godgiven") and forms its fraction field. The result are the
rationals. And to these, a constructor for a "Multivariate Polynomial
Ring in x and y" is applied.

These construction functors are also used in the coercion model: If
you have parent structures X and Y and want to find a common parent,
then you take the constructions of X and Y and try to merge it. So, if
X is QQ and Y is ZZ['t'] then you want to merge the FractionField
constructor and the "polynomial ring in t"-constructor,  applied to ZZ
in both cases.

Now, the construction functors have a specific precedence. And that
means: Sage will *first* apply the fraction field and then the
polynomial ring constructor. The result is QQ['t'], the "pushout" of
QQ and Z['t'].

  sage: pushout(QQ,ZZ['t'])
  Univariate Polynomial Ring in t over Rational Field

It might be possible/nice to depict the currently available
construction functors and the rules for them. I don't know how to do
it, but I think it would indeed improve the understanding of coercion.

Cheers,
Simon

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to