Project

General

Profile

Design #1223

NewPolyRing default indet names

Added by John Abbott over 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Safety
Start date:
02 Sep 2018
Due date:
% Done:

100%

Estimated time:
4.01 h
Spent time:

Description

Currently NewPolyRing may be called specifying just the number of indets (but not their names).
Currently the names chosen are x[1] up to x[n].

This has caused trouble in the factorizer of algebraic extensions.

JAA thinks it would be better if the ctor chose "anonymous" indet names (this would surely avoid all possible name clashes, incl. the one discovered in the factorizer over algebraic extensions).

An alternative could be to eliminate the ctors which do not require a list of indet names: the caller could then explicitly create a list if indet names using NewSymbols or SymbolRange.

Discuss; decide; implement.


Related issues

Related to CoCoALib - Feature #320: PPMonoid pseudo-ctors without symbol namesRejected2013-02-21

Related to CoCoA-5 - Support #1240: John's visit Feb 2019Closed2019-02-08

History

#1 Updated by John Abbott over 5 years ago

  • Related to Feature #320: PPMonoid pseudo-ctors without symbol names added

#2 Updated by John Abbott over 5 years ago

The problem was originally communicated to JAA via email. The following is a failing example:

auto Q = CoCoA::RingQQ();
auto Qx = CoCoA::NewPolyRing(Q, CoCoA::symbols("x"));
auto x = CoCoA::indets(Qx)[0];
auto cf = x*x-2;
auto Qadjx = CoCoA::NewQuotientRing(Qx, CoCoA::ideal(cf));
auto Qy = CoCoA::NewPolyRing(Qadjx, CoCoA::symbols("y"));
auto y = CoCoA::indets(Qy)[0];
auto cg = y*y - 3;
auto Qadjy = CoCoA::NewQuotientRing(Qy, CoCoA::ideal(cg));
auto Qz = CoCoA::NewPolyRing(Qadjy, CoCoA::symbols("z"));
auto z = CoCoA::indets(Qz)[0];
auto ch = z*z*z*z-4;
std::cout << "factor(" << ch << ") = " << CoCoA::factor(ch) << std::endl;

The call to factor (in the last line) fails and throws an error about unsuitable indet name.

#3 Updated by John Abbott over 5 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

The problem arises in a call to Hom_P_Px which creates a new polyring by calling NewPolyRing specifying only the number of indets (but not their names). This pseudo-ctor call wants to use names x[1], x[2] and so on, but this clashes with the x used to build the first alg.extn.

The problem can be fixed by changing to Hom_P_Px so that it creates an explicit list of indet names using NewSymbols.

BUT JAA thinks that the problem lies in the pseudo-ctor NewPolyRing which accepts only the number of indets, and which currently uses the indet names x[1], x[2] and so on. JAA thinks that the names should either be produced by NewSymbols, or that the pseudo-ctor should be eliminated.

#4 Updated by Anna Maria Bigatti over 5 years ago

We first had this "friendly" pseudo constructor because the syntax for indet names was tedious.
Now we have SymbolRange, and NewPolyRing(RingQQ(), symbols("x,y,z")) which is even nicer.
(maybe we should even allow NewPolyRing(RingQQ(), "x,y,z")?)

So, after defending them for ages, I'm now in favour of removing the pseudo constructors taking just the number of indets.

#5 Updated by John Abbott over 5 years ago

I see two possible actions:
(A) remove completely the pseudo-ctor which accepts just the number of indets; the caller must then supply indet names in the call e.g. NewPolyRing(QQ, NewSymbols(nvars))
(B) keep the ctor, and make it use "anonymous" symbols instead of x[1], x[2], etc

An advantage of (A) is that it is clear at the point of the call that anon symbols will be used.
A disadvantage of (A) is that the call itself is longer (since it must call NewSymbols(nvars).
The advantage of (B) is that it is backward compatible (but how many times is NewPolyRing(QQ,nvars) called?)

Do you prefer (A) or (B) ? Opinions?

#6 Updated by Anna Maria Bigatti over 5 years ago

John Abbott wrote:

Do you prefer (A) or (B) ? Opinions?

I prefer A, as I had already explained.

#7 Updated by John Abbott over 5 years ago

  • Assignee set to John Abbott
  • % Done changed from 10 to 60

I have updated the code: sources, tests and examples.
Everything compiles, and the tests pass (after changing some expected outputs).
I have checked in -- have fun, Anna!

Still have to change the doc... And removed the commented out old impls.

#8 Updated by Anna Maria Bigatti over 5 years ago

Just to remember.
This should go into obsolescent.

#9 Updated by John Abbott over 5 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 60 to 70

Removed the doc. Moved the old fns into obsolescent.

#10 Updated by John Abbott about 5 years ago

  • Status changed from Resolved to Feedback
  • % Done changed from 70 to 90

This has been "resolved" for 5 months. Moving to "feedback". Hope to close while I'm in Genoa.

#11 Updated by John Abbott about 5 years ago

#12 Updated by John Abbott about 5 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

#13 Updated by Anna Maria Bigatti over 4 years ago

  • Estimated time set to 4.01 h

Also available in: Atom PDF