Bug #1740
MinGens gives non minimal gens *if some deg=0*
Description
In this example MinGens gives a result which is not minimal.
Can the algorithm MinGens work if the input is homogeneous but with some weight=0?
I don't think so, but think about it and block MinGens in this case (and fix whatever might not work if homogeneous with null weights)
letters := [ascii(96+i) | i in 1..26]; --====================================================== W := mat([[0, 2, 2, 2, 1, 1, 1, 1]]); R := NewPolyRing(QQ, first(letters, NumCols(W)), MakeTermOrdMat(W), 1); use R; NumIndets(R); indets(R); F := a^4*e -a^4*g -a^3*f -a^3*g +a^2*e +2*a^2*g -2*a*f -a*h +g; G := a^3*(a^2*e*f +a^2*e*g -a^2*f*g -a^2*g^2 -a^2*e*h +a^2*g*h -a*f^2 -2*a*f*g -a*g^2 +a*f*h +a*g*h -e*f); LL := [ F, F*(-a^2*f +a^2*h -a^2*g +2*f +g) +a*G, G]; L := MinGens(ideal(LL)); indent(L); L[2] IsIn ideal(L[1],L[3]); GenRepr(L[2], ideal(L[1], L[3]));
Related issues
History
#1
Updated by Anna Maria Bigatti about 1 year ago
This example was generated by simplifying the original big example found by L.Robbiano
#2
Updated by John Abbott about 1 year ago
- Target version changed from CoCoALib-0.99800 to CoCoALib-0.99850
I wonder if it could be made to work by assuming that all indets with weight 0 actually have epsilon (an infinitesimal).
Strictly the polynomial would no longer be homogeneous: e.g. some PPs would have degree 2 others 2+epsilon.
Anna reported (by phone) that Robbiano observed that the current impl often does give the right answer.
Anna also reported that it was not easy finding a smaller example which gave the wrong answer.
Not at all sure that my idea is a good one, but I did want to write it down.
#3
Updated by Anna Maria Bigatti about 1 year ago
smaller
W := mat([[0, 1, 1]]); R := NewPolyRing(QQ, first(lettere, NumCols(W)), MakeTermOrdMat(W), 1); use R; LL := [ a^4*b -a^4*c -2*a^3*c +a^2*b +2*a^2*c -3*a*c +c, -4*a^4*c^2 -a^3*c^2 +2*a^2*b*c +3*a^2*c^2 -6*a*c^2 +2*c^2, a^5*b*c -a^5*c^2 -2*a^4*c^2 -a^3*b*c ]; L := MinGens(ideal(LL)); indent(L); L[2] IsIn ideal(L[1],L[3]); GenRepr(L[2], ideal(L[1], L[3]));
#4
Updated by Anna Maria Bigatti about 1 year ago
SetVerbosityLevel(120); --====================================================== W := mat([[0, 1, 1]]); R := NewPolyRing(QQ, first(lettere, NumCols(W)), MakeTermOrdMat(W), 1); use R; LL := [ a*b +c, a^2*c, a^2*b ]; L := MinGens(ideal(LL)); indent(L); ---> [a*b +c, a^2*c, -a*c] L[2] IsIn ideal(L[1],L[3]); ---> true
So, what happens here?
The generators are processed in this order:
- a*b +c
- a^2*c
- a^2*b ---> -a*c
When all weights are positive,
if deg(T1) = deg(T2) and T1 | T2 then T1 = T2
(thanks J.Abbott for pointing that out)
so T2+... could be reduced by T1+... as well as the opposite, making the order in which we deal with them irrelevant.
This is not the case here:
deg(a*c) = deg(a^2*c) and a*c | a^2*c
but a^2*c was the one found first and is not reduced by the new one.
Notice that we are following this ordering
[[0, 1, 1], [1, 0, 0], [0, 0, -1]])
we choose the generators in increasing order
a*b < a^2*c < a^2*b
and also choosing with decreasing order we would meet the same problem, worse, in fact.
This is the point I wanted to study (if there was a way to guarantee the result even with 0 weights) and why I looked so much for a small example.
Now I'm inclined to say there is no trivial way out.
The good point is that we could just interreduce the polynomials with the same degree, but that would require changing the "homogeneous" code ad-hoc and is not trivial.
#5
Updated by Anna Maria Bigatti about 1 year ago
- Related to Feature #1742: MinGens could be faster added
#6
Updated by Anna Maria Bigatti about 1 year ago
- Subject changed from MinGens gives non minimal gens (if some deg=0) to MinGens gives non minimal gens *if some deg=0*
#7
Updated by John Abbott about 1 year ago
I have inserted a "quick hack" solution: just call HasPositiveGrading
inside myMinGens
.
It detects the examples here. Checking in so that we can make an interim release tomorrow,
#8
Updated by Anna Maria Bigatti 4 months ago
For the time being: should we give error? (as if non-homogeneous?)
#9
Updated by John Abbott 4 months ago
Perhaps ERR::NYI
?
#10
Updated by Anna Maria Bigatti 3 months ago
- Target version changed from CoCoALib-0.99850 to CoCoALib-0.99880
#11
Updated by Anna Maria Bigatti about 1 month ago
- % Done changed from 30 to 40
While trying to understand how to work around this, I resumed the partial minimalization with the function MinGens_almost
(under request from Lorenzo Robbiano: partial is better than running the general MinSubsetOfGens
).
#12
Updated by Anna Maria Bigatti about 1 month ago
This is how the usual MinGens labelling can go horribly wrong with non-negative gradings:
S := NewPolyRingWeights(QQ, "x,y,a", mat([ [1, 1, 0] ]));
Use S;
G := [ y*a -y, x*a, x*a -y*a -x ];
This is an extract with verbosity = 200: (polys in GB are indexed from 0)
A new poly coming from a pair reduces the tails of the polinomial labelled as minimal (in the same degree!)
thus making them non-minimal --> [y*a, x*a, -x]
Note: the final GB is [x, y]
=============================== [D2,L121,myReduceCurrentSPoly] <InputPoly> [D2,L200,myReduceCurrentSPoly] --before: y*a -y --after: y*a -y --> GB[0] [D2,L121,myReduceCurrentSPoly] <InputPoly> [D2,L200,myReduceCurrentSPoly] --before: x*a --after: x*a --> GB[1] [D2,L121,myReduceCurrentSPoly] <InputPoly> [D2,L200,myReduceCurrentSPoly] --before: x*a -y*a -x --after: -x -y --> GB[2] --- all 3 are labelled "minimal generator" --- [D2,L121,myReduceCurrentSPoly] <1,2> [D2,L200,myReduceCurrentSPoly] --before: -y*a --after: -y --> GB[3] --- -y comes from a pair, so not a "minimal generator" --- but is used to reduce the *tails* (interreduction) --- so modifies y*a -y --> y*a (!!!) making it *not minimal* --- in fact, y*a -y is a multiple of y (cannot happen with positive grading) [D2,L121,myReduceCurrentSPoly] <0,3> [D2,L200,myReduceCurrentSPoly] --before: 0 --after: 0 [D1,L100,myDoGBasis] --Final clean up ...
#13
Updated by Anna Maria Bigatti about 1 month ago
- Status changed from In Progress to Resolved
- % Done changed from 40 to 80
A clever implementation is difficult/impossible.
However, the new GBasisTrunc
(which also works for non-negative gradings), makes the function MinSubsetOfGens
considerably faster (for homogeneous input).
#14
Updated by Anna Maria Bigatti about 1 month ago
- Status changed from Resolved to Feedback
- % Done changed from 80 to 90
- Estimated time changed from 8.00 h to 14.05 h
#15
Updated by Anna Maria Bigatti about 1 month ago
- Target version changed from CoCoALib-0.99880 to CoCoALib-0.99850
#16
Updated by Anna Maria Bigatti about 1 month ago
- Related to Feature #1743: Implement Truncated GBases for homogeneous input added