jakobkroeker / test_singular

manage a personal issue list for Singular CAS
0 stars 0 forks source link

guard against shadowing bug (singular trac #677) #159

Open jakobkroeker opened 9 years ago

jakobkroeker commented 9 years ago

main idea:

  1. avoid variable names in strings which get executed
  2. if (1) is not possible/too expensive, guard by exporting variables of current ring. Then a redefinition will trigger a warning:
> ;//unsafe:
> ring R = 0,x,dp;
> execute ("poly x = x-1");  // x = -1, wrong, no error/warning
> x;
-1
> ; //safe:
> ring S = 0,x,dp;
> poly x = var(1) ;// export ring variables
> execute ("poly x = x"); // will result in a warning :
// ** redefining x **

see https://github.com/surface-smoothers/Sources/tree/spielwiese.stepwise.workaround.shadowing

partly fixed for: primdec.lib

TODO: look ad Primdec::algeDeco (funny things happen there)

reported to Olexandr, Hans and Claus (personal communication)

update: failing example with changes:

proc tt()
{
////////////////////////////////////////////////////////////////////////////////////////
def assumeLevel = 3;
//  voice = 2;
system("random",665567462);
//random: 665567462
LIB("bugs/test.primdec.many.orig");
intvec op = 67108864,16787537;
ring rng = (7,vv),(x,y,z),(lp(1),lp(2),C);
minpoly = (vv^2+3*vv+1);
ideal I = x*y*z-y-z,(3*vv+1)*x+(vv)*y^2*z-z,(3*vv+1)*y*z^2+(-vv-3)*y*z+(-vv-3);
bigint trial = 86;
    def minAss1,minAss1e;
list  PL,ML;
def L1=primdecGTZ (I);
def L2=primdecGTZkeepKomp (I);
def L3=primdecSY (I);

L1;
L2;

  //ASSUME(0, testPrimary( PL[1][2] , I ) );
  //ASSUME(0, primDecsAreEquivalent(PL[1][2],PL[2][2]));
}
tt();