Changeset 31b08bd in git


Ignore:
Timestamp:
Oct 28, 2017, 2:04:52 PM (6 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
155bf7cc084494f5f1ef07735c609dd4e3d14b6b
Parents:
fa3c79e96fac38774ea42d0424e07cacb3b567a5
Message:
Fix formatting in whole file
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/fpadim.lib

    rfa3c79 r31b08bd  
    4949@*   [ufna] Ufnarovskij: Combinatorical and asymptotic methods in algebra, 1990
    5050@*   [lls] Levandovskyy, La Scala: Letterplace ideals and non-commutative
    51           Groebner bases, 2009
     51Groebner bases, 2009
    5252@*   [studzins] Studzinski: Dimension computations in non-commutative,
    53                      associative algebras, Diploma thesis, RWTH Aachen, 2010
     53associative algebras, Diploma thesis, RWTH Aachen, 2010
    5454
    5555ASSUMPTIONS:
     
    5757@* - all intvecs correspond to Letterplace monomials
    5858@* - if you specify a different degree bound d,
    59      d <= attrib(basering,uptodeg) holds
     59d <= attrib(basering,uptodeg) holds
    6060@* In the procedures below, 'iv' stands for intvec representation
    61   and 'lp' for the letterplace representation of monomials
     61and 'lp' for the letterplace representation of monomials
    6262
    6363PROCEDURES:
     
    148148    {for (i3 = 1; i3 <= n; i3++)
    149149      {for (i4 = 1; i4 <= (n^(i1-1)); i4++)
    150         {M[i2,i1] = i3;
    151           i2 = i2 + 1;
    152         }
     150        {M[i2,i1] = i3;
     151          i2 = i2 + 1;
     152        }
    153153      }
    154154    }
     
    196196      for (j = 1; j<= size(P); j++)
    197197      {if (P[j] <= size(Vt))
    198         {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    199           if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    200         }
     198        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     199          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     200        }
    201201      }
    202202      if (w == 0)
    203203      {vector Vtt;
    204         for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    205         M = M,Vtt;
    206         kill Vtt;
     204        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     205        M = M,Vtt;
     206        kill Vtt;
    207207      }
    208208    }
     
    212212      for (i = 1; i <= size(M); i++)
    213213      {kill Vt; intvec Vt;
    214         for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
    215         dimen = dimen + 1 + findDimen(Vt,n,L,P);
     214        for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
     215        dimen = dimen + 1 + findDimen(Vt,n,L,P);
    216216      }
    217217      return(dimen);
     
    225225      for (j = 1; j<= size(P); j++)
    226226      {if (P[j] <= size(Vt))
    227         {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    228           if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    229         }
     227        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     228          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     229        }
    230230      }
    231231      if (w == 0) {vector Vtt;
    232         for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    233         M = M,Vtt;
    234         kill Vtt;
     232        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     233        M = M,Vtt;
     234        kill Vtt;
    235235      }
    236236    }
     
    240240      for (i = 1; i <= size(M); i++)
    241241      {kill Vt; intvec Vt;
    242         for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
    243         dimen = dimen + 1 + findDimen(Vt,n,L,P,degbound);
     242        for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
     243        dimen = dimen + 1 + findDimen(Vt,n,L,P,degbound);
    244244      }
    245245      return(dimen);
     
    260260      for (j = 1; j <= size(P); j++)
    261261      {if (P[j] <= size(Vt))
    262         {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    263           if (isInMat(Vt2,L[j]) > 0)
    264           {w = 1; break;}
    265         }
     262        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     263          if (isInMat(Vt2,L[j]) > 0)
     264          {w = 1; break;}
     265        }
    266266      }
    267267      if (w == 0) {r = findCycle(Vt,L,P,n,ld,M);}
     
    277277      for (it = 1; it <= j; it++)
    278278      { for(it2 = 1; it2 <= nrows(M);it2++)
    279         {Mt[it,it2] = int(leadcoef(M[it2,it]));}
     279        {Mt[it,it2] = int(leadcoef(M[it2,it]));}
    280280      }
    281281      Vt = V[(size(V)-ld+1)..size(V)];
     
    284284      else
    285285      {vector Vtt;
    286         for (it =1; it <= size(Vt); it++)
    287         {Vtt = Vtt + Vt[it]*gen(it);}
    288         M = M,Vtt;
    289         kill Vtt;
    290         for (i = 1; i <= n; i++)
    291         {Vt = V,i; w = 0;
    292           for (j = 1; j <= size(P); j++)
    293           {if (P[j] <= size(Vt))
    294             {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    295               //L[j]; type(L[j]);Vt2;type(Vt2);
    296               if (isInMat(Vt2,L[j]) > 0)
    297               {w = 1; break;}
    298             }
    299           }
    300           if (w == 0) {r = findCycle(Vt,L,P,n,ld,M);}
    301           if (r == 1) {break;}
    302         }
    303         return(r);
     286        for (it =1; it <= size(Vt); it++)
     287        {Vtt = Vtt + Vt[it]*gen(it);}
     288        M = M,Vtt;
     289        kill Vtt;
     290        for (i = 1; i <= n; i++)
     291        {Vt = V,i; w = 0;
     292          for (j = 1; j <= size(P); j++)
     293          {if (P[j] <= size(Vt))
     294            {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     295              //L[j]; type(L[j]);Vt2;type(Vt2);
     296              if (isInMat(Vt2,L[j]) > 0)
     297              {w = 1; break;}
     298            }
     299          }
     300          if (w == 0) {r = findCycle(Vt,L,P,n,ld,M);}
     301          if (r == 1) {break;}
     302        }
     303        return(r);
    304304      }
    305305    }
     
    313313      for (i = 1; i <= n; i++)
    314314      {Vt = V,i; w = 0;
    315         for (j = 1; j <= size(P); j++)
    316         {if (P[j] <= size(Vt))
    317           {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    318             //L[j]; type(L[j]);Vt2;type(Vt2);
    319             if (isInMat(Vt2,L[j]) > 0)
    320             {w = 1; break;}
    321           }
    322         }
    323         if (w == 0) {r = findCycle(Vt,L,P,n,ld,M);}
    324         if (r == 1) {break;}
     315        for (j = 1; j <= size(P); j++)
     316        {if (P[j] <= size(Vt))
     317          {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     318            //L[j]; type(L[j]);Vt2;type(Vt2);
     319            if (isInMat(Vt2,L[j]) > 0)
     320            {w = 1; break;}
     321          }
     322        }
     323        if (w == 0) {r = findCycle(Vt,L,P,n,ld,M);}
     324        if (r == 1) {break;}
    325325      }
    326326      return(r);
     
    336336"
    337337{
    338  intvec rV;
    339  int k,k1,t;
    340  int j = V[size(V)];
    341  if (T[j,i] > 0) {return(V);}
    342  else
    343  {
    344   for (k = 1; k <= ncols(T); k++)
     338  intvec rV;
     339  int k,k1,t;
     340  int j = V[size(V)];
     341  if (T[j,i] > 0) {return(V);}
     342  else
    345343  {
    346    t = 0;
    347    if (T[j,k] > 0)
    348    {
    349     for (k1 = 1; k1 <= size(V); k1++) {if (V[k1] == k) {t = 1; break;}}
    350     if (t == 0)
     344    for (k = 1; k <= ncols(T); k++)
    351345    {
    352      rV = V;
    353      rV[size(rV)+1] = k;
    354      rV = findCycleDFS(i,T,rV);
    355      if (rV[1] > -1) {return(rV);}
    356     }
    357    }
    358   }
    359  }
    360  return(intvec(-1));
     346      t = 0;
     347      if (T[j,k] > 0)
     348      {
     349        for (k1 = 1; k1 <= size(V); k1++) {if (V[k1] == k) {t = 1; break;}}
     350        if (t == 0)
     351        {
     352          rV = V;
     353          rV[size(rV)+1] = k;
     354          rV = findCycleDFS(i,T,rV);
     355          if (rV[1] > -1) {return(rV);}
     356        }
     357      }
     358    }
     359  }
     360  return(intvec(-1));
    361361}
    362362
     
    381381      for (j = 1; j<= size(P); j++)
    382382      {if (P[j] <= size(Vt))
    383         {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    384           if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    385         }
     383        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     384          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     385        }
    386386      }
    387387      if (w == 0)
    388388      {vector Vtt;
    389         for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    390         M = M,Vtt;
    391         kill Vtt;
     389        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     390        M = M,Vtt;
     391        kill Vtt;
    392392      }
    393393    }
     
    397397      for (i = 1; i <= size(M); i++)
    398398      {kill Vt; intvec Vt;
    399         for (j =1; j <= size(M[i]); j++) {Vt[j] =  int(leadcoef(M[i][j]));}
    400         h1 = h1 + 1; H1 = findHCoeff(Vt,n,L,P,H1);
     399        for (j =1; j <= size(M[i]); j++) {Vt[j] =  int(leadcoef(M[i][j]));}
     400        h1 = h1 + 1; H1 = findHCoeff(Vt,n,L,P,H1);
    401401      }
    402402      if (size(H1) < (size(V)+2)) {H1[(size(V)+2)] = h1;}
     
    413413      for (j = 1; j<= size(P); j++)
    414414      {if (P[j] <= size(Vt))
    415         {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    416           if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    417         }
     415        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     416          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     417        }
    418418      }
    419419      if (w == 0)
    420420      {vector Vtt;
    421         for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    422         M = M,Vtt;
    423         kill Vtt;
     421        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     422        M = M,Vtt;
     423        kill Vtt;
    424424      }
    425425    }
     
    429429      for (i = 1; i <= size(M); i++)
    430430      {kill Vt; intvec Vt;
    431         for (j =1; j <= size(M[i]); j++)
    432         {Vt[j] =  int(leadcoef(M[i][j]));}
    433         h1 = h1 + 1; H1 = findHCoeff(Vt,n,L,P,H1,degbound);
     431        for (j =1; j <= size(M[i]); j++)
     432        {Vt[j] =  int(leadcoef(M[i][j]));}
     433        h1 = h1 + 1; H1 = findHCoeff(Vt,n,L,P,H1,degbound);
    434434      }
    435435      if (size(H1) < (size(V)+2)) { H1[(size(V)+2)] = h1;}
     
    458458      for (j = 1; j<= size(P); j++)
    459459      {if (P[j] <= size(Vt))
    460         {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    461           if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    462         }
     460        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     461          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     462        }
    463463      }
    464464      if (w == 0)
    465465      {vector Vtt;
    466         for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    467         M = M,Vtt;
    468         kill Vtt;
     466        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     467        M = M,Vtt;
     468        kill Vtt;
    469469      }
    470470    }
     
    474474      for (i = 1; i <= size(M); i++)
    475475      {kill Vt; intvec Vt;
    476         for (j =1; j <= size(M[i]); j++)
    477         {Vt[j] =  int(leadcoef(M[i][j]));}
    478         if (size(R[1]) < (size(V)+2)) { R[1][(size(V)+2)] = 1;}
    479         else
    480         {R[1][(size(V)+2)] = R[1][(size(V)+2)] + 1;}
    481         R = findHCoeffMis(Vt,n,L,P,R);
     476        for (j =1; j <= size(M[i]); j++)
     477        {Vt[j] =  int(leadcoef(M[i][j]));}
     478        if (size(R[1]) < (size(V)+2)) { R[1][(size(V)+2)] = 1;}
     479        else
     480        {R[1][(size(V)+2)] = R[1][(size(V)+2)] + 1;}
     481        R = findHCoeffMis(Vt,n,L,P,R);
    482482      }
    483483      return(R);
     
    495495      for (j = 1; j<= size(P); j++)
    496496      {if (P[j] <= size(Vt))
    497         {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    498           if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    499         }
     497        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     498          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     499        }
    500500      }
    501501      if (w == 0)
    502502      {vector Vtt;
    503         for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    504         M = M,Vtt;
    505         kill Vtt;
     503        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     504        M = M,Vtt;
     505        kill Vtt;
    506506      }
    507507    }
     
    511511      for (i = 1; i <= ncols(M); i++)
    512512      {kill Vt; intvec Vt;
    513         for (j =1; j <= size(M[i]); j++)
    514         {Vt[j] =  int(leadcoef(M[i][j]));}
    515         if (size(R[1]) < (size(V)+2)) { R[1][(size(V)+2)] = 1;}
    516         else
    517         {R[1][(size(V)+2)] = R[1][(size(V)+2)] + 1;}
    518         R = findHCoeffMis(Vt,n,L,P,R,degbound);
     513        for (j =1; j <= size(M[i]); j++)
     514        {Vt[j] =  int(leadcoef(M[i][j]));}
     515        if (size(R[1]) < (size(V)+2)) { R[1][(size(V)+2)] = 1;}
     516        else
     517        {R[1][(size(V)+2)] = R[1][(size(V)+2)] + 1;}
     518        R = findHCoeffMis(Vt,n,L,P,R,degbound);
    519519      }
    520520      return(R);
     
    539539      for (j = 1; j<= size(P); j++)
    540540      {if (P[j] <= size(Vt))
    541         {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    542           if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    543         }
     541        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     542          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     543        }
    544544      }
    545545      if (w == 0)
    546546      {vector Vtt;
    547         for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    548         M = M,Vtt;
    549         kill Vtt;
     547        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     548        M = M,Vtt;
     549        kill Vtt;
    550550      }
    551551    }
     
    559559      for (i = 1; i <= size(M); i++)
    560560      {kill Vt; intvec Vt;
    561         for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
    562         R[1] = R[1] + 1; R = findMisDim(Vt,n,L,P,R);
     561        for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
     562        R[1] = R[1] + 1; R = findMisDim(Vt,n,L,P,R);
    563563      }
    564564      return(R);
     
    576576      for (j = 1; j<= size(P); j++)
    577577      {if (P[j] <= size(Vt))
    578         {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    579           if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    580         }
     578        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     579          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     580        }
    581581      }
    582582      if (w == 0)
    583583      {vector Vtt;
    584         for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    585         M = M,Vtt;
    586         kill Vtt;
     584        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     585        M = M,Vtt;
     586        kill Vtt;
    587587      }
    588588    }
     
    596596      for (i = 1; i <= size(M); i++)
    597597      {kill Vt; intvec Vt;
    598         for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
    599         R[1] = R[1] + 1; R = findMisDim(Vt,n,L,P,R,degbound);
     598        for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
     599        R[1] = R[1] + 1; R = findMisDim(Vt,n,L,P,R,degbound);
    600600      }
    601601      return(R);
     
    624624      for (j = 1; j <= size(P); j++)
    625625      {if (P[j] <= size(Vt))
    626         {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    627           if (isInMat(Vt2,L[j]) > 0)
    628           {w = 1; break;}
    629         }
     626        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     627          if (isInMat(Vt2,L[j]) > 0)
     628          {w = 1; break;}
     629        }
    630630      }
    631631      if (w == 0)
    632632      {vector Vtt;
    633         for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    634         M = M,Vtt;
    635         kill Vtt;
     633        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     634        M = M,Vtt;
     635        kill Vtt;
    636636      }
    637637    }
     
    641641      for (i = 1; i <= size(M); i++)
    642642      {kill Vt; intvec Vt;
    643         for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
    644         R = R + findmistletoes(Vt,n,L,P);
     643        for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
     644        R = R + findmistletoes(Vt,n,L,P);
    645645      }
    646646      return(R);
     
    655655      for (j = 1; j <= size(P); j++)
    656656      {if (P[j] <= size(Vt))
    657         {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    658           if (isInMat(Vt2,L[j]) > 0){w = 1; break;}
    659         }
     657        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     658          if (isInMat(Vt2,L[j]) > 0){w = 1; break;}
     659        }
    660660      }
    661661      if (w == 0)
    662662      {vector Vtt;
    663         for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    664         M = M,Vtt;
    665         kill Vtt;
     663        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     664        M = M,Vtt;
     665        kill Vtt;
    666666      }
    667667    }
     
    671671      for (i = 1; i <= ncols(M); i++)
    672672      {kill Vt; intvec Vt;
    673         for (j =1; j <= size(M[i]); j++)
    674         {Vt[j] =  int(leadcoef(M[i][j]));}
    675         //Vt; typeof(Vt); size(Vt);
    676         R = R + findmistletoes(Vt,n,L,P,degbound);
     673        for (j =1; j <= size(M[i]); j++)
     674        {Vt[j] =  int(leadcoef(M[i][j]));}
     675        //Vt; typeof(Vt); size(Vt);
     676        R = R + findmistletoes(Vt,n,L,P,degbound);
    677677      }
    678678      return(R);
     
    683683static proc growthAlg(intmat T, list #)
    684684"
    685  real algorithm for checking the growth of an algebra
    686 "
    687 {
    688  int s = 1;
    689  if (size(#) > 0) { s = #[1];}
    690  int j;
    691  int n = ncols(T);
    692  intvec NV,C; NV[n] = 0; int m,i;
    693  intmat T2[n][n] = T[1..n,1..n]; intmat N[n][n];
    694  if (T2 == N)
    695  {
     685real algorithm for checking the growth of an algebra
     686"
     687{
     688  int s = 1;
     689  if (size(#) > 0) { s = #[1];}
     690  int j;
     691  int n = ncols(T);
     692  intvec NV,C; NV[n] = 0; int m,i;
     693  intmat T2[n][n] = T[1..n,1..n]; intmat N[n][n];
     694  if (T2 == N)
     695  {
     696    for (i = 1; i <= n; i++)
     697    {
     698      if (m <  T[n+1,i]) { m = T[n+1,i];}
     699    }
     700    return(m);
     701  }
     702
     703  //first part: the diagonals
     704  for (i = s; i <= n; i++)
     705  {
     706    if (T[i,i] > 0)
     707    {
     708      if ((T[i,i] >= 1) && (T[n+1,i] > 0)) {return(-1);}
     709      if ((T[i,i] == 1) && (T[n+1,i] == 0))
     710      {
     711        T[i,i] = 0;
     712        T[n+1,i] = 1;
     713        return(growthAlg(T));
     714      }
     715    }
     716  }
     717
     718  //second part: searching for the last but one vertices
     719  T2 = T2*T2;
     720  for (i = s; i <= n; i++)
     721  {
     722    if ((intvec(T[i,1..n]) <> intvec(0)) && (intvec(T2[i,1..n]) == intvec(0)))
     723    {
     724      for (j = 1; j <= n; j++)
     725      {
     726        if ((T[i,j] > 0) && (m < T[n+1,j])) {m = T[n+1,j];}
     727      }
     728      T[n+1,i] = T[n+1,i] + m;
     729      T[i,1..n] = NV;
     730      return(growthAlg(T));
     731    }
     732  }
     733  m = 0;
     734
     735  //third part: searching for circles
     736  for (i = s; i <= n; i++)
     737  {
     738    T2 = T[1..n,1..n];
     739    C = findCycleDFS(i,T2, intvec(i));
     740    if (C[1] > 0)
     741    {
     742      for (j = 2; j <= size(C); j++)
     743      {
     744        T[i,1..n] = T[i,1..n] + T[C[j],1..n];
     745        T[C[j],1..n] = NV;
     746      }
     747      for (j = 2; j <= size(C); j++)
     748      {
     749        T[1..n,i] = T[1..n,i] + T[1..n,C[j]];
     750        T[1..n,C[j]] = NV;
     751      }
     752      T[i,i] = T[i,i] - size(C) + 1;
     753      m = 0;
     754      for (j = 1; j <= size(C); j++)
     755      {
     756        m = m + T[n+1,C[j]];
     757      }
     758      for (j = 1; j <= size(C); j++)
     759      {
     760        T[n+1,C[j]] = m;
     761      }
     762      return(growthAlg(T,i));
     763    }
     764    else {ERROR("No Cycle found, something seems wrong! Please contact the authors.");}
     765  }
     766
     767  m = 0;
    696768  for (i = 1; i <= n; i++)
    697769  {
    698    if (m <  T[n+1,i]) { m = T[n+1,i];}
     770    if (m < T[n+1,i])
     771    {
     772      m = T[n+1,i];
     773    }
    699774  }
    700775  return(m);
    701  }
    702 
    703 //first part: the diagonals
    704  for (i = s; i <= n; i++)
    705  {
    706   if (T[i,i] > 0)
     776}
     777
     778static proc GlDimSuffix(intvec v, intvec g)
     779{
     780  //Computes the shortest r such that g is a suffix for vr
     781  //only valid for lex orderings?
     782  intvec r,gt,vt,lt,g2;
     783  int lg,lv,l,i,c,f;
     784  lg = size(g); lv = size(v);
     785  if (lg <= lv)
    707786  {
    708    if ((T[i,i] >= 1) && (T[n+1,i] > 0)) {return(-1);}
    709    if ((T[i,i] == 1) && (T[n+1,i] == 0))
    710    {
    711     T[i,i] = 0;
    712     T[n+1,i] = 1;
    713     return(growthAlg(T));
    714    }
    715   }
    716  }
    717 
    718 //second part: searching for the last but one vertices
    719  T2 = T2*T2;
    720  for (i = s; i <= n; i++)
    721  {
    722    if ((intvec(T[i,1..n]) <> intvec(0)) && (intvec(T2[i,1..n]) == intvec(0)))
    723    {
    724     for (j = 1; j <= n; j++)
    725     {
    726      if ((T[i,j] > 0) && (m < T[n+1,j])) {m = T[n+1,j];}
    727     }
    728     T[n+1,i] = T[n+1,i] + m;
    729     T[i,1..n] = NV;
    730     return(growthAlg(T));
    731    }
    732  }
    733  m = 0;
    734 
    735 //third part: searching for circles
    736  for (i = s; i <= n; i++)
    737  {
    738   T2 = T[1..n,1..n];
    739   C = findCycleDFS(i,T2, intvec(i));
    740   if (C[1] > 0)
     787    l = lv-lg;
     788  }
     789  else
    741790  {
    742    for (j = 2; j <= size(C); j++)
    743    {
    744     T[i,1..n] = T[i,1..n] + T[C[j],1..n];
    745     T[C[j],1..n] = NV;
    746    }
    747    for (j = 2; j <= size(C); j++)
    748    {
    749     T[1..n,i] = T[1..n,i] + T[1..n,C[j]];
    750     T[1..n,C[j]] = NV;
    751    }
    752    T[i,i] = T[i,i] - size(C) + 1;
    753    m = 0;
    754    for (j = 1; j <= size(C); j++)
    755    {
    756     m = m + T[n+1,C[j]];
    757    }
    758    for (j = 1; j <= size(C); j++)
    759    {
    760     T[n+1,C[j]] = m;
    761    }
    762     return(growthAlg(T,i));
    763   }
    764   else {ERROR("No Cycle found, something seems wrong! Please contact the authors.");}
    765  }
    766 
    767  m = 0;
    768  for (i = 1; i <= n; i++)
    769  {
    770         if (m < T[n+1,i])
    771         {
    772                 m = T[n+1,i];
    773         }
    774  }
    775  return(m);
    776 }
    777 
    778 static proc GlDimSuffix(intvec v, intvec g)
    779 {
    780 //Computes the shortest r such that g is a suffix for vr
    781 //only valid for lex orderings?
    782  intvec r,gt,vt,lt,g2;
    783  int lg,lv,l,i,c,f;
    784  lg = size(g); lv = size(v);
    785  if (lg <= lv)
    786  {
    787         l = lv-lg;
    788  }
    789  else
    790  {
    791         l = 0; g2 = g[(lv+1)..lg];
    792         g = g[1..lv]; lg = size(g);
    793         c = 1;
    794  }
    795  while (l < lv)
     791    l = 0; g2 = g[(lv+1)..lg];
     792    g = g[1..lv]; lg = size(g);
     793    c = 1;
     794  }
     795  while (l < lv)
    796796  {
    797         vt = v[(l+1)..lv];
     797    vt = v[(l+1)..lv];
    798798    gt = g[1..(lv-l)];
    799799    lt = size(gt);
    800800    for (i = 1; i <= lt; i++)
    801801    {
    802                 if (vt[i]<>gt[i]) {l++; break;}
    803         }
     802      if (vt[i]<>gt[i]) {l++; break;}
     803    }
    804804    if (lt <=i ) { f = 1; break;}
    805805  }
    806  if (f == 0) {return(g);}
    807  r = g[(lv-l+1)..lg];
    808  if (c == 1) {r = r,g2;}
    809  return(r);
     806  if (f == 0) {return(g);}
     807  r = g[(lv-l+1)..lg];
     808  if (c == 1) {r = r,g2;}
     809  return(r);
    810810}
    811811
    812812static proc isNormal(intvec V, list G)
    813813{
    814  int i,j,k,l;
    815  k = 0;
    816  for (i = 1; i <= size(G); i++)
    817  {
    818   if ( size(G[i]) <= size(V) )
    819    {
    820     while ( size(G[i])+k <= size(V) )
     814  int i,j,k,l;
     815  k = 0;
     816  for (i = 1; i <= size(G); i++)
     817  {
     818    if ( size(G[i]) <= size(V) )
    821819    {
    822                 if ( G[i] == V[(1+k)..size(V)] ) {return(1);}
    823         }
    824    }
    825  }
    826  return(0);
     820      while ( size(G[i])+k <= size(V) )
     821      {
     822        if ( G[i] == V[(1+k)..size(V)] ) {return(1);}
     823      }
     824    }
     825  }
     826  return(0);
    827827}
    828828
    829829static proc findDChain(list L)
    830830{
    831  list Li; int i,j;
    832  for (i = 1; i <= size(L); i++) {Li[i] = size(L[i]);}
    833  Li = sort(Li); Li = Li[1];
    834  return(Li[size(Li)]);
     831  list Li; int i,j;
     832  for (i = 1; i <= size(L); i++) {Li[i] = size(L[i]);}
     833  Li = sort(Li); Li = Li[1];
     834  return(Li[size(Li)]);
    835835}
    836836
     
    879879"
    880880{
    881  int n = size(P);
    882  if (n <= 0) {return(1);}
    883  if (size(I) < n) {return(0);}
    884  intvec IP = I[1..n];
    885  if (IP == P) {return(1);}
    886  else {return(0);}
     881  int n = size(P);
     882  if (n <= 0) {return(1);}
     883  if (size(I) < n) {return(0);}
     884  intvec IP = I[1..n];
     885  if (IP == P) {return(1);}
     886  else {return(0);}
    887887}
    888888
     
    893893"
    894894{
    895  int n = size(S);
    896  if (n <= 0) {return(1);}
    897  int m = size(I);
    898  if (m < n) {return(0);}
    899  intvec IS = I[(m-n+1)..m];
    900  if (IS == S) {return(1);}
    901  else {return(0);}
     895  int n = size(S);
     896  if (n <= 0) {return(1);}
     897  int m = size(I);
     898  if (m < n) {return(0);}
     899  intvec IS = I[(m-n+1)..m];
     900  if (IS == S) {return(1);}
     901  else {return(0);}
    902902}
    903903
     
    908908"
    909909{
    910  int n = size(IF);
    911  int m = size(I);
    912 
    913  if (n <= 0) {
    914    return(1);
    915  }
    916  if (m < n) {
    917    return(0);
    918  }
    919 
    920  for (int i = 0; (n + i) <= m; i++){
    921    intvec IIF = I[(1 + i)..(n + i)];
    922    if (IIF == IF) {
    923      return(1);
    924    }
    925  }
    926  return(0);
     910  int n = size(IF);
     911  int m = size(I);
     912
     913  if (n <= 0) {
     914    return(1);
     915  }
     916  if (m < n) {
     917    return(0);
     918  }
     919
     920  for (int i = 0; (n + i) <= m; i++){
     921    intvec IIF = I[(1 + i)..(n + i)];
     922    if (IIF == IF) {
     923      return(1);
     924    }
     925  }
     926  return(0);
    927927}
    928928
     
    10551055EXAMPLE: example lpId2ivLi; shows examples
    10561056"
    1057 {int i,j,k;
    1058   list M;
    1059   checkAssumptions(0,M);
    1060   for (i = 1; i <= size(G); i++) {M[i] = lp2iv(G[i]);}
    1061   return(M);
    1062 }
    1063 example
    1064 {
    1065   "EXAMPLE:"; echo = 2;
    1066   ring r = 0,(x,y),dp;
    1067   def R = makeLetterplaceRing(5); // constructs a Letterplace ring
    1068   setring R; // sets basering to Letterplace ring
    1069   ideal L = x(1)*x(2),y(1)*y(2),x(1)*y(2)*x(3);
    1070   lpId2ivLi(L); // returns the corresponding intvecs as a list
    1071 }
    1072 
    1073 proc lp2iv(poly p)
     1057nt i,j,k;
     1058list M;
     1059checkAssumptions(0,M);
     1060for (i = 1; i <= size(G); i++) {M[i] = lp2iv(G[i]);}
     1061return(M);
     1062
     1063ample
     1064
     1065"EXAMPLE:"; echo = 2;
     1066ring r = 0,(x,y),dp;
     1067def R = makeLetterplaceRing(5); // constructs a Letterplace ring
     1068setring R; // sets basering to Letterplace ring
     1069ideal L = x(1)*x(2),y(1)*y(2),x(1)*y(2)*x(3);
     1070lpId2ivLi(L); // returns the corresponding intvecs as a list
     1071
     1072
     1073oc lp2iv(poly p)
    10741074"USAGE: lp2iv(p); p a poly
    10751075RETURN: intvec
     
    13161316static proc imPermcol (intmat A, int c1, int c2)
    13171317{
    1318    intmat B = A;
    1319    int k = nrows(B);
    1320    B[1..k,c1] = A[1..k,c2];
    1321    B[1..k,c2] = A[1..k,c1];
    1322    return (B);
     1318  intmat B = A;
     1319  int k = nrows(B);
     1320  B[1..k,c1] = A[1..k,c2];
     1321  B[1..k,c2] = A[1..k,c1];
     1322  return (B);
    13231323}
    13241324
    13251325static proc imPermrow (intmat A, int r1, int r2)
    13261326{
    1327    intmat B = A;
    1328    int k = ncols(B);
    1329    B[r1,1..k] = A[r2,1..k];
    1330    B[r2,1..k] = A[r1,1..k];
    1331    return (B);
     1327  intmat B = A;
     1328  int k = ncols(B);
     1329  B[r1,1..k] = A[r2,1..k];
     1330  B[r2,1..k] = A[r1,1..k];
     1331  return (B);
    13321332}
    13331333
     
    14431443@*      the adjacency matrix of the Ufnarovskij graph induced by G
    14441444ASSUME: - basering is a Letterplace ring
    1445         - G are the leading monomials of a Groebner basis
     1445- G are the leading monomials of a Groebner basis
    14461446"
    14471447{
     
    14791479    if (typeof(#[1]) == "int") {
    14801480      if (#[1] == 1) {
    1481         list ret = UG;
    1482         ret[2] = ivL2lpI(SW); // the vertices
    1483         return (ret);
     1481        list ret = UG;
     1482        ret[2] = ivL2lpI(SW); // the vertices
     1483        return (ret);
    14841484      }
    14851485    }
     
    15261526@*:      the adjacency matrix of the graph of normal words induced by G
    15271527ASSUME: - basering is a Letterplace ring
    1528         - G are the leading monomials of a Groebner basis
     1528- G are the leading monomials of a Groebner basis
    15291529"
    15301530{
     
    15381538  for (i = 1; i <= size(LG); i++)
    15391539  {
    1540    E = leadexp(LG[i]);
    1541    if (E == intvec(0)) {V = V,monomial(intvec(0));}
    1542    else
    1543    {
    1544     for (j = 1; j < d; j++)
     1540    E = leadexp(LG[i]);
     1541    if (E == intvec(0)) {V = V,monomial(intvec(0));}
     1542    else
    15451543    {
    1546      Et = E[(j*v+1)..(d*v)];
    1547      if (Et == intvec(0)) {break;}
    1548      else {V = V, monomial(Et);}
    1549     }
    1550    }
     1544      for (j = 1; j < d; j++)
     1545      {
     1546        Et = E[(j*v+1)..(d*v)];
     1547        if (Et == intvec(0)) {break;}
     1548        else {V = V, monomial(Et);}
     1549      }
     1550    }
    15511551  }
    15521552  V = simplify(V,2+4);
    1553             printf("V = %p", V);
    1554  
    1555  
     1553  printf("V = %p", V);
     1554
     1555
    15561556  // construct incidence matrix
    1557  
     1557
    15581558  list LV = lpId2ivLi(V);
    15591559  intvec Ip,Iw;
     
    15621562  for (i = 1; i <= n; i++)
    15631563  {
    1564        // printf("for1 (i=%p, n=%p)", i, n);
    1565    p = V[i]; Ip = lp2iv(p);
    1566    for (j = 1; j <= n; j++)
    1567    {
    1568        // printf("for2 (j=%p, n=%p)", j, n);
    1569     k = 1; b = 1;
    1570     q = V[j];
    1571     w = lpNF(lpMult(p,q),LG);
    1572     if (w <> 0)
     1564    // printf("for1 (i=%p, n=%p)", i, n);
     1565    p = V[i]; Ip = lp2iv(p);
     1566    for (j = 1; j <= n; j++)
    15731567    {
    1574      Iw = lp2iv(w);
    1575      while (k <= n)
    1576      {
    1577        // printf("while (k=%p, n=%p)", k, n);
    1578       if (isPF(LV[k],Iw) > 0)
    1579        {if (isPF(LV[k],Ip) == 0) {b = 0; k = n+1;} else {k++;}
    1580        }
    1581        else {k++;}
    1582      }
    1583      T[i,j] = b;
    1584        //  print("Incidence Matrix:");
    1585        // print(T);
    1586     }
    1587    }
     1568      // printf("for2 (j=%p, n=%p)", j, n);
     1569      k = 1; b = 1;
     1570      q = V[j];
     1571      w = lpNF(lpMult(p,q),LG);
     1572      if (w <> 0)
     1573      {
     1574        Iw = lp2iv(w);
     1575        while (k <= n)
     1576        {
     1577          // printf("while (k=%p, n=%p)", k, n);
     1578          if (isPF(LV[k],Iw) > 0)
     1579          {if (isPF(LV[k],Ip) == 0) {b = 0; k = n+1;} else {k++;}
     1580          }
     1581          else {k++;}
     1582        }
     1583        T[i,j] = b;
     1584        //  print("Incidence Matrix:");
     1585        // print(T);
     1586      }
     1587    }
    15881588  }
    15891589  return(T);
     
    15961596@*:     -1 means it is infinite
    15971597ASSUME: - basering is a Letterplace ring
    1598         - G is a Groebner basis
     1598- G is a Groebner basis
    15991599"
    16001600{
     
    16121612@*      -2 means it is negative infinite
    16131613ASSUME: - basering is a Letterplace ring
    1614         - G is a Groebner basis
     1614- G is a Groebner basis
    16151615"
    16161616{
     
    16771677    while (size(G1) > 0) {
    16781678      if (attrib(R, "lV") > 1) {
    1679         ring R = lpDelVar(lp2iv(G1[1])[1]);
    1680         ideal G1 = imap(save,G1);
    1681         G1 = simplify(G1, 2); // remove zero generators
     1679        ring R = lpDelVar(lp2iv(G1[1])[1]);
     1680        ideal G1 = imap(save,G1);
     1681        G1 = simplify(G1, 2); // remove zero generators
    16821682      } else {
    1683         // only the field is left (no variables)
    1684         return(0);
     1683        // only the field is left (no variables)
     1684        return(0);
    16851685      }
    16861686    }
     
    16941694    } else {
    16951695      if (i == size(G)) { // if last iteration
    1696         print("Using gk dim"); // DEBUG
    1697         int gkDim = lpGkDim(G);
    1698         if (gkDim >= 0) {
    1699           return (gkDim);
    1700         }
     1696        print("Using gk dim"); // DEBUG
     1697        int gkDim = lpGkDim(G);
     1698        if (gkDim >= 0) {
     1699          return (gkDim);
     1700        }
    17011701      }
    17021702    }
     
    17391739  int n = ncols(A);
    17401740  for (int i = 1; i < n; i++) {
    1741       if (A[i,i] == 1) {
    1742         return (1);
    1743       }
     1741    if (A[i,i] == 1) {
     1742      return (1);
     1743    }
    17441744  }
    17451745  return (0);
     
    17811781        GNC[i,j] = 1;
    17821782      } else {
    1783         // Li p. 177
     1783        // Li p. 177
    17841784        // search for a right divisor 'w' of uv in G
    17851785        // then check if G doesn't divide the subword uv-1
    17861786
    1787         // look for a right divisor in LG
     1787        // look for a right divisor in LG
    17881788        for (int k = 1; k <= size(LG); k++) {
    1789           if (isSF(LG[k], uv)) {
    1790             // w = LG[k]
    1791             if(!ivdivides(LG, uv[1..(size(uv)-1)])) {
    1792               // G doesn't divide uv-1
    1793               GNC[i,j] = 1;
    1794               break;
    1795             }
    1796           }
    1797         }
     1789          if (isSF(LG[k], uv)) {
     1790            // w = LG[k]
     1791            if(!ivdivides(LG, uv[1..(size(uv)-1)])) {
     1792              // G doesn't divide uv-1
     1793              GNC[i,j] = 1;
     1794              break;
     1795            }
     1796          }
     1797        }
    17981798      }
    17991799    }
     
    21472147"
    21482148{
    2149 //checkAssumptions(0,M);
     2149  //checkAssumptions(0,M);
    21502150  intvec L,A;
    21512151  if (size(M) == 0){ERROR("There are no mistletoes, so it appears your dimension is infinite!");}
     
    21582158  for (i = 2; i <= size(M); i++)
    21592159  {A = M[i]; L = M[i-1];
    2160    s = size(A);
    2161    if (s > size(L))
    2162    {d = size(L);
    2163     for (j = s; j > d; j--) {Rt = insert(Rt,intvec(A[1..j]));}
    2164     A = A[1..d];
    2165    }
    2166    if (size(L) > s){L = L[1..s];}
    2167    while (A <> L)
    2168    {Rt = insert(Rt, intvec(A));
    2169     if (size(A) > 1)
    2170     {A = A[1..(size(A)-1)];
    2171      L = L[1..(size(L)-1)];
    2172     }
    2173     else {break;}
    2174    }
     2160    s = size(A);
     2161    if (s > size(L))
     2162    {d = size(L);
     2163      for (j = s; j > d; j--) {Rt = insert(Rt,intvec(A[1..j]));}
     2164      A = A[1..d];
     2165    }
     2166    if (size(L) > s){L = L[1..s];}
     2167    while (A <> L)
     2168    {Rt = insert(Rt, intvec(A));
     2169      if (size(A) > 1)
     2170      {A = A[1..(size(A)-1)];
     2171        L = L[1..(size(L)-1)];
     2172      }
     2173      else {break;}
     2174    }
    21752175  }
    21762176  return(Rt);
     
    22312231PURPOSE:Orders a given set of mistletoes lexicographically
    22322232ASSUME: - basering is a Letterplace ring.
    2233        - intvecs correspond to monomials
     2233- intvecs correspond to monomials
    22342234NOTE:   - This is preprocessing, it's not needed if the mistletoes are returned
    22352235@*        from the sickle algorithm.
     
    29462946/* vl: new stuff for conversion to Magma and to SD
    29472947todo: doc, example
    2948 */
     2948 */
    29492949proc extractVars(r)
    29502950{
     
    29552955  for (i = 1; i<=nvars(r);i++)
    29562956  {
    2957         candidate = string(var(i))[1,find(string(var(i)),"(")-1];
    2958         if (!inList(result, candidate))
    2959         {
    2960           result = insert(result,candidate,size(result));
    2961         }
     2957    candidate = string(var(i))[1,find(string(var(i)),"(")-1];
     2958    if (!inList(result, candidate))
     2959    {
     2960      result = insert(result,candidate,size(result));
     2961    }
    29622962  }
    29632963  return(result);
     
    29772977    if (size(s)!=pos)
    29782978    {
    2979         s = s[1,pos-1]+s[pos+1,size(s)-pos]; // The last (")")
     2979      s = s[1,pos-1]+s[pos+1,size(s)-pos]; // The last (")")
    29802980    }
    29812981    else
    29822982    {
    2983                 s = s[1,pos-1];
    2984         }
     2983      s = s[1,pos-1];
     2984    }
    29852985  }
    29862986  return(s);
     
    30463046
    30473047/*proc lpSubstituteExpandRing(poly f, list s1, list s2) {*/
    3048   /*int minDegBound = calcSubstDegBound(f,s1,s2);*/
     3048/*int minDegBound = calcSubstDegBound(f,s1,s2);*/
    30493049/**/
    3050   /*def R = basering; // curr lp ring*/
    3051   /*setring ORIGINALRING; // non lp ring TODO*/
    3052   /*def R1 = makeLetterplaceRing(minDegBound);*/
    3053   /*setring R1;*/
     3050/*def R = basering; // curr lp ring*/
     3051/*setring ORIGINALRING; // non lp ring TODO*/
     3052/*def R1 = makeLetterplaceRing(minDegBound);*/
     3053/*setring R1;*/
    30543054/**/
    3055   /*poly g = lpSubstitute(imap(R,f), imap(R,s1), imap(R,s2));*/
     3055/*poly g = lpSubstitute(imap(R,f), imap(R,s1), imap(R,s2));*/
    30563056/**/
    3057   /*return (R1); // return the new ring*/
     3057/*return (R1); // return the new ring*/
    30583058/*}*/
    30593059
     
    30663066@*      - G is a groebner basis,
    30673067@*      - the current ring has a sufficient degbound (can be calculated with
    3068 @*        calcSubstDegBound())
     3068    @*    calcSubstDegBound())
    30693069EXAMPLE: example lpSubstitute; shows examples
    30703070"
     
    30853085      int subindex = indexof(s1, varindex);
    30863086      if (subindex > 0) {
    3087         s2[subindex] = lpNF(s2[subindex],G);
    3088         fis = lpMult(fis, s2[subindex]);
     3087        s2[subindex] = lpNF(s2[subindex],G);
     3088        fis = lpMult(fis, s2[subindex]);
    30893089      } else {
    3090         fis = lpMult(fis, lpNF(iv2lp(varindex),G));
     3090        fis = lpMult(fis, lpNF(iv2lp(varindex),G));
    30913091      }
    30923092      /*fis = lpNF(fis,G);*/
     
    31693169      int subindex = indexof(s1, varindex);
    31703170      if (subindex > 0) {
    3171         tmpDegBound = tmpDegBound + deg(s2[subindex]);
     3171        tmpDegBound = tmpDegBound + deg(s2[subindex]);
    31723172      } else {
    3173         tmpDegBound = tmpDegBound + 1;
     3173        tmpDegBound = tmpDegBound + 1;
    31743174      }
    31753175    }
     
    32073207
    32083208/*
    3209   Here are some examples one may try. Just copy them into your console.
    3210   These are relations for braid groups, up to degree d:
    3211 
    3212 
    3213   LIB "fpadim.lib";
    3214   ring r = 0,(x,y,z),dp;
    3215   int d =10; // degree
    3216   def R = makeLetterplaceRing(d);
    3217   setring R;
    3218   ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*x(3) - z(1)*x(2)*y(3),
    3219   z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) + y(1)*y(2)*y(3) +
    3220   z(1)*z(2)*z(3) + x(1)*y(2)*z(3);
    3221   option(prot);
    3222   option(redSB);option(redTail);option(mem);
    3223   ideal J = system("freegb",I,d,3);
    3224   lpDimCheck(J);
    3225   sickle(J,1,1,1,d);//Computes mistletoes, K-dimension and the Hilbert series
    3226 
    3227 
    3228 
    3229   LIB "fpadim.lib";
    3230   ring r = 0,(x,y,z),dp;
    3231   int d =11; // degree
    3232   def R = makeLetterplaceRing(d);
    3233   setring R;
    3234   ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*z(3) - z(1)*x(2)*y(3),
    3235   z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) + y(1)*y(2)*y(3) +
    3236   z(1)*z(2)*z(3) + x(1)*y(2)*z(3);
    3237   option(prot);
    3238   option(redSB);option(redTail);option(mem);
    3239   ideal J = system("freegb",I,d,3);
    3240   lpDimCheck(J);
    3241   sickle(J,1,1,1,d);
    3242 
    3243 
    3244 
    3245   LIB "fpadim.lib";
    3246   ring r = 0,(x,y,z),dp;
    3247   int d  = 6; // degree
    3248   def R  = makeLetterplaceRing(d);
    3249   setring R;
    3250   ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*x(3) - z(1)*x(2)*y(3),
    3251   z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) -2*y(1)*y(2)*y(3) + 3*z(1)*z(2)*z(3) -4*x(1)*y(2)*z(3) + 5*x(1)*z(2)*z(3)- 6*x(1)*y(2)*y(3) +7*x(1)*x(2)*z(3) - 8*x(1)*x(2)*y(3);
    3252   option(prot);
    3253   option(redSB);option(redTail);option(mem);
    3254   ideal J = system("freegb",I,d,3);
    3255   lpDimCheck(J);
    3256   sickle(J,1,1,1,d);
    3257 */
     3209   Here are some examples one may try. Just copy them into your console.
     3210   These are relations for braid groups, up to degree d:
     3211
     3212
     3213   LIB "fpadim.lib";
     3214   ring r = 0,(x,y,z),dp;
     3215   int d =10; // degree
     3216   def R = makeLetterplaceRing(d);
     3217   setring R;
     3218   ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*x(3) - z(1)*x(2)*y(3),
     3219   z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) + y(1)*y(2)*y(3) +
     3220   z(1)*z(2)*z(3) + x(1)*y(2)*z(3);
     3221   option(prot);
     3222   option(redSB);option(redTail);option(mem);
     3223   ideal J = system("freegb",I,d,3);
     3224   lpDimCheck(J);
     3225   sickle(J,1,1,1,d);//Computes mistletoes, K-dimension and the Hilbert series
     3226
     3227
     3228
     3229   LIB "fpadim.lib";
     3230   ring r = 0,(x,y,z),dp;
     3231   int d =11; // degree
     3232   def R = makeLetterplaceRing(d);
     3233   setring R;
     3234   ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*z(3) - z(1)*x(2)*y(3),
     3235   z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) + y(1)*y(2)*y(3) +
     3236   z(1)*z(2)*z(3) + x(1)*y(2)*z(3);
     3237   option(prot);
     3238   option(redSB);option(redTail);option(mem);
     3239   ideal J = system("freegb",I,d,3);
     3240   lpDimCheck(J);
     3241   sickle(J,1,1,1,d);
     3242
     3243
     3244
     3245   LIB "fpadim.lib";
     3246   ring r = 0,(x,y,z),dp;
     3247   int d  = 6; // degree
     3248   def R  = makeLetterplaceRing(d);
     3249   setring R;
     3250   ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*x(3) - z(1)*x(2)*y(3),
     3251   z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) -2*y(1)*y(2)*y(3) + 3*z(1)*z(2)*z(3) -4*x(1)*y(2)*z(3) + 5*x(1)*z(2)*z(3)- 6*x(1)*y(2)*y(3) +7*x(1)*x(2)*z(3) - 8*x(1)*x(2)*y(3);
     3252   option(prot);
     3253   option(redSB);option(redTail);option(mem);
     3254   ideal J = system("freegb",I,d,3);
     3255   lpDimCheck(J);
     3256   sickle(J,1,1,1,d);
     3257 */
    32583258
    32593259/*
    3260   Here are some examples, which can also be found in [studzins]:
    3261 
    3262   // takes up to 880Mb of memory
    3263   LIB "fpadim.lib";
    3264   ring r = 0,(x,y,z),dp;
    3265   int d =10; // degree
    3266   def R = makeLetterplaceRing(d);
    3267   setring R;
    3268   ideal I =
    3269   z(1)*z(2)*z(3)*z(4) + y(1)*x(2)*y(3)*x(4) - x(1)*y(2)*y(3)*x(4) - 3*z(1)*y(2)*x(3)*z(4), x(1)*x(2)*x(3) + y(1)*x(2)*y(3) - x(1)*y(2)*x(3), z(1)*y(2)*x(3)-x(1)*y(2)*z(3) + z(1)*x(2)*z(3);
    3270   option(prot);
    3271   option(redSB);option(redTail);option(mem);
    3272   ideal J = system("freegb",I,d,nvars(r));
    3273   lpDimCheck(J);
    3274   sickle(J,1,1,1,d); // dimension is 24872
    3275 
    3276 
    3277   LIB "fpadim.lib";
    3278   ring r = 0,(x,y,z),dp;
    3279   int d =10; // degree
    3280   def R = makeLetterplaceRing(d);
    3281   setring R;
    3282   ideal I = x(1)*y(2) + y(1)*z(2), x(1)*x(2) + x(1)*y(2) - y(1)*x(2) - y(1)*y(2);
    3283   option(prot);
    3284   option(redSB);option(redTail);option(mem);
    3285   ideal J = system("freegb",I,d,3);
    3286   lpDimCheck(J);
    3287   sickle(J,1,1,1,d);
    3288 */
     3260   Here are some examples, which can also be found in [studzins]:
     3261
     3262// takes up to 880Mb of memory
     3263LIB "fpadim.lib";
     3264ring r = 0,(x,y,z),dp;
     3265int d =10; // degree
     3266def R = makeLetterplaceRing(d);
     3267setring R;
     3268ideal I =
     3269z(1)*z(2)*z(3)*z(4) + y(1)*x(2)*y(3)*x(4) - x(1)*y(2)*y(3)*x(4) - 3*z(1)*y(2)*x(3)*z(4), x(1)*x(2)*x(3) + y(1)*x(2)*y(3) - x(1)*y(2)*x(3), z(1)*y(2)*x(3)-x(1)*y(2)*z(3) + z(1)*x(2)*z(3);
     3270option(prot);
     3271option(redSB);option(redTail);option(mem);
     3272ideal J = system("freegb",I,d,nvars(r));
     3273lpDimCheck(J);
     3274sickle(J,1,1,1,d); // dimension is 24872
     3275
     3276
     3277LIB "fpadim.lib";
     3278ring r = 0,(x,y,z),dp;
     3279int d =10; // degree
     3280def R = makeLetterplaceRing(d);
     3281setring R;
     3282ideal I = x(1)*y(2) + y(1)*z(2), x(1)*x(2) + x(1)*y(2) - y(1)*x(2) - y(1)*y(2);
     3283option(prot);
     3284option(redSB);option(redTail);option(mem);
     3285ideal J = system("freegb",I,d,3);
     3286lpDimCheck(J);
     3287sickle(J,1,1,1,d);
     3288 */
    32893289
    32903290
    32913291/*
    3292 Example for computing GK dimension:
    3293 returns a ring which contains an ideal I
    3294 run gkDim(I) inside this ring and it should return 2n (the GK dimension
    3295 of n-th Weyl algebra including evaluation operators).
    3296 
    3297 proc createWeylEx(int n, int d)
    3298 "
    3299 "
    3300 {
    3301   int baseringdef;
    3302  if (defined(basering)) // if a basering is defined, it should be saved for later use
    3303  {
    3304   def save = basering;
    3305   baseringdef = 1;
    3306  }
    3307  ring r = 0,(d(1..n),x(1..n),e(1..n)),dp;
    3308  def R = makeLetterplaceRing(d);
    3309  setring R;
    3310  ideal I; int i,j;
    3311 
    3312  for (i = 1; i <= n; i++)
    3313  {
    3314   for (j = i+1; j<= n; j++)
     3292   Example for computing GK dimension:
     3293   returns a ring which contains an ideal I
     3294   run gkDim(I) inside this ring and it should return 2n (the GK dimension
     3295   of n-th Weyl algebra including evaluation operators).
     3296
     3297   proc createWeylEx(int n, int d)
     3298   "
     3299   "
     3300   {
     3301   int baseringdef;
     3302   if (defined(basering)) // if a basering is defined, it should be saved for later use
     3303   {
     3304   def save = basering;
     3305   baseringdef = 1;
     3306   }
     3307   ring r = 0,(d(1..n),x(1..n),e(1..n)),dp;
     3308   def R = makeLetterplaceRing(d);
     3309   setring R;
     3310   ideal I; int i,j;
     3311
     3312   for (i = 1; i <= n; i++)
     3313   {
     3314   for (j = i+1; j<= n; j++)
     3315   {
     3316   I[size(I)+1] = lpMult(var(i),var(j));
     3317   }
     3318   }
     3319
     3320   for (i = 1; i <= n; i++)
     3321   {
     3322   for (j = i+1; j<= n; j++)
     3323   {
     3324   I[size(I)+1] = lpMult(var(n+i),var(n+j));
     3325   }
     3326   }
     3327   for (i = 1; i <= n; i++)
     3328   {
     3329   for (j = 1; j<= n; j++)
     3330   {
     3331   I[size(I)+1] = lpMult(var(i),var(n+j));
     3332   }
     3333   }
     3334   for (i = 1; i <= n; i++)
     3335   {
     3336   for (j = 1; j<= n; j++)
     3337   {
     3338   I[size(I)+1] = lpMult(var(i),var(2*n+j));
     3339   }
     3340   }
     3341   for (i = 1; i <= n; i++)
     3342   {
     3343   for (j = 1; j<= n; j++)
     3344   {
     3345   I[size(I)+1] = lpMult(var(2*n+i),var(n+j));
     3346   }
     3347   }
     3348   for (i = 1; i <= n; i++)
     3349   {
     3350   for (j = 1; j<= n; j++)
     3351   {
     3352   I[size(I)+1] = lpMult(var(2*n+i),var(2*n+j));
     3353   }
     3354   }
     3355   I = simplify(I,2+4);
     3356   I = letplaceGBasis(I);
     3357   export(I);
     3358   if (baseringdef == 1) {setring save;}
     3359   return(R);
     3360   }
     3361
     3362proc TestGKAuslander3()
     3363{
     3364  ring r = (0,q),(z,x,y),(dp(1),dp(2));
     3365  def R = makeLetterplaceRing(5); // constructs a Letterplace ring
     3366  R; setring R; // sets basering to Letterplace ring
     3367  ideal I;
     3368  I = q*x(1)*y(2) - y(1)*x(2), z(1)*y(2) - y(1)*z(2), z(1)*x(2) - x(1)*z(2);
     3369  I = letplaceGBasis(I);
     3370  lpGkDim(I); // must be 3
     3371  I = x(1)*y(2)*z(3) - y(1)*x(2), z(1)*y(2) - y(1)*z(2), z(1)*x(2) - x(1)*z(2);//gkDim = 2
     3372  I = letplaceGBasis(I); // not finite BUT contains a poly in x,y only
     3373  lpGkDim(I); // must be 4
     3374
     3375  ring r = 0,(y,x,z),dp;
     3376  def R = makeLetterplaceRing(10); // constructs a Letterplace ring
     3377  R; setring R; // sets basering to Letterplace ring
     3378  ideal I;
     3379  I = x(1)*y(2)*z(3) - y(1)*x(2), z(1)*y(2) - y(1)*z(2), z(1)*x(2) - x(1)*z(2);//gkDim = 2
     3380  I = letplaceGBasis(I); // computed as it would be homogenized; infinite
     3381  poly p = x(1)*y(2)*y(3)*x(4)-y(1)*x(2)*x(3)*y(4);
     3382  lpNF(p, I); // 0 as expected
     3383
     3384  // with inverse of z
     3385  ring r = 0,(iz,z,x,y),dp;
     3386  def R = makeLetterplaceRing(11); // constructs a Letterplace ring
     3387  R; setring R; // sets basering to Letterplace ring
     3388  ideal I;
     3389  I = x(1)*y(2)*z(3) - y(1)*x(2), z(1)*y(2) - y(1)*z(2), z(1)*x(2) - x(1)*z(2),
     3390    iz(1)*y(2) - y(1)*iz(2), iz(1)*x(2) - x(1)*iz(2), iz(1)*z(2)-1, z(1)*iz(2) -1;
     3391  I = letplaceGBasis(I); //
     3392  setring r;
     3393  def R2 = makeLetterplaceRing(23); // constructs a Letterplace ring
     3394  setring R2; // sets basering to Letterplace ring
     3395  ideal I = imap(R,I);
     3396  lpGkDim(I);
     3397
     3398
     3399  ring r = 0,(t,z,x,y),(dp(2),dp(2));
     3400  def R = makeLetterplaceRing(20); // constructs a Letterplace ring
     3401  R; setring R; // sets basering to Letterplace ring
     3402  ideal I;
     3403  I = x(1)*y(2)*z(3) - y(1)*x(2)*t(3), z(1)*y(2) - y(1)*z(2), z(1)*x(2) - x(1)*z(2),
     3404    t(1)*y(2) - y(1)*t(2), t(1)*x(2) - x(1)*t(2), t(1)*z(2) - z(1)*t(2);//gkDim = 2
     3405  I = letplaceGBasis(I); // computed as it would be homogenized; infinite
     3406  LIB "elim.lib";
     3407  ideal Inoz = nselect(I,intvec(2,6,10,14,18,22,26,30));
     3408  for(int i=1; i<=20; i++)
    33153409  {
    3316    I[size(I)+1] = lpMult(var(i),var(j));
    3317   }
    3318  }
    3319 
    3320  for (i = 1; i <= n; i++)
    3321  {
    3322   for (j = i+1; j<= n; j++)
    3323   {
    3324    I[size(I)+1] = lpMult(var(n+i),var(n+j));
    3325   }
    3326  }
    3327  for (i = 1; i <= n; i++)
    3328  {
    3329   for (j = 1; j<= n; j++)
    3330   {
    3331    I[size(I)+1] = lpMult(var(i),var(n+j));
    3332   }
    3333  }
    3334   for (i = 1; i <= n; i++)
    3335  {
    3336   for (j = 1; j<= n; j++)
    3337   {
    3338    I[size(I)+1] = lpMult(var(i),var(2*n+j));
    3339   }
    3340  }
    3341  for (i = 1; i <= n; i++)
    3342  {
    3343   for (j = 1; j<= n; j++)
    3344   {
    3345    I[size(I)+1] = lpMult(var(2*n+i),var(n+j));
    3346   }
    3347  }
    3348   for (i = 1; i <= n; i++)
    3349  {
    3350   for (j = 1; j<= n; j++)
    3351   {
    3352    I[size(I)+1] = lpMult(var(2*n+i),var(2*n+j));
    3353   }
    3354  }
    3355  I = simplify(I,2+4);
    3356  I = letplaceGBasis(I);
    3357  export(I);
    3358  if (baseringdef == 1) {setring save;}
    3359  return(R);
    3360 }
    3361 
    3362 proc TestGKAuslander3()
    3363 {
    3364 ring r = (0,q),(z,x,y),(dp(1),dp(2));
    3365 def R = makeLetterplaceRing(5); // constructs a Letterplace ring
    3366 R; setring R; // sets basering to Letterplace ring
    3367 ideal I;
    3368 I = q*x(1)*y(2) - y(1)*x(2), z(1)*y(2) - y(1)*z(2), z(1)*x(2) - x(1)*z(2);
    3369 I = letplaceGBasis(I);
    3370 lpGkDim(I); // must be 3
    3371 I = x(1)*y(2)*z(3) - y(1)*x(2), z(1)*y(2) - y(1)*z(2), z(1)*x(2) - x(1)*z(2);//gkDim = 2
    3372 I = letplaceGBasis(I); // not finite BUT contains a poly in x,y only
    3373 lpGkDim(I); // must be 4
    3374 
    3375 ring r = 0,(y,x,z),dp;
    3376 def R = makeLetterplaceRing(10); // constructs a Letterplace ring
    3377 R; setring R; // sets basering to Letterplace ring
    3378 ideal I;
    3379 I = x(1)*y(2)*z(3) - y(1)*x(2), z(1)*y(2) - y(1)*z(2), z(1)*x(2) - x(1)*z(2);//gkDim = 2
    3380 I = letplaceGBasis(I); // computed as it would be homogenized; infinite
    3381 poly p = x(1)*y(2)*y(3)*x(4)-y(1)*x(2)*x(3)*y(4);
    3382 lpNF(p, I); // 0 as expected
    3383 
    3384 // with inverse of z
    3385 ring r = 0,(iz,z,x,y),dp;
    3386 def R = makeLetterplaceRing(11); // constructs a Letterplace ring
    3387 R; setring R; // sets basering to Letterplace ring
    3388 ideal I;
    3389 I = x(1)*y(2)*z(3) - y(1)*x(2), z(1)*y(2) - y(1)*z(2), z(1)*x(2) - x(1)*z(2),
    3390 iz(1)*y(2) - y(1)*iz(2), iz(1)*x(2) - x(1)*iz(2), iz(1)*z(2)-1, z(1)*iz(2) -1;
    3391 I = letplaceGBasis(I); //
    3392 setring r;
    3393 def R2 = makeLetterplaceRing(23); // constructs a Letterplace ring
    3394 setring R2; // sets basering to Letterplace ring
    3395 ideal I = imap(R,I);
    3396 lpGkDim(I);
    3397 
    3398 
    3399 ring r = 0,(t,z,x,y),(dp(2),dp(2));
    3400 def R = makeLetterplaceRing(20); // constructs a Letterplace ring
    3401 R; setring R; // sets basering to Letterplace ring
    3402 ideal I;
    3403 I = x(1)*y(2)*z(3) - y(1)*x(2)*t(3), z(1)*y(2) - y(1)*z(2), z(1)*x(2) - x(1)*z(2),
    3404 t(1)*y(2) - y(1)*t(2), t(1)*x(2) - x(1)*t(2), t(1)*z(2) - z(1)*t(2);//gkDim = 2
    3405 I = letplaceGBasis(I); // computed as it would be homogenized; infinite
    3406 LIB "elim.lib";
    3407 ideal Inoz = nselect(I,intvec(2,6,10,14,18,22,26,30));
    3408 for(int i=1; i<=20; i++)
    3409 {
    3410 Inoz=subst(Inoz,t(i),1);
    3411 }
    3412 ideal J = x(1)*y(2)*y(3)*x(4)-y(1)*x(2)*x(3)*y(4);
    3413 J = letplaceGBasis(J);
    3414 
    3415 poly p = x(1)*y(2)*y(3)*x(4)-y(1)*x(2)*x(3)*y(4);
    3416 lpNF(p, I); // 0 as expected
    3417 
    3418 ring r2 = 0,(x,y),dp;
    3419 def R2 = makeLetterplaceRing(50); // constructs a Letterplace ring
    3420 setring R2;
    3421 ideal J = x(1)*y(2)*y(3)*x(4)-y(1)*x(2)*x(3)*y(4);
    3422 J = letplaceGBasis(J);
     3410    Inoz=subst(Inoz,t(i),1);
     3411  }
     3412  ideal J = x(1)*y(2)*y(3)*x(4)-y(1)*x(2)*x(3)*y(4);
     3413  J = letplaceGBasis(J);
     3414
     3415  poly p = x(1)*y(2)*y(3)*x(4)-y(1)*x(2)*x(3)*y(4);
     3416  lpNF(p, I); // 0 as expected
     3417
     3418  ring r2 = 0,(x,y),dp;
     3419  def R2 = makeLetterplaceRing(50); // constructs a Letterplace ring
     3420  setring R2;
     3421  ideal J = x(1)*y(2)*y(3)*x(4)-y(1)*x(2)*x(3)*y(4);
     3422  J = letplaceGBasis(J);
    34233423}
    34243424
     
    34573457lpGkDim(J); // 3 == correct
    34583458
    3459 */
     3459 */
Note: See TracChangeset for help on using the changeset viewer.