8000 coercion system for nested polynomial ring is not sane · Issue #39126 · sagemath/sage · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
coercion system for nested polynomial ring is not sane #39126
Open
@user202729

Description

@user202729

Issue 1: sometimes coerce map is not callable

  • done
sage: QQ["a"]["b,c"].coerce_map_from(QQ["a,c,b"])
Call morphism:
  From: Multivariate Polynomial Ring in a, c, b over Rational Field
  To:   Multivariate Polynomial Ring in b, c over Univariate Polynomial Ring in a over Rational Field
sage: QQ["a"]["b,c"].coerce_map_from(QQ["a,c,b"])(QQ["a,c,b"].1)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
...
TypeError: c is not a constant polynomial

I found this while working on #39089 .
The coerce map is reported to exist by Sage only because __call__ is (incorrectly)
overridden by multipolynomial ring implementation (parents are not supposed to override
__call__, they should override _element_constructor_ instead).

Issue 2: sometimes R ← S and S ← T has coerce map, but R ← T has no coerce map

  • done
sage: R=QQ["a,b"]["c,d"]
....: S=QQ["a,b,c,d"]
....: T=QQ["a,c,b,d"]
....: U=QQ["a,c"]["b,d"]
sage: R.coerce_map_from(U) is None
True
sage: R.coerce_map_from(S) * S.coerce_map_from(T) * T.coerce_map_from(U)
Composite map:
  From: Multivariate Polynomial Ring in b, d over Multivariate Polynomial Ring in a, c over Rational Field
  To:   Multivariate Polynomial Ring in c, d over Multivariate Polynomial Ring in a, b over Rational Field
  Defn:   Coercion map:
          From: Multivariate Polynomial Ring in b, d over Multivariate Polynomial Ring in a, c over Rational Field
          To:   Multivariate Polynomial Ring in a, c, b, d over Rational Field
        then
          Coercion map:
          From: Multivariate Polynomial Ring in a, c, b, d over Rational Field
          To:   Multivariate Polynomial Ring in a, b, c, d over Rational Field
        then
          Call morphism:
          From: Multivariate Polynomial Ring in a, b, c, d over Rational Field
          To:   Multivariate Polynomial Ring in c, d over Multivariate Polynomial Ring in a, b over Rational Field

Issue 3: nested polynomial ring with coinciding variable na 67EB me lead to non-commuting coerce map

  • done
(
		QQ["a,b"]["a,c"].coerce_map_from(QQ["b"]["a,c"])
		* QQ["b"]["a,c"].coerce_map_from(QQ["a"])
		)(QQ["a"].0) == QQ["a,b"]["a,c"].coerce_map_from(QQ["a"])(QQ["a"].0)

(
		QQ["a,b"][["a,c"]].coerce_map_from(QQ["b"][["a,c"]])
		* QQ["b"][["a,c"]].coerce_map_from(QQ["a"])
		)(QQ["a"].0) == QQ["a,b"][["a,c"]].coerce_map_from(QQ["a"])(QQ["a"].0)

(
		QQ[["a,b"]][["a,c"]].coerce_map_from(QQ[["b"]][["a,c"]])
		* QQ[["b"]][["a,c"]].coerce_map_from(QQ[["a"]])
		)(QQ[["a"]].0) == QQ[["a,b"]][["a,c"]].coerce_map_from(QQ[["a"]])(QQ[["a"]].0)

It looks impossible to resolve this issue, unless we deprecate the construction of nested polynomial/power series/Laurent polynomial/series ring/etc. with same variable names.

It gets worse — what about quotient rings?

sage: R.<a,b>=QQ[]
sage: S=R.quotient(a^2+1)
sage: (S["a,c"].coerce_map_from(QQ["b"]["a,c"]) * QQ["b"]["a,c"].coerce_map_from(QQ["a"]))(QQ["a"].0)
a
sage: (S["a,c"].coerce_map_from(QQ["a"]))(QQ["a"].0)
abar

Issue 4: un-flattening morphism may or may not be coercion map depends on univariate/multivariate case

  • done
sage: R = QQ["a"]["b"]
sage: S = R.flattening_morphism().codomain()
sage: R.coerce_map_from(S)
sage: S.coerce_map_from(R)
Coercion map:
  From: Univariate Polynomial Ring in b over Univariate Polynomial Ring in a over Rational Field
  To:   Multivariate Polynomial Ring in a, b over Rational Field
sage: R = QQ["a,b"]["c,d"]
sage: S = R.flattening_morphism().codomain()
sage: R.coerce_map_from(S)
Call morphism:
  From: Multivariate Polynomial Ring in a, b, c, d over Rational Field
  To:   Multivariate Polynomial Ring in c, d over Multivariate Polynomial Ring in a, b over Rational
 Field
sage: S.coerce_map_from(R)
Coercion map:
  From: Multivariate Polynomial Ring in c, d over Multivariate Polynomial Ring in a, b over Rational
 Field
  To:   Multivariate Polynomial Ring in a, b, c, d over Rational Field

Environment

  • OS: Linux
  • Sage Version: latest development source

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0