source: git/Singular/LIB/involut.lib @ 393c47

fieker-DuValspielwiese
Last change on this file since 393c47 was f7d745, checked in by Hans Schoenemann <hannes@…>, 13 years ago
format git-svn-id: file:///usr/local/Singular/svn/trunk@14246 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 26.1 KB
Line 
1//
2version="$Id$";
3category="Noncommutative";
4info="
5LIBRARY:  involut.lib  Computations and operations with involutions
6AUTHORS:  Oleksandr Iena,       yena@mathematik.uni-kl.de,
7@*        Markus Becker,        mbecker@mathematik.uni-kl.de,
8@*        Viktor Levandovskyy,  levandov@mathematik.uni-kl.de
9
10OVERVIEW:
11Involution is an anti-automorphism of a non-commutative K-algebra
12with the property that applied an involution twice, one gets an identity.
13Involution is linear with respect to the ground field. In this library we
14compute linear involutions, distinguishing the case of a diagonal matrix
15(such involutions are called homothetic) and a general one.
16Also, linear automorphisms of different order can be computed.
17
18SUPPORT: Forschungsschwerpunkt 'Mathematik und Praxis' (Project of Dr. E. Zerz
19and V. Levandovskyy), Uni Kaiserslautern
20
21REMARK: This library provides algebraic tools for computations and operations
22with algebraic involutions and linear automorphisms of non-commutative algebras
23
24PROCEDURES:
25findInvo();          computes linear involutions on a basering;
26findInvoDiag();     computes homothetic (diagonal) involutions on a basering;
27findAuto(n);          computes linear automorphisms of order n of a basering;
28ncdetection();        computes an ideal, presenting an involution map on some particular noncommutative algebras;
29involution(m,theta);  applies the involution to an object;
30isInvolution(F); check whether a map F in an involution;
31isAntiEndo(F);   check whether a map F in an antiendomorphism.
32";
33
34LIB "nctools.lib";
35LIB "ncalg.lib";
36LIB "poly.lib";
37LIB "primdec.lib";
38///////////////////////////////////////////////////////////////////////////////
39proc ncdetection()
40"USAGE:  ncdetection();
41RETURN:  ideal, representing an involution map
42PURPOSE: compute classical involutions (i.e. acting rather on operators than on variables) for some particular noncommutative algebras
43ASSUME: the procedure is aimed at non-commutative algebras with differential, shift or advance operators arising in Control Theory.
44It has to be executed in a ring.
45EXAMPLE: example ncdetection; shows an example
46"{
47// in this procedure an involution map is generated from the NCRelations
48// that will be used in the function involution
49// in dieser proc. wird eine matrix erzeugt, die in der i-ten zeile die indices
50// der differential-, shift- oder advance-operatoren enthaelt mit denen die i-te
51// variable nicht kommutiert.
52  if ( nameof(basering)=="basering" )
53  {
54    "No current ring defined.";
55    return(ideal(0));
56  }
57  def r = basering;
58  setring r;
59  int i,j,k,LExp;
60  int NVars  = nvars(r);
61  matrix rel = ncRelations(r)[2];
62  intmat M[NVars][3];
63  int NRows = nrows(rel);
64  intvec v,w;
65  poly d,d_lead;
66  ideal I;
67  map theta;
68  for( j=NRows; j>=2; j-- )
69  {
70   if( rel[j] == w )       //the whole column is zero
71    {
72      j--;
73      continue;
74    }
75    for( i=1; i<j; i++ )
76    {
77      if( rel[i,j]==1 )        //relation of type var(j)*var(i) = var(i)*var(j) +1
78      {
79         M[i,1]=j;
80      }
81      if( rel[i,j] == -1 )    //relation of type var(i)*var(j) = var(j)*var(i) -1
82      {
83        M[j,1]=i;
84      }
85      d = rel[i,j];
86      d_lead = lead(d);
87      v = leadexp(d_lead); //in the next lines we check wether we have a  relation of differential or shift type
88      LExp=0;
89      for(k=1; k<=NVars; k++)
90      {
91        LExp = LExp + v[k];
92      }
93      //      if( (d-d_lead != 0) || (LExp > 1) )
94if ( ( (d-d_lead) != 0) || (LExp > 1) || ( (LExp==0) && ((d_lead>1) || (d_lead<-1)) ) )
95      {
96        return(theta);
97      }
98
99      if( v[j] == 1)                   //relation of type var(j)*var(i) = var(i)*var(j) -lambda*var(j)
100      {
101        if (leadcoef(d) < 0)
102        {
103          M[i,2] = j;
104        }
105        else
106        {
107          M[i,3] = j;
108        }
109      }
110      if( v[i]==1 )                    //relation of type var(j)*var(i) = var(i)*var(j) -lambda*var(i)
111      {
112        if (leadcoef(d) > 0)
113        {
114          M[j,2] = i;
115        }
116        else
117        {
118          M[j,3] = i;
119        }
120      }
121    }
122  }
123  // from here on, the map is computed
124  for(i=1;i<=NVars;i++)
125  {
126    I=I+var(i);
127  }
128
129  for(i=1;i<=NVars;i++)
130  {
131    if( M[i,1..3]==(0,0,0) )
132    {
133      i++;
134      continue;
135    }
136    if( M[i,1]!=0 )
137    {
138      if( (M[i,2]!=0) && (M[i,3]!=0) )
139      {
140        I[M[i,1]] = -var(M[i,1]);
141        I[M[i,2]] = var(M[i,3]);
142        I[M[i,3]] = var(M[i,2]);
143      }
144      if( (M[i,2]==0) && (M[i,3]==0) )
145      {
146        I[M[i,1]] = -var(M[i,1]);
147      }
148      if( ( (M[i,2]!=0) && (M[i,3]==0) )|| ( (M[i,2]!=0) && (M[i,3]==0) )
149)
150      {
151        I[i] = -var(i);
152      }
153    }
154    else
155    {
156      if( (M[i,2]!=0) && (M[i,3]!=0) )
157      {
158        I[i] = -var(i);
159        I[M[i,2]] = var(M[i,3]);
160        I[M[i,3]] = var(M[i,2]);
161      }
162      else
163      {
164        I[i] = -var(i);
165      }
166    }
167  }
168  return(I);
169}
170example
171{
172  "EXAMPLE:"; echo = 2;
173  ring R = 0,(x,y,z,D(1..3)),dp;
174  matrix D[6][6];
175  D[1,4]=1; D[2,5]=1;  D[3,6]=1;
176  def r = nc_algebra(1,D); setring r;
177  ncdetection();
178  kill r, R;
179  //----------------------------------------
180  ring R=0,(x,S),dp;
181  def r = nc_algebra(1,-S); setring r;
182  ncdetection();
183  kill r, R;
184  //----------------------------------------
185  ring R=0,(x,D(1),S),dp;
186  matrix D[3][3];
187  D[1,2]=1;  D[1,3]=-S;
188  def r = nc_algebra(1,D); setring r;
189  ncdetection();
190}
191
192static proc In_Poly(poly mm, list l, int NVars)
193// applies the involution to the polynomial mm
194// entries of a list l are images of variables under invo
195// more general than invo_poly; used in many rings setting
196{
197  int i,j;
198  intvec v;
199  poly pp, zz;
200  poly nn = 0;
201  i = 1;
202  while(mm[i]!=0)
203  {
204    v  = leadexp(mm[i]);
205    zz = 1;
206    for( j=NVars; j>=1; j--)
207    {
208      if (v[j]!=0)
209      {
210        pp = l[j];
211        zz = zz*(pp^v[j]);
212      }
213    }
214    nn = nn + (leadcoef(mm[i])*zz);
215    i++;
216  }
217  return(nn);
218}
219
220static proc Hom_Poly(poly mm, list l, int NVars)
221// applies the endomorphism to the polynomial mm
222// entries of a list l are images of variables under endo
223// should not be replaced by map-based stuff! used in
224// many rings setting
225{
226  int i,j;
227  intvec v;
228  poly pp, zz;
229  poly nn = 0;
230  i = 1;
231  while(mm[i]!=0)
232  {
233    v  = leadexp(mm[i]);
234    zz = 1;
235    for( j=NVars; j>=1; j--)
236    {
237      if (v[j]!=0)
238      {
239        pp = l[j];
240        zz = (pp^v[j])*zz;
241      }
242    }
243    nn = nn + (leadcoef(mm[i])*zz);
244    i++;
245  }
246  return(nn);
247}
248
249static proc invo_poly(poly m, map theta)
250// applies the involution map theta to m, where m=polynomial
251{
252  // compatibility:
253  ideal l = ideal(theta);
254  int i;
255  list L;
256  for (i=1; i<=size(l); i++)
257  {
258    L[i] = l[i];
259  }
260  int nv = nvars(basering);
261  return (In_Poly(m,L,nv));
262//   if (m==0) { return(m); }
263//   int i,j;
264//   intvec v;
265//   poly p,z;
266//   poly n = 0;
267//   i = 1;
268//   while(m[i]!=0)
269//   {
270//     v = leadexp(m[i]);
271//     z =1;
272//     for(j=nvars(basering); j>=1; j--)
273//     {
274//       if (v[j]!=0)
275//       {
276//         p = var(j);
277//         p = theta(p);
278//         z = z*(p^v[j]);
279//       }
280//     }
281//     n = n + (leadcoef(m[i])*z);
282//     i++;
283//   }
284//   return(n);
285}
286///////////////////////////////////////////////////////////////////////////////////
287proc involution(m, map theta)
288"USAGE:  involution(m, theta); m is a poly/vector/ideal/matrix/module, theta is a map
289RETURN:  object of the same type as m
290PURPOSE: applies the involution, presented by theta to the object m
291THEORY: for an involution theta and two polynomials a,b from the algebra,
292@*  theta(ab) = theta(b) theta(a); theta is linear with respect to the ground field
293NOTE: This is generalized ''theta(m)'' for data types unsupported by ''map''.
294EXAMPLE: example involution; shows an example
295"{
296  // applies the involution map theta to m,
297  // where m= vector, polynomial, module, matrix, ideal
298  int i,j;
299  intvec v;
300  poly p,z;
301  if (typeof(m)=="poly")
302  {
303    return (invo_poly(m,theta));
304  }
305  if ( typeof(m)=="ideal" )
306  {
307    ideal n;
308    for (i=1; i<=size(m); i++)
309    {
310      n[i] = invo_poly(m[i], theta);
311    }
312    return(n);
313  }
314  if (typeof(m)=="vector")
315  {
316    for(i=1; i<=size(m); i++)
317    {
318      m[i] = invo_poly(m[i], theta);
319    }
320    return (m);
321  }
322  if ( (typeof(m)=="matrix") || (typeof(m)=="module"))
323  {
324    matrix n = matrix(m);
325    int @R=nrows(n);
326    int @C=ncols(n);
327    for(i=1; i<=@R; i++)
328    {
329      for(j=1; j<=@C; j++)
330      {
331        if (m[i,j]!=0)
332        {
333          n[i,j] = invo_poly( m[i,j], theta);
334        }
335      }
336    }
337    if (typeof(m)=="module")
338    {
339      return (module(n));
340    }
341    else // matrix
342    {
343      return(n);
344    }
345  }
346  // if m is not of the supported type:
347  "Error: unsupported argument type!";
348  return();
349}
350example
351{
352  "EXAMPLE:";echo = 2;
353  ring R = 0,(x,d),dp;
354  def r = nc_algebra(1,1); setring r; // Weyl-Algebra
355  map F = r,x,-d;
356  F(F);  // should be maxideal(1) for an involution
357  poly f =  x*d^2+d;
358  poly If = involution(f,F);
359  f-If;
360  poly g = x^2*d+2*x*d+3*x+7*d;
361  poly tg = -d*x^2-2*d*x+3*x-7*d;
362  poly Ig = involution(g,F);
363  tg-Ig;
364  ideal I = f,g;
365  ideal II = involution(I,F);
366  II;
367  matrix(I) - involution(II,F);
368  module M  = [f,g,0],[g,0,x^2*d];
369  module IM = involution(M,F);
370  print(IM);
371  print(matrix(M) - involution(IM,F));
372}
373///////////////////////////////////////////////////////////////////////////////////
374static proc new_var()
375//generates a string of new variables
376{
377
378  int NVars=nvars(basering);
379  int i,j;
380  //  string s="@_1_1";
381  string s="a11";
382  for(i=1; i<=NVars; i++)
383  {
384    for(j=1; j<=NVars; j++)
385    {
386      if(i*j!=1)
387      {
388        s = s+ ","+NVAR(i,j);
389      }
390    }
391  }
392  return(s);
393}
394
395static proc NVAR(int i, int j)
396{
397  //  return("@_"+string(i)+"_"+string(j));
398  return("a"+string(i)+string(j));
399}
400///////////////////////////////////////////////////////////////////////////////////
401static proc new_var_special()
402//generates a string of new variables
403{
404  int NVars=nvars(basering);
405  int i;
406  //  string s="@_1_1";
407  string s="a11";
408  for(i=2; i<=NVars; i++)
409  {
410    s = s+ ","+NVAR(i,i);
411  }
412  return(s);
413}
414///////////////////////////////////////////////////////////////////////////////////
415static proc RelMatr()
416// returns the matrix of relations
417// only Lie-type relations x_j x_i= x_i x_j + .. are taken into account
418{
419  int i,j;
420  int NVars = nvars(basering);
421  matrix Rel[NVars][NVars];
422  for(i=1; i<NVars; i++)
423  {
424    for(j=i+1; j<=NVars; j++)
425    {
426      Rel[i,j]=var(j)*var(i)-var(i)*var(j);
427    }
428  }
429  return(Rel);
430}
431/////////////////////////////////////////////////////////////////
432proc findInvo()
433"USAGE: findInvo();
434RETURN: a ring containing a list L of pairs, where
435@*        L[i][1]  =  ideal; a Groebner Basis of an i-th associated prime,
436@*        L[i][2]  =  matrix, defining a linear map, with entries, reduced with respect to L[i][1]
437PURPOSE: computed the ideal of linear involutions of the basering
438ASSUME: the relations on the algebra are of the form YX = XY + D, that is
439the current ring is a G-algebra of Lie type.
440NOTE: for convenience, the full ideal of relations @code{idJ}
441and the initial matrix with indeterminates @code{matD} are exported in the output ring
442SEE ALSO: findInvoDiag, involution
443EXAMPLE: example findInvo; shows examples
444
445"{
446  def @B    = basering; //save the name of basering
447  int NVars = nvars(@B); //number of variables in basering
448  int i, j;
449
450  // check basering is of Lie type:
451  if (!isLieType())
452  {
453    ERROR("Assume violated: basering is of non-Lie type");
454  }
455
456  matrix Rel = RelMatr(); //the matrix of relations
457
458  string @ss   = new_var(); //string of new variables
459  string Par = parstr(@B); //string of parameters in old ring
460
461  if (Par=="") // if there are no parameters
462  {
463    execute("ring @@@KK=0,("+varstr(@B)+","+@ss+"), dp;"); //new ring with new variables
464  }
465  else //if there exist parameters
466  {
467     execute("ring @@@KK=(0,"+Par+") ,("+varstr(@B)+","+@ss+"), dp;");//new ring with new variables
468  }
469
470  matrix Rel = imap(@B, Rel); //consider the matrix of relations in new ring
471
472  int Sz = NVars*NVars+NVars; // number of variables in new ring
473
474  matrix M[Sz][Sz]; //to be the matrix of relations in new ring
475
476  for(i=1; i<NVars; i++) //initialize that matrix of relations
477  {
478    for(j=i+1; j<=NVars; j++)
479    {
480      M[i,j] = Rel[i,j];
481    }
482  }
483
484  def @@K = nc_algebra(1, M); setring @@K; //now new ring @@K become a noncommutative ring
485
486  list l; //list to define an involution
487  poly @@F;
488  for(i=1; i<=NVars; i++) //initializing list for involution
489  {
490    @@F=0;
491    for(j=1; j<=NVars; j++)
492    {
493      execute( "@@F = @@F+"+NVAR(i,j)+"*"+string( var(j) )+";" );
494    }
495    l=l+list(@@F);
496  }
497
498  matrix N = imap(@@@KK,Rel);
499
500  for(i=1; i<NVars; i++)//get matrix by applying the involution to relations
501  {
502    for(j=i+1; j<=NVars; j++)
503    {
504      N[i,j]= l[j]*l[i] - l[i]*l[j] + In_Poly( N[i,j], l, NVars);
505    }
506  }
507  kill l;
508  //---------------------------------------------
509  //get the ideal of coefficients of N
510  ideal J;
511  ideal idN = simplify(ideal(N),2);
512  J = ideal(coeffs( idN, var(1) ) );
513  for(i=2; i<=NVars; i++)
514  {
515    J = ideal( coeffs( J, var(i) ) );
516  }
517  J = simplify(J,2);
518  //-------------------------------------------------
519  if ( Par=="" ) //initializes the ring of relations
520  {
521    execute("ring @@KK=0,("+@ss+"), dp;");
522  }
523  else
524  {
525    execute("ring @@KK=(0,"+Par+"),("+@ss+"), dp;");
526  }
527  ideal J = imap(@@K,J); // ideal, considered in @@KK now
528  string snv = "["+string(NVars)+"]";
529  execute("matrix @@D"+snv+snv+"="+@ss+";"); // matrix with entries=new variables
530
531  J = J, ideal( @@D*@@D-matrix( freemodule(NVars) ) ); // add the condition that involution to square is just identity
532  J = simplify(J,2); // without extra zeros
533  list mL = minAssGTZ(J); // components not in GB
534  int sL  = size(mL);
535  option(redSB);       // important for reduced GBs
536  option(redTail);
537  matrix IM = @@D;     // involution map
538  list L    = list();  // the answer
539  list TL;
540  ideal tmp = 0;
541  for (i=1; i<=sL; i++) // compute GBs of components
542  {
543    TL    = list();
544    TL[1] = std(mL[i]);
545    tmp   = NF( ideal(IM), TL[1] );
546    TL[2] = matrix(tmp, NVars,NVars);
547    L[i]  = TL;
548  }
549  export(L); // main export
550  ideal idJ = J; // debug-comfortable exports
551  matrix matD = @@D;
552  export(idJ);
553  export(matD);
554  return(@@KK);
555}
556example
557{ "EXAMPLE:"; echo = 2;
558  def a = makeWeyl(1);
559  setring a; // this algebra is a first Weyl algebra
560  a;
561  def X = findInvo();
562  setring X; // ring with new variables, corr. to unknown coefficients
563  X;
564  L;
565  // look at the matrix in the new variables, defining the linear involution
566  print(L[1][2]);
567  L[1][1];  // where new variables obey these relations
568  idJ;
569}
570///////////////////////////////////////////////////////////////////////////
571proc findInvoDiag()
572"USAGE: findInvoDiag();
573RETURN: a ring together with a list of pairs L, where
574@*        L[i][1]  =  ideal; a Groebner Basis of an i-th associated prime,
575@*        L[i][2]  =  matrix, defining a linear map, with entries, reduced with respect to L[i][1]
576PURPOSE: compute homothetic (diagonal) involutions of the basering
577ASSUME: the relations on the algebra are of the form YX = XY + D, that is
578the current ring is a G-algebra of Lie type.
579NOTE: for convenience, the full ideal of relations @code{idJ}
580and the initial matrix with indeterminates @code{matD} are exported in the output ring
581SEE ALSO: findInvo, involution
582EXAMPLE: example findInvoDiag; shows examples
583"{
584  def @B    = basering; //save the name of basering
585  int NVars = nvars(@B); //number of variables in basering
586  int i, j;
587
588  // check basering is of Lie type:
589  if (!isLieType())
590  {
591    ERROR("Assume violated: basering is of non-Lie type");
592  }
593
594  matrix Rel = RelMatr(); //the matrix of relations
595
596  string @ss   = new_var_special(); //string of new variables
597  string Par = parstr(@B); //string of parameters in old ring
598
599  if (Par=="") // if there are no parameters
600  {
601    execute("ring @@@KK=0,("+varstr(@B)+","+@ss+"), dp;"); //new ring with new variables
602  }
603  else //if there exist parameters
604  {
605    execute("ring @@@KK=(0,"+Par+") ,("+varstr(@B)+","+@ss+"), dp;");//new ring with new variables
606  }
607
608  matrix Rel = imap(@B, Rel); //consider the matrix of relations in new ring
609
610  int Sz = 2*NVars; // number of variables in new ring
611
612  matrix M[Sz][Sz]; //to be the matrix of relations in new ring
613  for(i=1; i<NVars; i++) //initialize that matrix of relations
614  {
615    for(j=i+1; j<=NVars; j++)
616    {
617      M[i,j] = Rel[i,j];
618    }
619  }
620
621  def @@K = nc_algebra(1, M); setring @@K; //now new ring @@K become a noncommutative ring
622
623  list l; //list to define an involution
624
625  for(i=1; i<=NVars; i++) //initializing list for involution
626  {
627    execute( "l["+string(i)+"]="+NVAR(i,i)+"*"+string( var(i) )+";" );
628
629  }
630  matrix N = imap(@@@KK,Rel);
631
632  for(i=1; i<NVars; i++)//get matrix by applying the involution to relations
633  {
634    for(j=i+1; j<=NVars; j++)
635    {
636      N[i,j]= l[j]*l[i] - l[i]*l[j] + In_Poly( N[i,j], l, NVars);
637    }
638  }
639  kill l;
640  //---------------------------------------------
641  //get the ideal of coefficients of N
642
643  ideal J;
644  ideal idN = simplify(ideal(N),2);
645  J = ideal(coeffs( idN, var(1) ) );
646  for(i=2; i<=NVars; i++)
647  {
648    J = ideal( coeffs( J, var(i) ) );
649  }
650  J = simplify(J,2);
651  //-------------------------------------------------
652
653  if ( Par=="" ) //initializes the ring of relations
654  {
655    execute("ring @@KK=0,("+@ss+"), dp;");
656  }
657  else
658  {
659    execute("ring @@KK=(0,"+Par+"),("+@ss+"), dp;");
660  }
661
662  ideal J = imap(@@K,J); // ideal, considered in @@KK now
663
664  matrix @@D[NVars][NVars]; // matrix with entries=new variables to square i.e. @@D=@@D^2
665  for(i=1;i<=NVars;i++)
666  {
667    execute("@@D["+string(i)+","+string(i)+"]="+NVAR(i,i)+";");
668  }
669  J = J, ideal( @@D*@@D - matrix( freemodule(NVars) ) ); // add the condition that involution to square is just identity
670  J = simplify(J,2); // without extra zeros
671
672  list mL = minAssGTZ(J); // components not in GB
673  int sL  = size(mL);
674  option(redSB); // important for reduced GBs
675  option(redTail);
676  matrix IM = @@D; // involution map
677  list L = list(); // the answer
678  list TL;
679  ideal tmp = 0;
680  for (i=1; i<=sL; i++) // compute GBs of components
681  {
682    TL    = list();
683    TL[1] = std(mL[i]);
684    tmp   = NF( ideal(IM), TL[1] );
685    TL[2] = matrix(tmp, NVars,NVars);
686    L[i]  = TL;
687  }
688  export(L);
689  ideal idJ = J; // debug-comfortable exports
690  matrix matD = @@D;
691  export(idJ);
692  export(matD);
693  return(@@KK);
694}
695example
696{ "EXAMPLE:"; echo = 2;
697  def a = makeWeyl(1);
698  setring a; // this algebra is a first Weyl algebra
699  a;
700  def X = findInvoDiag();
701  setring X; // ring with new variables, corresponding to unknown coefficients
702  X;
703  // print matrices, defining linear involutions
704  print(L[1][2]);  // a first matrix: we see it is constant
705  print(L[2][2]);  // and a second possible matrix; it is constant too
706  L; // let us take a look on the whole list
707  idJ;
708}
709/////////////////////////////////////////////////////////////////////
710proc findAuto(int n)
711"USAGE: findAuto(n); n an integer
712RETURN: a ring together with a list of pairs L, where
713@*        L[i][1]  =  ideal; a Groebner Basis of an i-th associated prime,
714@*        L[i][2]  =  matrix, defining a linear map, with entries, reduced with respect to L[i][1]
715PURPOSE: compute the ideal of linear automorphisms of the basering,
716@*  given by a matrix, n-th power of which gives identity (i.e. unipotent matrix)
717ASSUME: the relations on the algebra are of the form YX = XY + D, that is
718the current ring is a G-algebra of Lie type.
719NOTE: if n=0, a matrix, defining an automorphism is not assumed to be unipotent
720@* but just non-degenerate. A nonzero parameter @code{@@p} is introduced as the value of
721@* the determinant of the matrix above.
722@* For convenience, the full ideal of relations @code{idJ} and the initial matrix with indeterminates
723@* @code{matD} are mutually exported in the output ring
724SEE ALSO: findInvo
725EXAMPLE: example findAuto; shows examples
726"{
727  if ((n<0 ) || (n==1))
728  {
729    "The index of unipotency is too small.";
730    return(0);
731  }
732
733
734  def @B    = basering; //save the name of basering
735  int NVars = nvars(@B); //number of variables in basering
736  int i, j;
737
738  // check basering is of Lie type:
739  if (!isLieType())
740  {
741    ERROR("Assume violated: basering is of non-Lie type");
742  }
743
744  matrix Rel = RelMatr(); //the matrix of relations
745
746  string @ss = new_var(); //string of new variables
747  string Par = parstr(@B); //string of parameters in old ring
748
749  if (Par=="") // if there are no parameters
750  {
751    execute("ring @@@K=0,("+varstr(@B)+","+@ss+"), dp;"); //new ring with new variables
752  }
753  else //if there exist parameters
754  {
755     execute("ring @@@K=(0,"+Par+") ,("+varstr(@B)+","+@ss+"), dp;");//new ring with new variables
756  }
757
758  matrix Rel = imap(@B, Rel); //consider the matrix of relations in new ring
759
760  int Sz = NVars*NVars+NVars; // number of variables in new ring
761
762  matrix M[Sz][Sz]; //to be the matrix of relations in new ring
763
764  for(i=1; i<NVars; i++) //initialize that matrix of relations
765  {
766    for(j=i+1; j<=NVars; j++)
767    {
768      M[i,j] = Rel[i,j];
769    }
770  }
771
772  def @@K = nc_algebra(1, M); setring @@K; //now new ring @@K become a noncommutative ring
773
774  list l; //list to define a homomorphism(isomorphism)
775  poly @@F;
776  for(i=1; i<=NVars; i++) //initializing list for involution
777  {
778    @@F=0;
779    for(j=1; j<=NVars; j++)
780    {
781      execute( "@@F = @@F+"+NVAR(i,j)+"*"+string( var(j) )+";" );
782    }
783    l=l+list(@@F);
784  }
785
786  matrix N = imap(@@@K,Rel);
787
788  for(i=1; i<NVars; i++)//get matrix by applying the homomorphism  to relations
789  {
790    for(j=i+1; j<=NVars; j++)
791    {
792      N[i,j]= l[j]*l[i] - l[i]*l[j] - Hom_Poly( N[i,j], l, NVars);
793    }
794  }
795  kill l;
796  //---------------------------------------------
797  //get the ideal of coefficients of N
798  ideal J;
799  ideal idN = simplify(ideal(N),2);
800  J = ideal(coeffs( idN, var(1) ) );
801  for(i=2; i<=NVars; i++)
802  {
803    J = ideal( coeffs( J, var(i) ) );
804  }
805  J = simplify(J,2);
806  //-------------------------------------------------
807  if (( Par=="" ) && (n!=0)) //initializes the ring of relations
808  {
809    execute("ring @@KK=0,("+@ss+"), dp;");
810  }
811  if (( Par=="" ) && (n==0)) //initializes the ring of relations
812  {
813    execute("ring @@KK=(0,@p),("+@ss+"), dp;");
814  }
815  if ( Par!="" )
816  {
817    execute("ring @@KK=(0,"+Par+"),("+@ss+"), dp;");
818  }
819  //  execute("setring @@KK;");
820  //  basering;
821  ideal J = imap(@@K,J); // ideal, considered in @@KK now
822  string snv = "["+string(NVars)+"]";
823  execute("matrix @@D"+snv+snv+"="+@ss+";"); // matrix with entries=new variables
824
825  if (n>=2)
826  {
827    J = J, ideal( @@D*@@D-matrix( freemodule(NVars) ) ); // add the condition that homomorphism to square is just identity
828  }
829  if (n==0)
830  {
831    J = J, det(@@D)-@p; // det of non-unipotent matrix is nonzero
832  }
833  J       = simplify(J,2); // without extra zeros
834  list mL = minAssGTZ(J); // components not in GB
835  int sL  = size(mL);
836  option(redSB); // important for reduced GBs
837  option(redTail);
838  matrix IM = @@D; //  map
839  list L = list(); // the answer
840  list TL;
841  ideal tmp = 0;
842  for (i=1; i<=sL; i++)// compute GBs of components
843  {
844    TL    = list();
845    TL[1] = std(mL[i]);
846    tmp   = NF( ideal(IM), TL[1] );
847    TL[2] = matrix(tmp,NVars, NVars);
848    L[i]  = TL;
849  }
850  export(L);
851  ideal idJ = J; // debug-comfortable exports
852  matrix matD = @@D;
853  export(idJ);
854  export(matD);
855  return(@@KK);
856}
857example
858{ "EXAMPLE:"; echo = 2;
859  def a = makeWeyl(1);
860  setring a; // this algebra is a first Weyl algebra
861  a;
862  def X = findAuto(2);  // in contrast to findInvo look for automorphisms
863  setring X; // ring with new variables - unknown coefficients
864  X;
865  size(L); // we have (size(L)) families in the answer
866  // look at matrices, defining linear automorphisms:
867  print(L[1][2]);  // a first one: we see it is the identity
868  print(L[2][2]);  // and a second possible matrix; it is diagonal
869  // L; // we can take a look on the whole list, too
870  idJ;
871  kill X; kill a;
872  //----------- find all the linear automorphisms --------------------
873  //----------- use the call findAuto(0)          --------------------
874  ring R = 0,(x,s),dp;
875  def r = nc_algebra(1,s); setring r; // the shift algebra
876  s*x; // the only relation in the algebra is:
877  def Y = findAuto(0);
878  setring Y;
879  size(L); // here, we have 1 parametrized family
880  print(L[1][2]); // here, @p is a nonzero parameter
881  det(L[1][2]-@p);  // check whether determinante is zero
882}
883
884
885proc isAntiEndo(def F)
886"USAGE: isAntiEndo(F); F is a map from current ring to itself
887RETURN: integer, 1 if F determines an antiendomorphism of
888current ring and 0 otherwise
889ASSUME: F is a map from current ring to itself
890SEE ALSO: isInvolution, involution, findInvo
891EXAMPLE: example isAntiEndo; shows examples
892"
893{
894  // assumes:
895  // (1) F is from br to br
896  // I don't see how to check it; in case of error it will happen in the body
897  // (2) do not assume: F is linear, F is bijective
898  int n = nvars(basering);
899  int i,j;
900  poly pi,pj,q;
901  int answer=1;
902  ideal @f = ideal(F); list L=@f[1..ncols(@f)];
903  for (i=1; i<n; i++)
904  {
905    for (j=i+1; j<=n; j++)
906    {
907      // F( x_j x_i) =def= F(x_i) F(x_j)
908      pi = var(i);
909      pj = var(j);
910      //      q = involution(pj*pi,F) - F(pi)*F(pj);
911      q = In_Poly(pj*pi,L,n) - F[i]*F[j];
912      if (q!=0)
913      {
914        answer=0; return(answer);
915      }
916    }
917  }
918  return(answer);
919}
920example
921{"EXAMPLE:";echo = 2;
922  def A = makeUsl(2); setring A;
923  map I = A,-e,-f,-h; //correct antiauto involution
924  isAntiEndo(I);
925  map J = A,3*e,1/3*f,-h; // antiauto but not involution
926  isAntiEndo(J);
927  map K = A,f,e,-h; // not antiendo
928  isAntiEndo(K);
929}
930
931
932proc isInvolution(def F)
933"USAGE: isInvolution(F); F is a map from current ring to itself
934RETURN: integer, 1 if F determines an involution and 0 otherwise
935THEORY: involution is an antiautomorphism of order 2
936ASSUME: F is a map from current ring to itself
937SEE ALSO: involution, findInvo, isAntiEndo
938EXAMPLE: example isInvolution; shows examples
939"
940{
941  // does not assume: F is an antiautomorphism, can be antiendo
942  // allows to detect endos which are not autos
943  // isInvolution == ( F isAntiEndo && F(F)==id )
944  if (!isAntiEndo(F))
945  {
946    return(0);
947  }
948  //  def G = F(F);
949  int j; poly p; ideal @f = ideal(F); list L=@f[1..ncols(@f)];
950  int nv = nvars(basering);
951  for(j=nv; j>=1; j--)
952  {
953    //    p = var(j); p = F(p); p = F(p) - var(j);
954    //p = G(p) - p;
955    p = In_Poly(var(j),L,nv);
956    p = In_Poly(p,L,nv) -var(j) ;
957
958    if (p!=0)
959    {
960      return(0);
961    }
962  }
963  return(1);
964}
965example
966{"EXAMPLE:";echo = 2;
967  def A = makeUsl(2); setring A;
968  map I = A,-e,-f,-h; //correct antiauto involution
969  isInvolution(I);
970  map J = A,3*e,1/3*f,-h; // antiauto but not involution
971  isInvolution(J);
972  map K = A,f,e,-h; // not antiauto
973  isInvolution(K);
974}
Note: See TracBrowser for help on using the repository browser.