source: git/Singular/LIB/involut.lib @ 513673

spielwiese
Last change on this file since 513673 was 3686937, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Added '$Id$' as a comment to all libs (LIB/*.lib)
  • Property mode set to 100644
File size: 26.4 KB
Line 
1///////////////////////////////////////////////////////////////////
2version="version involut.lib 4.0.0.0 Jun_2013 "; // $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  intvec saveopt=option(get);
536  option(redSB);       // important for reduced GBs
537  option(redTail);
538  matrix IM = @@D;     // involution map
539  list L    = list();  // the answer
540  list TL;
541  ideal tmp = 0;
542  for (i=1; i<=sL; i++) // compute GBs of components
543  {
544    TL    = list();
545    TL[1] = std(mL[i]);
546    tmp   = NF( ideal(IM), TL[1] );
547    TL[2] = matrix(tmp, NVars,NVars);
548    L[i]  = TL;
549  }
550  export(L); // main export
551  ideal idJ = J; // debug-comfortable exports
552  matrix matD = @@D;
553  export(idJ);
554  export(matD);
555  option(set,saveopt);
556  return(@@KK);
557}
558example
559{ "EXAMPLE:"; echo = 2;
560  def a = makeWeyl(1);
561  setring a; // this algebra is a first Weyl algebra
562  a;
563  def X = findInvo();
564  setring X; // ring with new variables, corr. to unknown coefficients
565  X;
566  L;
567  // look at the matrix in the new variables, defining the linear involution
568  print(L[1][2]);
569  L[1][1];  // where new variables obey these relations
570  idJ;
571}
572///////////////////////////////////////////////////////////////////////////
573proc findInvoDiag()
574"USAGE: findInvoDiag();
575RETURN: a ring together with a list of pairs L, where
576@*        L[i][1]  =  ideal; a Groebner Basis of an i-th associated prime,
577@*        L[i][2]  =  matrix, defining a linear map, with entries, reduced with respect to L[i][1]
578PURPOSE: compute homothetic (diagonal) involutions of the basering
579ASSUME: the relations on the algebra are of the form YX = XY + D, that is
580the current ring is a G-algebra of Lie type.
581NOTE: for convenience, the full ideal of relations @code{idJ}
582and the initial matrix with indeterminates @code{matD} are exported in the output ring
583SEE ALSO: findInvo, involution
584EXAMPLE: example findInvoDiag; shows examples
585"{
586  def @B    = basering; //save the name of basering
587  int NVars = nvars(@B); //number of variables in basering
588  int i, j;
589
590  // check basering is of Lie type:
591  if (!isLieType())
592  {
593    ERROR("Assume violated: basering is of non-Lie type");
594  }
595
596  matrix Rel = RelMatr(); //the matrix of relations
597
598  string @ss   = new_var_special(); //string of new variables
599  string Par = parstr(@B); //string of parameters in old ring
600
601  if (Par=="") // if there are no parameters
602  {
603    execute("ring @@@KK=0,("+varstr(@B)+","+@ss+"), dp;"); //new ring with new variables
604  }
605  else //if there exist parameters
606  {
607    execute("ring @@@KK=(0,"+Par+") ,("+varstr(@B)+","+@ss+"), dp;");//new ring with new variables
608  }
609
610  matrix Rel = imap(@B, Rel); //consider the matrix of relations in new ring
611
612  int Sz = 2*NVars; // number of variables in new ring
613
614  matrix M[Sz][Sz]; //to be the matrix of relations in new ring
615  for(i=1; i<NVars; i++) //initialize that matrix of relations
616  {
617    for(j=i+1; j<=NVars; j++)
618    {
619      M[i,j] = Rel[i,j];
620    }
621  }
622
623  def @@K = nc_algebra(1, M); setring @@K; //now new ring @@K become a noncommutative ring
624
625  list l; //list to define an involution
626
627  for(i=1; i<=NVars; i++) //initializing list for involution
628  {
629    execute( "l["+string(i)+"]="+NVAR(i,i)+"*"+string( var(i) )+";" );
630
631  }
632  matrix N = imap(@@@KK,Rel);
633
634  for(i=1; i<NVars; i++)//get matrix by applying the involution to relations
635  {
636    for(j=i+1; j<=NVars; j++)
637    {
638      N[i,j]= l[j]*l[i] - l[i]*l[j] + In_Poly( N[i,j], l, NVars);
639    }
640  }
641  kill l;
642  //---------------------------------------------
643  //get the ideal of coefficients of N
644
645  ideal J;
646  ideal idN = simplify(ideal(N),2);
647  J = ideal(coeffs( idN, var(1) ) );
648  for(i=2; i<=NVars; i++)
649  {
650    J = ideal( coeffs( J, var(i) ) );
651  }
652  J = simplify(J,2);
653  //-------------------------------------------------
654
655  if ( Par=="" ) //initializes the ring of relations
656  {
657    execute("ring @@KK=0,("+@ss+"), dp;");
658  }
659  else
660  {
661    execute("ring @@KK=(0,"+Par+"),("+@ss+"), dp;");
662  }
663
664  ideal J = imap(@@K,J); // ideal, considered in @@KK now
665
666  matrix @@D[NVars][NVars]; // matrix with entries=new variables to square i.e. @@D=@@D^2
667  for(i=1;i<=NVars;i++)
668  {
669    execute("@@D["+string(i)+","+string(i)+"]="+NVAR(i,i)+";");
670  }
671  J = J, ideal( @@D*@@D - matrix( freemodule(NVars) ) ); // add the condition that involution to square is just identity
672  J = simplify(J,2); // without extra zeros
673
674  list mL = minAssGTZ(J); // components not in GB
675  int sL  = size(mL);
676  intvec saveopt=option(get);
677  option(redSB); // important for reduced GBs
678  option(redTail);
679  matrix IM = @@D; // involution map
680  list L = list(); // the answer
681  list TL;
682  ideal tmp = 0;
683  for (i=1; i<=sL; i++) // compute GBs of components
684  {
685    TL    = list();
686    TL[1] = std(mL[i]);
687    tmp   = NF( ideal(IM), TL[1] );
688    TL[2] = matrix(tmp, NVars,NVars);
689    L[i]  = TL;
690  }
691  export(L);
692  ideal idJ = J; // debug-comfortable exports
693  matrix matD = @@D;
694  export(idJ);
695  export(matD);
696  option(set,saveopt);
697  return(@@KK);
698}
699example
700{ "EXAMPLE:"; echo = 2;
701  def a = makeWeyl(1);
702  setring a; // this algebra is a first Weyl algebra
703  a;
704  def X = findInvoDiag();
705  setring X; // ring with new variables, corresponding to unknown coefficients
706  X;
707  // print matrices, defining linear involutions
708  print(L[1][2]);  // a first matrix: we see it is constant
709  print(L[2][2]);  // and a second possible matrix; it is constant too
710  L; // let us take a look on the whole list
711  idJ;
712}
713/////////////////////////////////////////////////////////////////////
714proc findAuto(int n)
715"USAGE: findAuto(n); n an integer
716RETURN: a ring together with a list of pairs L, where
717@*        L[i][1]  =  ideal; a Groebner Basis of an i-th associated prime,
718@*        L[i][2]  =  matrix, defining a linear map, with entries, reduced with respect to L[i][1]
719PURPOSE: compute the ideal of linear automorphisms of the basering,
720@*  given by a matrix, n-th power of which gives identity (i.e. unipotent matrix)
721ASSUME: the relations on the algebra are of the form YX = XY + D, that is
722the current ring is a G-algebra of Lie type.
723NOTE: if n=0, a matrix, defining an automorphism is not assumed to be unipotent
724@* but just non-degenerate. A nonzero parameter @code{@@p} is introduced as the value of
725@* the determinant of the matrix above.
726@* For convenience, the full ideal of relations @code{idJ} and the initial matrix with indeterminates
727@* @code{matD} are mutually exported in the output ring
728SEE ALSO: findInvo
729EXAMPLE: example findAuto; shows examples
730"{
731  if ((n<0 ) || (n==1))
732  {
733    "The index of unipotency is too small.";
734    return(0);
735  }
736
737
738  def @B    = basering; //save the name of basering
739  int NVars = nvars(@B); //number of variables in basering
740  int i, j;
741
742  // check basering is of Lie type:
743  if (!isLieType())
744  {
745    ERROR("Assume violated: basering is of non-Lie type");
746  }
747
748  matrix Rel = RelMatr(); //the matrix of relations
749
750  string @ss = new_var(); //string of new variables
751  string Par = parstr(@B); //string of parameters in old ring
752
753  if (Par=="") // if there are no parameters
754  {
755    execute("ring @@@K=0,("+varstr(@B)+","+@ss+"), dp;"); //new ring with new variables
756  }
757  else //if there exist parameters
758  {
759     execute("ring @@@K=(0,"+Par+") ,("+varstr(@B)+","+@ss+"), dp;");//new ring with new variables
760  }
761
762  matrix Rel = imap(@B, Rel); //consider the matrix of relations in new ring
763
764  int Sz = NVars*NVars+NVars; // number of variables in new ring
765
766  matrix M[Sz][Sz]; //to be the matrix of relations in new ring
767
768  for(i=1; i<NVars; i++) //initialize that matrix of relations
769  {
770    for(j=i+1; j<=NVars; j++)
771    {
772      M[i,j] = Rel[i,j];
773    }
774  }
775
776  def @@K = nc_algebra(1, M); setring @@K; //now new ring @@K become a noncommutative ring
777
778  list l; //list to define a homomorphism(isomorphism)
779  poly @@F;
780  for(i=1; i<=NVars; i++) //initializing list for involution
781  {
782    @@F=0;
783    for(j=1; j<=NVars; j++)
784    {
785      execute( "@@F = @@F+"+NVAR(i,j)+"*"+string( var(j) )+";" );
786    }
787    l=l+list(@@F);
788  }
789
790  matrix N = imap(@@@K,Rel);
791
792  for(i=1; i<NVars; i++)//get matrix by applying the homomorphism  to relations
793  {
794    for(j=i+1; j<=NVars; j++)
795    {
796      N[i,j]= l[j]*l[i] - l[i]*l[j] - Hom_Poly( N[i,j], l, NVars);
797    }
798  }
799  kill l;
800  //---------------------------------------------
801  //get the ideal of coefficients of N
802  ideal J;
803  ideal idN = simplify(ideal(N),2);
804  J = ideal(coeffs( idN, var(1) ) );
805  for(i=2; i<=NVars; i++)
806  {
807    J = ideal( coeffs( J, var(i) ) );
808  }
809  J = simplify(J,2);
810  //-------------------------------------------------
811  if (( Par=="" ) && (n!=0)) //initializes the ring of relations
812  {
813    execute("ring @@KK=0,("+@ss+"), dp;");
814  }
815  if (( Par=="" ) && (n==0)) //initializes the ring of relations
816  {
817    execute("ring @@KK=(0,@p),("+@ss+"), dp;");
818  }
819  if ( Par!="" )
820  {
821    execute("ring @@KK=(0,"+Par+"),("+@ss+"), dp;");
822  }
823  //  execute("setring @@KK;");
824  //  basering;
825  ideal J = imap(@@K,J); // ideal, considered in @@KK now
826  string snv = "["+string(NVars)+"]";
827  execute("matrix @@D"+snv+snv+"="+@ss+";"); // matrix with entries=new variables
828
829  if (n>=2)
830  {
831    J = J, ideal( @@D*@@D-matrix( freemodule(NVars) ) ); // add the condition that homomorphism to square is just identity
832  }
833  if (n==0)
834  {
835    J = J, det(@@D)-@p; // det of non-unipotent matrix is nonzero
836  }
837  J       = simplify(J,2); // without extra zeros
838  list mL = minAssGTZ(J); // components not in GB
839  int sL  = size(mL);
840  intvec saveopt=option(get);
841  option(redSB); // important for reduced GBs
842  option(redTail);
843  matrix IM = @@D; //  map
844  list L = list(); // the answer
845  list TL;
846  ideal tmp = 0;
847  for (i=1; i<=sL; i++)// compute GBs of components
848  {
849    TL    = list();
850    TL[1] = std(mL[i]);
851    tmp   = NF( ideal(IM), TL[1] );
852    TL[2] = matrix(tmp,NVars, NVars);
853    L[i]  = TL;
854  }
855  export(L);
856  ideal idJ = J; // debug-comfortable exports
857  matrix matD = @@D;
858  export(idJ);
859  export(matD);
860  option(set,saveopt);
861  return(@@KK);
862}
863example
864{ "EXAMPLE:"; echo = 2;
865  def a = makeWeyl(1);
866  setring a; // this algebra is a first Weyl algebra
867  a;
868  def X = findAuto(2);  // in contrast to findInvo look for automorphisms
869  setring X; // ring with new variables - unknown coefficients
870  X;
871  size(L); // we have (size(L)) families in the answer
872  // look at matrices, defining linear automorphisms:
873  print(L[1][2]);  // a first one: we see it is the identity
874  print(L[2][2]);  // and a second possible matrix; it is diagonal
875  // L; // we can take a look on the whole list, too
876  idJ;
877  kill X; kill a;
878  //----------- find all the linear automorphisms --------------------
879  //----------- use the call findAuto(0)          --------------------
880  ring R = 0,(x,s),dp;
881  def r = nc_algebra(1,s); setring r; // the shift algebra
882  s*x; // the only relation in the algebra is:
883  def Y = findAuto(0);
884  setring Y;
885  size(L); // here, we have 1 parametrized family
886  print(L[1][2]); // here, @p is a nonzero parameter
887  det(L[1][2]-@p);  // check whether determinante is zero
888}
889
890
891proc isAntiEndo(def F)
892"USAGE: isAntiEndo(F); F is a map from current ring to itself
893RETURN: integer, 1 if F determines an antiendomorphism of
894current ring and 0 otherwise
895ASSUME: F is a map from current ring to itself
896SEE ALSO: isInvolution, involution, findInvo
897EXAMPLE: example isAntiEndo; shows examples
898"
899{
900  // assumes:
901  // (1) F is from br to br
902  // I don't see how to check it; in case of error it will happen in the body
903  // (2) do not assume: F is linear, F is bijective
904  int n = nvars(basering);
905  int i,j;
906  poly pi,pj,q;
907  int answer=1;
908  ideal @f = ideal(F); list L=@f[1..ncols(@f)];
909  for (i=1; i<n; i++)
910  {
911    for (j=i+1; j<=n; j++)
912    {
913      // F( x_j x_i) =def= F(x_i) F(x_j)
914      pi = var(i);
915      pj = var(j);
916      //      q = involution(pj*pi,F) - F(pi)*F(pj);
917      q = In_Poly(pj*pi,L,n) - F[i]*F[j];
918      if (q!=0)
919      {
920        answer=0; return(answer);
921      }
922    }
923  }
924  return(answer);
925}
926example
927{"EXAMPLE:";echo = 2;
928  def A = makeUsl(2); setring A;
929  map I = A,-e,-f,-h; //correct antiauto involution
930  isAntiEndo(I);
931  map J = A,3*e,1/3*f,-h; // antiauto but not involution
932  isAntiEndo(J);
933  map K = A,f,e,-h; // not antiendo
934  isAntiEndo(K);
935}
936
937
938proc isInvolution(def F)
939"USAGE: isInvolution(F); F is a map from current ring to itself
940RETURN: integer, 1 if F determines an involution and 0 otherwise
941THEORY: involution is an antiautomorphism of order 2
942ASSUME: F is a map from current ring to itself
943SEE ALSO: involution, findInvo, isAntiEndo
944EXAMPLE: example isInvolution; shows examples
945"
946{
947  // does not assume: F is an antiautomorphism, can be antiendo
948  // allows to detect endos which are not autos
949  // isInvolution == ( F isAntiEndo && F(F)==id )
950  if (!isAntiEndo(F))
951  {
952    return(0);
953  }
954  //  def G = F(F);
955  int j; poly p; ideal @f = ideal(F); list L=@f[1..ncols(@f)];
956  int nv = nvars(basering);
957  for(j=nv; j>=1; j--)
958  {
959    //    p = var(j); p = F(p); p = F(p) - var(j);
960    //p = G(p) - p;
961    p = In_Poly(var(j),L,nv);
962    p = In_Poly(p,L,nv) -var(j) ;
963
964    if (p!=0)
965    {
966      return(0);
967    }
968  }
969  return(1);
970}
971example
972{"EXAMPLE:";echo = 2;
973  def A = makeUsl(2); setring A;
974  map I = A,-e,-f,-h; //correct antiauto involution
975  isInvolution(I);
976  map J = A,3*e,1/3*f,-h; // antiauto but not involution
977  isInvolution(J);
978  map K = A,f,e,-h; // not antiauto
979  isInvolution(K);
980}
Note: See TracBrowser for help on using the repository browser.