Given a pair of Objects R and S, try and construct a
reasonable object $Y$ and return maps such that
cannonically $R \leftarrow Y
ightarrow S$.
ALGORITHM:
This incorperates the idea of functors discussed SAGE Days 4.
Every object $R$ can be viewed as an initial object and
a series of functors (e.g. polynomial, quotient, extension,
completion, vector/matrix, etc.) Call the series of
increasingly-simple rings (with the associated functors)
the "tower" of $R$. The \code{construction} method is used to
create the tower.
Given two objects $R$ and $S$, try and find a common initial
object $Z$. If the towers of $R$ and $S$ meet, let $Z$ be their
join. Otherwise, see if the top of one coerces naturally into
the other.
Now we have an initial object and two \emph{ordered} lists of
functors to apply. We wish to merge these in an unambiguous order,
popping elements off the top of one or the other tower as we
apply them to $Z$.
- If the functors are distinct types, there is an absolute ordering
given by the rank attribute. Use this.
- Otherwise:
- If the tops are equal, we (try to) merge them.
- If \emph{exactly} one occurs lower in the other tower
we may unambiguously apply the other (hoping for a later merge).
- If the tops commute, we can apply either first.
- Otherwise fail due to ambiguity.
EXAMPLES:
Here our "towers" are $R = Complete_7(Frac(\Z)$ and $Frac(Poly_x(\Z))$, which give us $Frac(Poly_x(Complete_7(Frac(\Z)))$
sage: from sage.categories.pushout import pushout
sage: pushout(Qp(7), Frac(ZZ['x']))
Fraction Field of Univariate Polynomial Ring in x over 7-adic Field with capped relative precision 20
Note we get the same thing with
sage: pushout(Zp(7), Frac(QQ['x']))
Fraction Field of Univariate Polynomial Ring in x over 7-adic Field with capped relative precision 20
sage: pushout(Zp(7)['x'], Frac(QQ['x']))
Fraction Field of Univariate Polynomial Ring in x over 7-adic Field with capped relative precision 20
Note that polynomial variable ordering must be unambiguously determined.
sage: pushout(ZZ['x,y,z'], QQ['w,z,t'])
Traceback (most recent call last):
...
TypeError: Ambiguous Base Extension
sage: pushout(ZZ['x,y,z'], QQ['w,x,z,t'])
Multivariate Polynomial Ring in w, x, y, z, t over Rational Field
Some other examples
sage: pushout(Zp(7)['y'], Frac(QQ['t'])['x,y,z'])
Multivariate Polynomial Ring in x, y, z over Fraction Field of Univariate Polynomial Ring in t over 7-adic Field with capped relative precision 20
sage: pushout(ZZ['x,y,z'], Frac(ZZ['x'])['y'])
Multivariate Polynomial Ring in y, z over Fraction Field of Univariate Polynomial Ring in x over Integer Ring
sage: pushout(MatrixSpace(RDF, 2, 2), Frac(ZZ['x']))
Full MatrixSpace of 2 by 2 dense matrices over Fraction Field of Univariate Polynomial Ring in x over Real Double Field
sage: pushout(ZZ, MatrixSpace(ZZ[['x']], 3, 3))
Full MatrixSpace of 3 by 3 dense matrices over Power Series Ring in x over Integer Ring
sage: pushout(QQ['x,y'], ZZ[['x']])
Univariate Polynomial Ring in y over Power Series Ring in x over Rational Field
sage: pushout(Frac(ZZ['x']), QQ[['x']])
Laurent Series Ring in x over Rational Field
AUTHORS:
-- Robert Bradshaw
|