Design #1647
Suppress zero from ideal generators? Detect 1 and simplify generators?
Description
Should ideals suppress zero generators?
Currently we have:
/**/ I := ideal(x,x-x,x-x,y); /**/ I; ideal(x, 0, 0, y)
This issue proposes changing this into:
/**/ I := ideal(x,x-x,x-x,y); // have to make 0 by x-x /**/ I; ideal(x, y)
/**/ I := ideal(x,y,1); /**/ I; ideal(1)
The zero ideal would then have no generators.
What do you think?
Related issues
History
#1 Updated by John Abbott over 2 years ago
- Related to Slug #1646: radical: could be more clever added
#2 Updated by John Abbott over 2 years ago
This change does mean that the following could give false
:
/**/ L := [.. some ringelems...]; /**/ I := ideal(L); /**/ gens(I) = L; // might give false /**/ EqSet(gens(I), L); // might give false
Would we even want to allow some further "cleaning" of the generators?
For example, we could suppress duplicates.
Maybe even ideal(x, -x)
could have generators just [x]
?
#3 Updated by John Abbott over 2 years ago
- Related to Feature #1645: Implement monic0(f) for the case monic(0)? added
#4 Updated by John Abbott over 2 years ago
Anna has some doubts.
So far we had the simple rule that L = gens(ideal(L))
.
Also the fn SyzOfGens
is defined to be the same as syz(gens(I))
.
JAA thinks that SyzOfGens
is semantically "a bit dodgy" (because the gens are not uniquely defined, and are often viewed as a set (so order not uniquely defined)).
Certainly the idea to remove zeroes (and possibly make other changes to the list of gens) is not backward compatible.
Would this really cause trouble? Anna is concerned that it might (and how could we check that it won't even in the CoCoA-5 packages?).
#5 Updated by John Abbott over 2 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
Potentially related to this discussion...
We can create a zero ideal by supplying an empty list of gens; however, the ideal prints out in a "strange" way [almost looks like a bug]:
/**/ use R ::= QQ[x,y]; /**/ ideal(zero(R)); --> prints "as expected" ideal(0) /**/ I := ideal(R,[]); /**/ I; ideal()
While we are not too surprised by this printed form, it does look funny.
Can we find a better way of printing it out?
An obvious printed form would be ideal(0)
, i.e. the same as for ideal(zero(R))
.
This would be OK if users were accustomed to the idea of the list of gens containing only non-zero polys.
#6 Updated by John Abbott about 2 years ago
I have just spoken to Florian about this issue.
His initial reaction was that he wanted gens(ideal(L))
to be an identity operation,
but after saying that we are planning to introduce a syz
function (to avoid having
to do SyzOfGens(ideal(L))
), he then seemed to think it was no longer so important.
He also made a suggestion that there could be a separate "cleaning" function which
one would call explicitly: e.g. ideal(CleanGens(L))
.
Another suggestion from Florian would be to interreduce the given gens, and then take
that as the "definitive gens" -- JAA is concerned that this may make the gens "bigger"
(i.e. greater sum of NumTerms
).
#7 Updated by John Abbott about 2 years ago
I like the "separate concept" of "generator cleaning", and it would be nice to make it available as a function.
I am less convinced that the user should be obliged to write ideal(CleanGens(L))
rather than just ideal(L)
:
i.e. I am still in favour of ideal(L)
calling CleanGens
automatically.
We could also have two ways of creating ideals: e.g. ideal(L)
and ideal_DoNotCleanGens(L)
[of course the name is more-or-less a "joke"]
#8 Updated by Anna Maria Bigatti about 2 years ago
John Abbott wrote:
We could also have two ways of creating ideals: e.g.
ideal(L)
andideal_DoNotCleanGens(L)
Maybe ideal_KeepGens
? I like that!
for the rare case in which one really wants the 0's, it would still be possible.
That, of course, does not save us the work of tracking 0's in the generators.
#9 Updated by John Abbott about 2 years ago
After brief consideration, I have decided to keep in this issue discussion related to what "cleaning generators" might mean (even though I also think that it could reasonably be made explicitly callable as a separate function... or does it suffice to do gens(ideal(L))
if you want a "cleaned" version of L
?)
- cleaning removes all zeroes
- cleaning removes duplicates
- cleaning returns just a subset (incl. maybe an empty list?? -- loses ring info!!)
- cleaning can rescale polynomials by invertible factors (think also of
ZZ[x,y,z]
) - cleaning may perform some steps of interreduction (e.g. by monomials and binomials)
- cleaning should not make the list significantly longer than the original input
- cleaning could also perform gcd of univariate polynomials
[0]
[x+1, x+1]
[x, -x]
[x, 2*x]
[x^99, x-2]
interreduction would give[2^99, x-2]
or[1]
over a field[x*y, 2*x*y*z]
#10 Updated by John Abbott about 2 years ago
- implement a new function (probably in CoCoA-5 since it is a prototype) with some/most/all of the features in comment 9 above;
- experiment with this new function (incl. varying what operations "cleaning" may perform)
- assemble a test suite of inputs (incl. also examples where some operation proves to prove "undesirable" output)
- when we are reasonably happy then we can implement in C++
We should also consider what "cleaning" may mean for other ideals in other rings:
e.g. ZZ
and k[x]
are both PIDs, so it may be reasonable just compute the single generator?
#11 Updated by Anna Maria Bigatti about 2 years ago
Following KISS strategy, I would avoid (possibly) costly operations: e.g. interreduction, duplicates (think of a monomial ideal with 1000 generators).
But even linear, like monic
I would do just these:
1 - remove 0
2 - if it contains a constant, make it ideal(1)
#12 Updated by John Abbott about 2 years ago
- Related to Design #908: Sum of ideals: what are the generators of (x) + (0)? added
#13 Updated by John Abbott about 1 year ago
- Target version changed from CoCoALib-0.99850 to CoCoALib-0.99880
#14 Updated by Anna Maria Bigatti 3 months ago
Anna: recover ideas, read it all, decide, implement, and close!
#15 Updated by John Abbott 3 months ago
- remove zeroes
- collect all monomial gens, compute GBasis -- this is beginning of "cleaner gens"
- collect binomial gens: reduce them mod "cleaner gens" (so still binomial or monomial or zero); adjoin reduced versions to "cleaner gens"; probably best to work in order of incr degree
- all remaining gens: reduce mod "cleaner gens": if reduced version is monomial then adjoin to "cleaner gens" & recompute monomial RGB; if reduced is binomial, maybe use it to reduce binomials in "cleaner gens" then adjoin it; o/w just adjoin the reduced version to "cleaner gens"
- need to something clever about scalar factors (e.g. make monic over a field)
I think this heuristic should be reasonably fast while also detecting most "obvious simplifications". NB it is better not to compute RGB of monomials as that can be large (I believe).
#16 Updated by John Abbott 3 months ago
Which ideal operations could benefit from CleanGens
?
Sum, product, maybe colon. Radical?
It might make sense to compute some RGB elements with a low time-out; not sure how to organize this though.
#17 Updated by John Abbott 3 months ago
- Related to Design #1255: Ideals with trivial GBasis added
#18 Updated by John Abbott 3 months ago
Here is an example where the resulting gens could clearly be cleaned up:
/**/ I := ideal(x-y-z, y^4*z^2+2*y^3*z^3+y^2*z^4); /**/ saturate(I, ideal(x*y*z)); ideal(x -y -z, 1)
I found the example on StackOverflow, I think.
#19 Updated by Anna Maria Bigatti 3 months ago
Should we also have that ideal(zero(R))
has empty list of generators?
I think so.
And that would be handy, if we do not add ideal(R)
with that meaning (see #1763; in CoCoA-5 we have ideal(R,[])
, where the empty list is more readable than in C++)
#20 Updated by Anna Maria Bigatti 3 months ago
- Related to Feature #1763: implement ideal(R) for zero ideal, with no generators? added
#21 Updated by Anna Maria Bigatti 3 months ago
Modified
SparsePolyRingBase::IdealImpl::IdealImpl(P, gens)
detecting 1 and 0.
Some cocoa5 tests fail. Need to investigate.
Checked in
#22 Updated by Anna Maria Bigatti 3 months ago
- Related to Bug #1781: GenReprCompute: SERIOUS ERROR added
#23 Updated by Anna Maria Bigatti 3 months ago
- Subject changed from Suppress zero ideal generators? to Suppress zero ideal generators? Detect 1 and simplify generators?
- Description updated (diff)
#24 Updated by Anna Maria Bigatti 3 months ago
- Related to Bug #1205: SyzOfGens: bug with zero generators added
#25 Updated by Anna Maria Bigatti 3 months ago
- Related to Feature #1206: syz, SyzOfGens: which shifts for zero? added
#26 Updated by Anna Maria Bigatti 3 months ago
John Abbott wrote:
Here is an example where the resulting gens could clearly be cleaned up:
[...]
This is still open: I need to similarly fix the sum I + J (added test to exbugs)
#27 Updated by John Abbott 3 months ago
I remind you of the function IsConstant
which should be helpful in this case (if IsField(CoeffRing)).
#28 Updated by Anna Maria Bigatti 3 months ago
John Abbott wrote:
After brief consideration, I have decided to keep in this issue discussion related to what "cleaning generators" might mean (even though I also think that it could reasonably be made explicitly callable as a separate function... or does it suffice to do
Some potential properties to consider:gens(ideal(L))
if you want a "cleaned" version ofL
?)Here are some simple test cases to consider:
- cleaning removes all zeroes
- cleaning removes duplicates
- cleaning returns just a subset (incl. maybe an empty list?? -- loses ring info!!)
- cleaning can rescale polynomials by invertible factors (think also of
ZZ[x,y,z]
)- cleaning may perform some steps of interreduction (e.g. by monomials and binomials)
- cleaning should not make the list significantly longer than the original input
- cleaning could also perform gcd of univariate polynomials
[0]
[x+1, x+1]
[x, -x]
[x, 2*x]
[x^99, x-2]
interreduction would give[2^99, x-2]
or[1]
over a field[x*y, 2*x*y*z]
Add a function CleanupGens
making some more easy checks?
#29 Updated by Anna Maria Bigatti 2 months ago
- % Done changed from 10 to 40
Fixed the sum I + ideal(1)
Added check also for I + ideal(x, x-1) (when ideal HasGBasis
)
use QQ[x,y,z]; I := ideal(x, x-1); GBasis(I); ideal(y) + I;
Tests on exbugs
#30 Updated by Anna Maria Bigatti about 1 month ago
#31 Updated by John Abbott about 1 month ago
- Related to Feature #1797: Add a function CleanupGens making some easy cleaning on the generators? added
#32 Updated by Anna Maria Bigatti about 1 month ago
- Subject changed from Suppress zero ideal generators? Detect 1 and simplify generators? to Suppress zero from ideal generators? Detect 1 and simplify generators?
This is all done (I believe) for ideals in SparsePolyRing.
Do it also for ideals in other rings (should we have another issue?)
#33 Updated by Anna Maria Bigatti about 1 month ago
Sum is clever -- if HasGBasis(I) and is ideal(1)
Do it also for product.
use QQ[x,y,z]; I := ideal(x, x-1); GBasis(I); ideal(y) + I; ideal(y) * I;
#34 Updated by John Abbott about 1 month ago
- Related to Design #1802: Tidying ideal generators (for non-polynomial ideals) added
#35 Updated by Anna Maria Bigatti about 1 month ago
- Status changed from In Progress to Closed
- Assignee set to Anna Maria Bigatti
- Target version changed from CoCoALib-0.99880 to CoCoALib-0.99850
- % Done changed from 40 to 100
Moving note-33 (product) to another issue, because not related to generators.
#36 Updated by Anna Maria Bigatti about 1 month ago
- Related to Feature #1803: Improve trivial operations with ideal whose GBasis is [1] added