Skip to content

do not use identical var names when constructing rings #16447

@rwst

Description

@rwst

novoselt in comment 17 of #13360:

By the way, I think that this is a bug:

sage: QQ["t"]["t"]
Univariate Polynomial Ring in t over Univariate Polynomial Ring in t over Rational Field

Nobody in mathematics uses the same variable in the same expression with the same meaning, so there is no reason to support it. Moreover, this may indicate a logical error and a user would appreciate catching it. So I think that constructions that "add names" should check that they are absent in the base ring. This way it would be prohibited to create SR["t"], but all polynomials can remain coercible to SR.

I suppose adding such a check is also not extremely difficult, but care should be taken when constructing polynomials "for internal purposes". There should be some standard way to get from a ring a name that can work as a "new name". And it should raise an exception for SR.

I also think that for any element of any ring we should have R(str(f)) == f which is impossible to hope for if we do not insist on distinct names for generators.

I think it's not the worst solution to silently change ["t"]["t"] to ["t1"]["t2"] automatically.

CC: @novoselt

Component: commutative algebra

Issue created by migration from https://trac.sagemath.org/ticket/16447

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions