source: git/Singular/LIB/schubert.lib @ 76d26c

spielwiese
Last change on this file since 76d26c was 6ba2a39, checked in by Hans Schoenemann <hannes@…>, 11 years ago
chg: new version of schubert.lib
  • Property mode set to 100644
File size: 73.5 KB
Line 
1//////////////////////////////////////////////////////////////////////////
2version="version schubert.lib 4.0.0.0 Jun_2013 "; // $Id$
3
4category="Algebraic Geometry";
5info="
6LIBRARY:    Schubert.lib    Proceduces for Intersection Theory
7
8AUTHOR:     Hiep Dang,      email: hiep@mathematik.uni-kl.de
9
10OVERVIEW:
11
12    We implement new classes (variety, sheaf, stack, graph) and methods for
13    computing with them. Here a variety is represented by a nonnegative integer
14    which is its dimension and a graded ring which is its Chow ring. A sheaf is
15    represented by a variety and a polynomial which is its Chern character.
16    In particular, we implement the concrete varieties such as projective spaces
17    , Grassmannians, and projective bundles.
18
19<<<<<<< HEAD
20PROCEDURES:
21    makeVariety(int,ideal)            create a variety
22    productVariety(variety,variety)   product of two varieties
23    ChowRing(variety)                 create the Chow ring of a variety
24    dimension(variety)                dimension of a variety
25    relations(variety)                relations of a variety
26    Grassmannian(int,int)             create a Grassmannian as a variety
27    projectiveSpace(int)              create a projective space as a variety
28    projectiveBundle(sheaf)           create a projective bundle as a variety
29    integral(variety,poly)            degree of a 0-cycle on a variety
30    makeSheaf(variety,poly)           create a sheaf
31    ChernCharacter(sheaf)             the Chern character of a sheaf
32    totalChernClass(sheaf)            the total Chern class of a sheaf
33    ChernClass(sheaf,int)             the k-th Chern class of a sheaf
34    topChernClass(sheaf)              the top Chern class of a sheaf
35    totalSegreClass(sheaf)            the total Segre class of a sheaf
36    dualSheaf(sheaf)                  the dual of a sheaf
37    tensorSheaf(sheaf,sheaf)          the tensor of two sheaves
38    symmetricPowerSheaf(sheaf,int)    the k-th symmetric power of a sheaf
39    minusSheaf(sheaf,sheaf)           the quotient of two sheaves
40    plusSheaf(sheaf,sheaf)            the direct sum of two sheaves
41=======
42    An important task of this library is related to the computation of
43    Gromov-Witten invariants. In particular, we implement new tools for the
44    computation in equivariant intersection theory. These tools are based on the
45    localization of moduli spaces of stable maps and Bott's formula. They are
46    useful for the computation of Gromov-Witten invariants. In order to do this,
47    we have to deal with moduli spaces of stable maps, which were introduced by
48    Kontsevich, and the graphs corresponding to the fixed point components of a
49    torus action on the moduli spaces of stable maps.
50>>>>>>> 2ba3231... chg: new version of schubert.lib
51
52REFERENCES:
53
54    Hiep Dang,  Intersection theory with applications to the computation of
55                Gromov-Witten invariants, Ph.D thesis, TU Kaiserslautern, 2013.
56
57    Sheldon Katz and Stein A. Stromme, Schubert-A Maple package for intersection
58                theory and enumerative geometry, 1992.
59
60    Daniel R. Grayson, Michael E. Stillman, Stein A. Stromme, David Eisenbud and
61    Charley Crissman, Schubert2-A Macaulay2 package for computation in
62                intersection theory, 2010.
63
64    Maxim Kontsevich, Enumeration of rational curves via torus actions, 1995.
65
66PROCEDURES:
67    mod_init()                          create new objects in this library
68    makeVariety(int,ideal)              create a variety
69    printVariety(variety)               print procedure for a variety
70    productVariety(variety,variety)     make the product of two varieties
71    ChowRing(variety)                   create the Chow ring of a variety
72    Grassmannian(int,int)               create a Grassmannian as a variety
73    projectiveSpace(int)                create a projective space as a variety
74    projectiveBundle(sheaf)             create a projective bundle as a variety
75    integral(variety,poly)              degree of a 0-cycle on a variety
76    makeSheaf(variety,poly)             create a sheaf
77    printSheaf(sheaf)                   print procedure for sheaves
78    rankSheaf(sheaf)                    return the rank of a sheaf
79    totalChernClass(sheaf)              compute the total Chern class of a sheaf
80    ChernClass(sheaf,int)               compute the k-th Chern class of a sheaf
81    topChernClass(sheaf)                compute the top Chern class of a sheaf
82    totalSegreClass(sheaf)              compute the total Segre class of a sheaf
83    dualSheaf(sheaf)                    make the dual of a sheaf
84    tensorSheaf(sheaf,sheaf)            make the tensor of two sheaves
85    symmetricPowerSheaf(sheaf,int)      make the k-th symmetric power of a sheaf
86    quotSheaf(sheaf,sheaf)              make the quotient of two sheaves
87    addSheaf(sheaf,sheaf)               make the direct sum of two sheaves
88    makeGraph(list,list)                create a graph from a list of vertices
89                                        and a list of edges
90    printGraph(graph)                   print procedure for graphs
91    moduliSpace(variety,int)            create a moduli space of stable maps as
92                                        an algebraic stack
93    printStack(stack)                   print procedure for stacks
94    dimStack(stack)                     compute the dimension of a stack
95    fixedPoints(stack)                  compute the list of graphs corresponding
96                                        the fixed point components of a torus
97                                        action on the stack
98    contributionBundle(stack,graph)     compute the contribution bundle on a
99                                        stack at a graph
100    normalBundle(stack,graph)           compute the normal bundle on a stack at
101                                        a graph
102    multipleCover(int)                  compute the contribution of multiple
103                                        covers of a smooth rational curve as a
104                                        Gromov-Witten invariant
105    linesHypersurface(int)              compute the number of lines on a general
106                                        hypersurface
107    rationalCurve(int,list)             compute the Gromov-Witten invariant
108                                        corresponding the number of rational
109                                        curves on a general Calabi-Yau threefold
110    part(poly,int)                      compute a homogeneous component of a
111                                        polynomial.
112    parts(poly,int,int)                 compute the sum of homogeneous
113                                        components of a polynomial
114    logg(poly,int)                      compute Chern characters from total
115                                        Chern classes.
116    expp(poly,int)                      compute total Chern classes from Chern
117                                        characters
118    SchubertClass(list)                 compute the Schubert classes on a
119                                        Grassmannian
120    dualPartition(list)                 compute the dual of a partition
121
122KEYWORDS:       Intersection Theory; Enumerative Geometry; Schubert Calculus;
123                Bott's formula.
124
125";
126
127////////////////////////////////////////////////////////////////////////////////
128
129LIB "general.lib";
130LIB "homolog.lib";
131
132////////////////////////////////////////////////////////////////////////////////
133/////////// create new objects in this library  ////////////////////////////////
134////////////////////////////////////////////////////////////////////////////////
135
136proc mod_init()
137"USAGE:     mod_init();
138THEORY:     This is to create new objects in this library such as variety,
139            sheaf, stack, and graph.
140KEYWORDS:   variety, sheaf, stack, graph
141EXAMPLE:    example mod_init(); shows an example
142"
143{
144    newstruct("variety","int dimension, ring baseRing, ideal relations");
145    newstruct("sheaf","variety currentVariety, poly ChernCharacter");
146    newstruct("graph","list vertices, list edges");
147    newstruct("stack","variety currentVariety, int degreeCurve");
148
149    system("install","variety","print",printVariety,1);
150    system("install","variety","*",productVariety,2);
151    system("install","sheaf","print",printSheaf,1);
152    system("install","sheaf","*",tensorSheaf,2);
153    system("install","sheaf","+",addSheaf,2);
154    system("install","sheaf","-",quotSheaf,2);
155    system("install","sheaf","^",symmetricPowerSheaf,2);
156    system("install","graph","print",printGraph,1);
157    system("install","stack","print",printStack,1);
158}
159example
160{
161    "EXAMPLE:"; echo=2;
162    mod_init();
163}
164
165////////////////////////////////////////////////////////////////////////////////
166//////// Procedures concerned with moduli spaces of stable maps ////////////////
167////////////////////////////////////////////////////////////////////////////////
168
169proc printStack(stack M)
170"USAGE:     printStack(M); M stack
171ASSUME:     M is a moduli space of stable maps.
172THEORY:     This is the print function used by Singular to print a stack.
173KEYWORDS:   stack, moduli space of stable maps
174EXAMPLE:    example printStack; shows an example
175"
176{
177    "A moduli space of dimension", dimStack(M);
178}
179example
180{
181    "EXAMPLE:"; echo=2;
182    ring r = 0,(x),dp;
183    variety P = projectiveSpace(4);
184    stack M = moduliSpace(P,2);
185    M;
186}
187
188proc moduliSpace(variety V, int d)
189"USAGE:     moduliSpace(V,d); V variety, d int
190ASSUME:     V is a projective space and d is a positive integer.
191THEORY:     This is the function used by Singular to create a moduli space of
192            stable maps from a genus zero curve to a projective space.
193KEYWORDS:   stack, moduli space of stable maps, rational curves
194EXAMPLE:    example moduliSpace; shows an example
195"
196{
197    stack M;
198    M.currentVariety = V;
199    M.degreeCurve = d;
200    return(M);
201}
202example
203{
204    "EXAMPLE:"; echo=2;
205    ring r = 0,(x),dp;
206    variety P = projectiveSpace(4);
207    stack M = moduliSpace(P,2);
208    M;
209}
210
211proc dimStack(stack M)
212"USAGE:     dimStack(M); M stack
213RETURN:     int
214INPUT:      M is a moduli space of stable maps.
215OUTPUT:     the dimension of moduli space of stable maps.
216KEYWORDS:   dimension, moduli space of stable maps, rational curves
217EXAMPLE:    example dimStack; shows an example
218"
219{
220    variety V = M.currentVariety;
221    int n = V.dimension;
222    int d = M.degreeCurve;
223    return (n*d+n+d-3);
224}
225example
226{
227    "EXAMPLE:"; echo=2;
228    ring r = 0,(x),dp;
229    variety P = projectiveSpace(4);
230    stack M = moduliSpace(P,2);
231    dimStack(M);
232}
233
234proc fixedPoints(stack M)
235"USAGE:     fixedPoints(M); M stack
236RETURN:     list
237INPUT:      M is a moduli space of stable maps.
238OUTPUT:     a list of graphs corresponding the fixed point components of a torus
239            action on a moduli space of stable maps.
240KEYWORDS:   fixed points, moduli space of stable maps, graph
241EXAMPLE:    example fixedPoints; shows an example
242"
243{
244    int i,j,k,h,m,n,p;
245    list l;
246    int d = M.degreeCurve;
247    variety V = M.currentVariety;
248    int r = V.dimension;
249    for (i=0;i<=r;i++)
250    {
251        for (j=0;j<=r;j++)
252        {
253            if (i <> j)
254            {
255                l = insert(l,list(graph1(d,i,j),2*d),size(l));
256            }
257        }
258    }
259    if (d == 2)
260    {
261        for (i=0;i<=r;i++)
262        {
263            for (j=0;j<=r;j++)
264            {
265                for (k=0;k<=r;k++)
266                {
267                    if (i <> j and j <> k)
268                    {
269                        l = insert(l,list(graph2(list(1,1),i,j,k),2),size(l));
270                    }
271                }
272            }
273        }
274    }
275    if (d == 3)
276    {
277        for (i=0;i<=r;i++)
278        {
279            for (j=0;j<=r;j++)
280            {
281                for (k=0;k<=r;k++)
282                {
283                    if (i <> j and j <> k)
284                    {
285                        l = insert(l,list(graph2(list(2,1),i,j,k),2),size(l));
286                        for (h=0;h<=r;h++)
287                        {
288                            if (h <> k)
289                            {
290                                l = insert(l,list(graph31(list(1,1,1),i,j,k,h),2),size(l));
291                            }
292                            if (h <> j)
293                            {
294                                l = insert(l,list(graph32(list(1,1,1),i,j,k,h),6),size(l));
295                            }
296                        }
297                    }
298                }
299            }
300        }
301    }
302    if (d == 4)
303    {
304        for (i=0;i<=r;i++)
305        {
306            for (j=0;j<=r;j++)
307            {
308                for (k=0;k<=r;k++)
309                {
310                    if (i <> j and j <> k)
311                    {
312                        l = insert(l,list(graph2(list(3,1),i,j,k),3),size(l));
313                        l = insert(l,list(graph2(list(2,2),i,j,k),8),size(l));
314                        for (h=0;h<=r;h++)
315                        {
316                            if (h <> k)
317                            {
318                                l = insert(l,list(graph31(list(2,1,1),i,j,k,h),2),size(l));
319                                l = insert(l,list(graph31(list(1,2,1),i,j,k,h),4),size(l));
320                            }
321                            if (h <> j)
322                            {
323                                l = insert(l,list(graph32(list(2,1,1),i,j,k,h),4),size(l));
324                            }
325                            for (m=0;m<=r;m++)
326                            {
327                                if (k <> h and m <> h)
328                                {
329                                    l = insert(l,list(graph41(list(1,1,1,1),i,j,k,h,m),2),size(l));
330                                }
331                                if (k <> h and m <> k)
332                                {
333                                    l = insert(l,list(graph42(list(1,1,1,1),i,j,k,h,m),2),size(l));
334                                }
335                                if (h <> j and m <> j)
336                                {
337                                    l = insert(l,list(graph43(list(1,1,1,1),i,j,k,h,m),24),size(l));
338                                }
339                            }
340                        }
341                    }
342                }
343            }
344        }
345    }
346    if (d == 5)
347    {
348        for (i=0;i<=r;i++)
349        {
350            for (j=0;j<=r;j++)
351            {
352                for (k=0;k<=r;k++)
353                {
354                    if (i <> j and j <> k)
355                    {
356                        l = insert(l,list(graph2(list(4,1),i,j,k),4),size(l));
357                        l = insert(l,list(graph2(list(3,2),i,j,k),6),size(l));
358                        for (h=0;h<=r;h++)
359                        {
360                            if (k <> h)
361                            {
362                                l = insert(l,list(graph31(list(3,1,1),i,j,k,h),3),size(l));
363                                l = insert(l,list(graph31(list(1,3,1),i,j,k,h),6),size(l));
364                                l = insert(l,list(graph31(list(2,2,1),i,j,k,h),4),size(l));
365                                l = insert(l,list(graph31(list(2,1,2),i,j,k,h),8),size(l));
366                            }
367                            if (j <> h)
368                            {
369                                l = insert(l,list(graph32(list(3,1,1),i,j,k,h),6),size(l));
370                                l = insert(l,list(graph32(list(2,2,1),i,j,k,h),8),size(l));
371                            }
372                            for (m=0;m<=r;m++)
373                            {
374                                if (k <> h and h <> m)
375                                {
376                                    l = insert(l,list(graph41(list(2,1,1,1),i,j,k,h,m),2),size(l));
377                                    l = insert(l,list(graph41(list(1,2,1,1),i,j,k,h,m),2),size(l));
378                                }
379                                if (k <> h and k <> m)
380                                {
381                                    l = insert(l,list(graph42(list(2,1,1,1),i,j,k,h,m),4),size(l));
382                                    l = insert(l,list(graph42(list(1,2,1,1),i,j,k,h,m),4),size(l));
383                                    l = insert(l,list(graph42(list(1,1,2,1),i,j,k,h,m),2),size(l));
384                                }
385                                if (j <> h and j <> m)
386                                {
387                                    l = insert(l,list(graph43(list(2,1,1,1),i,j,k,h,m),12),size(l));
388                                }
389                                for (n=0;n<=r;n++)
390                                {
391                                    if (k <> h and h <> m and m <> n)
392                                    {
393                                        l = insert(l,list(graph51(list(1,1,1,1,1),i,j,k,h,m,n),2),size(l));
394                                    }
395                                    if (k <> h and h <> m and h <> n)
396                                    {
397                                        l = insert(l,list(graph52(list(1,1,1,1,1),i,j,k,h,m,n),2),size(l));
398                                    }
399                                    if (k <> h and k <> m and k <> n)
400                                    {
401                                        l = insert(l,list(graph53(list(1,1,1,1,1),i,j,k,h,m,n),6),size(l));
402                                    }
403                                    if (j <> h and h <> m and h <> n)
404                                    {
405                                        l = insert(l,list(graph54(list(1,1,1,1,1),i,j,k,h,m,n),8),size(l));
406                                    }
407                                    if (k <> h and k <> m and h <> n)
408                                    {
409                                        l = insert(l,list(graph55(list(1,1,1,1,1),i,j,k,h,m,n),2),size(l));
410                                    }
411                                    if (j <> h and j <> m and j <> n)
412                                    {
413                                        l = insert(l,list(graph56(list(1,1,1,1,1),i,j,k,h,m,n),120),size(l));
414                                    }
415                                }
416                            }
417                        }
418                    }
419                }
420            }
421        }
422    }
423    if (d == 6)
424    {
425        for (i=0;i<=r;i++)
426        {
427            for (j=0;j<=r;j++)
428            {
429                for (k=0;k<=r;k++)
430                {
431                    if (i <> j and j <> k)
432                    {
433                        l = insert(l,list(graph2(list(5,1),i,j,k),5),size(l));
434                        l = insert(l,list(graph2(list(4,2),i,j,k),8),size(l));
435                        l = insert(l,list(graph2(list(3,3),i,j,k),18),size(l));
436                        for (h=0;h<=r;h++)
437                        {
438                            if (k <> h)
439                            {
440                                l = insert(l,list(graph31(list(4,1,1),i,j,k,h),4),size(l));
441                                l = insert(l,list(graph31(list(1,4,1),i,j,k,h),8),size(l));
442                                l = insert(l,list(graph31(list(3,2,1),i,j,k,h),6),size(l));
443                                l = insert(l,list(graph31(list(3,1,2),i,j,k,h),6),size(l));
444                                l = insert(l,list(graph31(list(1,3,2),i,j,k,h),6),size(l));
445                                l = insert(l,list(graph31(list(2,2,2),i,j,k,h),16),size(l));
446                            }
447                            if (j <> h)
448                            {
449                                l = insert(l,list(graph32(list(4,1,1),i,j,k,h),8),size(l));
450                                l = insert(l,list(graph32(list(3,2,1),i,j,k,h),6),size(l));
451                                l = insert(l,list(graph32(list(2,2,2),i,j,k,h),48),size(l));
452                            }
453                            for (m=0;m<=r;m++)
454                            {
455                                if (k <> h and h <> m)
456                                {
457                                    l = insert(l,list(graph41(list(3,1,1,1),i,j,k,h,m),3),size(l));
458                                    l = insert(l,list(graph41(list(1,3,1,1),i,j,k,h,m),3),size(l));
459                                    l = insert(l,list(graph41(list(2,2,1,1),i,j,k,h,m),4),size(l));
460                                    l = insert(l,list(graph41(list(2,1,2,1),i,j,k,h,m),4),size(l));
461                                    l = insert(l,list(graph41(list(2,1,1,2),i,j,k,h,m),8),size(l));
462                                    l = insert(l,list(graph41(list(1,2,2,1),i,j,k,h,m),8),size(l));
463                                }
464                                if (k <> h and k <> m)
465                                {
466                                    l = insert(l,list(graph42(list(3,1,1,1),i,j,k,h,m),6),size(l));
467                                    l = insert(l,list(graph42(list(1,3,1,1),i,j,k,h,m),6),size(l));
468                                    l = insert(l,list(graph42(list(1,1,3,1),i,j,k,h,m),3),size(l));
469                                    l = insert(l,list(graph42(list(2,2,1,1),i,j,k,h,m),8),size(l));
470                                    l = insert(l,list(graph42(list(1,1,2,2),i,j,k,h,m),8),size(l));
471                                    l = insert(l,list(graph42(list(2,1,2,1),i,j,k,h,m),4),size(l));
472                                    l = insert(l,list(graph42(list(1,2,2,1),i,j,k,h,m),4),size(l));
473                                }
474                                if (j <> h and j <> m)
475                                {
476                                    l = insert(l,list(graph43(list(3,1,1,1),i,j,k,h,m),18),size(l));
477                                    l = insert(l,list(graph43(list(2,2,1,1),i,j,k,h,m),16),size(l));
478                                }
479                                for (n=0;n<=r;n++)
480                                {
481                                    if (k <> h and h <> m and m <> n)
482                                    {
483                                        l = insert(l,list(graph51(list(2,1,1,1,1),i,j,k,h,m,n),2),size(l));
484                                        l = insert(l,list(graph51(list(1,2,1,1,1),i,j,k,h,m,n),2),size(l));
485                                        l = insert(l,list(graph51(list(1,1,2,1,1),i,j,k,h,m,n),4),size(l));
486                                    }
487                                    if (k <> h and h <> m and h <> n)
488                                    {
489                                        l = insert(l,list(graph52(list(2,1,1,1,1),i,j,k,h,m,n),4),size(l));
490                                        l = insert(l,list(graph52(list(1,2,1,1,1),i,j,k,h,m,n),4),size(l));
491                                        l = insert(l,list(graph52(list(1,1,2,1,1),i,j,k,h,m,n),4),size(l));
492                                        l = insert(l,list(graph52(list(1,1,1,2,1),i,j,k,h,m,n),2),size(l));
493                                    }
494                                    if (k <> h and k <> m and k <> n)
495                                    {
496                                        l = insert(l,list(graph53(list(2,1,1,1,1),i,j,k,h,m,n),12),size(l));
497                                        l = insert(l,list(graph53(list(1,2,1,1,1),i,j,k,h,m,n),12),size(l));
498                                        l = insert(l,list(graph53(list(1,1,2,1,1),i,j,k,h,m,n),4),size(l));
499                                    }
500                                    if (j <> h and h <> m and h <> n)
501                                    {
502                                        l = insert(l,list(graph54(list(2,1,1,1,1),i,j,k,h,m,n),4),size(l));
503                                        l = insert(l,list(graph54(list(1,1,2,1,1),i,j,k,h,m,n),16),size(l));
504                                    }
505                                    if (k <> h and k <> m and h <> n)
506                                    {
507                                        l = insert(l,list(graph55(list(2,1,1,1,1),i,j,k,h,m,n),2),size(l));
508                                        l = insert(l,list(graph55(list(1,2,1,1,1),i,j,k,h,m,n),2),size(l));
509                                        l = insert(l,list(graph55(list(1,1,1,2,1),i,j,k,h,m,n),4),size(l));
510                                    }
511                                    if (j <> h and j <> m and j <> n)
512                                    {
513                                        l = insert(l,list(graph56(list(2,1,1,1,1),i,j,k,h,m,n),48),size(l));
514                                    }
515                                    for (p=0;p<=r;p++)
516                                    {
517                                        if (k <> h and h <> m and m <> n and n <> p)
518                                        {
519                                            l = insert(l,list(graph61(list(1,1,1,1,1,1),i,j,k,h,m,n,p),2),size(l));
520                                        }
521                                        if (k <> h and h <> m and m <> n and m <> p)
522                                        {
523                                            l = insert(l,list(graph62(list(1,1,1,1,1,1),i,j,k,h,m,n,p),2),size(l));
524                                        }
525                                        if (k <> h and h <> m and h <> n and n <> p)
526                                        {
527                                            l = insert(l,list(graph63(list(1,1,1,1,1,1),i,j,k,h,m,n,p),1),size(l));
528                                        }
529                                        if (k <> h and h <> m and h <> n and h <> p)
530                                        {
531                                            l = insert(l,list(graph64(list(1,1,1,1,1,1),i,j,k,h,m,n,p),6),size(l));
532                                        }
533                                        if (k <> h and k <> m and k <> n and n <> p)
534                                        {
535                                            l = insert(l,list(graph65(list(1,1,1,1,1,1),i,j,k,h,m,n,p),4),size(l));
536                                        }
537                                        if (k <> h and k <> m and m <> p and h <> n)
538                                        {
539                                            l = insert(l,list(graph66(list(1,1,1,1,1,1),i,j,k,h,m,n,p),6),size(l));
540                                        }
541                                        if (j <> h and h <> m and m <> n and m <> p)
542                                        {
543                                            l = insert(l,list(graph67(list(1,1,1,1,1,1),i,j,k,h,m,n,p),8),size(l));
544                                        }
545                                        if (j <> h and h <> m and h <> n and h <> p)
546                                        {
547                                            l = insert(l,list(graph68(list(1,1,1,1,1,1),i,j,k,h,m,n,p),12),size(l));
548                                        }
549                                        if (j <> h and h <> m and h <> n and n <> p)
550                                        {
551                                            l = insert(l,list(graph69(list(1,1,1,1,1,1),i,j,k,h,m,n,p),2),size(l));
552                                        }
553                                        if (k <> h and k <> m and k <> n and k <> p)
554                                        {
555                                            l = insert(l,list(graph610(list(1,1,1,1,1,1),i,j,k,h,m,n,p),24),size(l));
556                                        }
557                                        if (j <> h and j <> m and j <> n and j <> p)
558                                        {
559                                            l = insert(l,list(graph611(list(1,1,1,1,1,1),i,j,k,h,m,n,p),720),size(l));
560                                        }
561                                    }
562                                }
563                            }
564                        }
565                    }
566                }
567            }
568        }
569    }
570    return (l);
571}
572example
573{
574    "EXAMPLE:"; echo=2;
575    ring r = 0,(x),dp;
576    variety P = projectiveSpace(4);
577    stack M = moduliSpace(P,2);
578    def F = fixedPoints(M);
579    size(F);
580    typeof(F[1]) == "list";
581    typeof(F[1][1]) == "graph";
582    typeof(F[1][2]) == "int";
583}
584
585static proc torusList(variety P)
586"USAGE:     torusList(P); P variety
587RETURN:     list
588INPUT:      P is a projective space
589OUTPUT:     a list of numbers
590THEORY:     This is a procedure concerning the enumeration of rational curves.
591KEYWORDS:   torus action
592EXAMPLE:    example torusList; shows an example
593"
594{
595    int i;
596    int n = P.dimension;
597    list l;
598    for (i=0;i<=n;i++)
599    {
600        l = insert(l,number(5^i),size(l));
601    }
602    return (l);
603}
604example
605{
606    "EXAMPLE:"; echo=2;
607    ring r = 0,(x),dp;
608    variety P = projectiveSpace(4);
609    def L = torusList(P);
610    L;
611}
612
613proc contributionBundle(stack M, graph G, list #)
614"USAGE:     contributionBundle(M,G,#); M stack, G graph, # list
615RETURN:     number
616INPUT:      M is a moduli space of stable maps, G is a graph, # is a list.
617OUTPUT:     a number corresponding to the contribution bundle on a moduli space
618            of stable maps at a fixed point component (graph)
619KEYWORDS:   contribution bundle, graph, multiple cover, rational curve,
620SEE ALSO:   normalBundle
621EXAMPLE:    example contributionBundle; shows an example
622"
623{
624    def R = basering;
625    setring R;
626    int i,j,a;
627    variety P = M.currentVariety;
628    def L = torusList(P);
629    int r = P.dimension;
630    int d;
631    if (size(#)==0) {d = 2*r - 3;}
632    else
633    {
634        if (typeof(#[1]) == "int") {d = #[1];}
635        else {Error("invalid optional argument");}
636    }
637    list e = G.edges;
638    list v = G.vertices;
639    number E = 1;
640    number V = 1;
641    if (r == 1)
642    {
643        for (i=1;i<=size(v);i++)
644        {
645            V = V*(-L[v[i][1]+1])^(v[i][2]-1);
646        }
647        for (j=1;j<=size(e);j++)
648        {
649            number f = 1;
650            if (e[j][3]<>1)
651            {
652                for (a=1;a<e[j][3];a++)
653                {
654                    f=f*(-a*L[e[j][1]+1]-(e[j][3]-a)*L[e[j][2]+1])/e[j][3];
655                }
656            }
657            E = E*f;
658            kill f;
659        }
660        return ((E*V)^2);
661    }
662    else
663    {
664        for (i=1;i<=size(v);i++)
665        {
666            V = V*((d*L[v[i][1]+1])^(v[i][2]-1));
667        }
668        for (j=1;j<=size(e);j++)
669        {
670            number f = 1;
671            for (a=0;a<=d*e[j][3];a++)
672            {
673                f = f*((a*L[e[j][1]+1]+(d*e[j][3]-a)*L[e[j][2]+1])/e[j][3]);
674            }
675            E = E*f;
676            kill f;
677        }
678        return (E/V);
679    }
680}
681example
682{
683    "EXAMPLE:"; echo=2;
684    ring r = 0,(x),dp;
685    variety P = projectiveSpace(4);
686    stack M = moduliSpace(P,2);
687    def F = fixedPoints(M);
688    graph G = F[1][1];
689    number f = contributionBundle(M,G);
690    number g = contributionBundle(M,G,5);
691    f == g;
692}
693
694proc normalBundle(stack M, graph G)
695"USAGE:     normalBundle(M,G); M stack, G graph
696RETURN:     number
697INPUT:      M is a moduli space of stable maps, G is a graph
698OUTPUT:     a number corresponding to the normal bundle on a moduli space of
699            stable maps at a graph
700KEYWORDS:   normal bundle, graph, rational curves, mutiple covers, lines on
701            hypersurfaces
702SEE ALSO:   contributionBundle
703EXAMPLE:    example normalBundle; shows an example
704{
705    def R = basering;
706    setring R;
707    variety P = M.currentVariety;
708    def L = torusList(P);
709    int n = P.dimension;
710    list e = G.edges;
711    list v = G.vertices;
712    int i,j,k,h,b,m,a;
713    number N = 1;
714    for (j=1;j<=size(e);j++)
715    {
716        int d = e[j][3];
717        number c = (-1)^d*factorial(d)^2;
718        number y = c*(L[e[j][1]+1]-L[e[j][2]+1])^(2*d)/(d^(2*d));
719        for (k=0;k<=n;k++)
720        {
721            if (k <> e[j][1] and k <> e[j][2])
722            {
723                for (a=0;a<=d;a++)
724                {
725                    y=y*((a*L[e[j][1]+1]+(d-a)*L[e[j][2]+1])/d - L[k+1]);
726                }
727            }
728        }
729        N = N*y;
730        kill y,d,c;
731    }
732    for (i=1;i<=size(v);i++)
733    {
734        number F = 1;
735        for (h=3;h<=size(v[i]);h++)
736        {
737            F = F*(L[v[i][h][1]+1]-L[v[i][h][2]+1])/v[i][h][3];
738        }
739        if (v[i][2] == 1)
740        {
741            N = N/F;
742            kill F;
743        }
744        else
745        {
746            number z = 1;
747            for (m=0;m<=n;m++)
748            {
749                if (m<>v[i][1])
750                {
751                    z = z*(L[v[i][1]+1]-L[m+1]);
752                }
753            }
754            if (v[i][2] == 3)
755            {
756                N = N*F/z^2;
757                kill F,z;
758            }
759            else
760            {
761                number g = 0;
762                for (b=3;b<=size(v[i]);b++)
763                {
764                    g = g + v[i][b][3]/(L[v[i][b][1]+1]-L[v[i][b][2]+1]);
765                }
766                N = N*F*g^(3-v[i][2])/(z^(v[i][2]-1));
767                kill g,F,z;
768            }
769        }
770    }
771    return (N);
772}
773example
774{
775    "EXAMPLE:"; echo=2;
776    ring r = 0,(x),dp;
777    variety P = projectiveSpace(4);
778    stack M = moduliSpace(P,2);
779    def F = fixedPoints(M);
780    graph G = F[1][1];
781    number f = normalBundle(M,G);
782    f <> 0;
783}
784
785proc multipleCover(int d)
786"USAGE:     multipleCover(d); d int
787RETURN:     number
788THEORY:     This is the contribution of degree d multiple covers of a smooth
789            rational curve as a Gromov-Witten invariant.
790KEYWORDS:   Gromov-Witten invariants, multiple covers
791SEE ALSO:   rationalCurve, linesHypersurface
792EXAMPLE:    example multipleCover; shows an example
793"
794{
795    def R = basering;
796    setring R;
797    variety P = projectiveSpace(1);
798    stack M = moduliSpace(P,d);
799    def F = fixedPoints(M);
800    int i;
801    number r = 0;
802    for (i=1;i<=size(F);i++)
803    {
804        graph G = F[i][1];
805        number s = contributionBundle(M,G);
806        number t = F[i][2]*normalBundle(M,G);
807        r = r + s/t;
808        kill s,t,G;
809    }
810    return (r);
811}
812example
813{
814    "EXAMPLE:"; echo=2;
815    ring r = 0,(x),dp;
816    multipleCover(1);
817    multipleCover(2);
818    multipleCover(3);
819    multipleCover(4);
820    multipleCover(5);
821}
822
823proc linesHypersurface(int n)
824"USAGE:     linesHypersurface(n); n int
825RETURN:     number
826THEORY:     This is the number of lines on a general hypersurface of degree
827            d = 2n-3 in an n-dimensional projective space.
828KEYWORDS:   Gromov-Witten invariants, lines on hypersurfaces
829SEE ALSO:   linesHypersurface, multipleCover
830EXAMPLE:    example linesHypersurface; shows an example
831"
832{
833    def R = basering;
834    setring R;
835    variety P = projectiveSpace(n);
836    stack M = moduliSpace(P,1);
837    def F = fixedPoints(M);
838    int i;
839    poly r = 0;
840    for (i=1;i<=size(F);i++)
841    {
842        graph G = F[i][1];
843        number s = contributionBundle(M,G);
844        number t = F[i][2]*normalBundle(M,G);
845        r = r + s/t;
846        kill s,t,G;
847    }
848    return (r);
849}
850example
851{
852    "EXAMPLE:"; echo=2;
853    ring r = 0,(x),dp;
854    linesHypersurface(2);
855    linesHypersurface(3);
856    linesHypersurface(4);
857    linesHypersurface(5);
858    linesHypersurface(6);
859    linesHypersurface(7);
860    linesHypersurface(8);
861    linesHypersurface(9);
862    linesHypersurface(10);
863}
864
865proc rationalCurve(int d, list #)
866"USAGE:     rationalCurve(d,#); d int, # list
867RETURN:     number
868THEORY:     This is the Gromov-Witten invariant corresponding the number of
869            rational curves on a general Calabi-Yau threefold.
870KEYWORDS:   Gromov-Witten invariants, rational curves on Calabi-Yau threefolds
871SEE ALSO:   linesHypersurface, multipleCover
872EXAMPLE:    example rationalCurve; shows an example
873"
874{
875    def R = basering;
876    setring R;
877    int n,i,j;
878    if (size(#) == 0) {n = 4; list l = 5;}
879    else {n = size(#)+3; list l = #;}
880    variety P = projectiveSpace(n);
881    stack M = moduliSpace(P,d);
882    def F = fixedPoints(M);
883    number r = 0;
884    for (i=1;i<=size(F);i++)
885    {
886        graph G = F[i][1];
887        number s = 1;
888        for (j=1;j<=size(l);j++)
889        {
890            s = s*contributionBundle(M,G,list(l[j]));
891        }
892        number t = F[i][2]*normalBundle(M,G);
893        r = r + s/t;
894        kill s,t,G;
895    }
896    return (r);
897}
898example
899{
900    "EXAMPLE:"; echo=2;
901    ring r = 0,(x),dp;
902    rationalCurve(1);
903    /*
904    rationalCurve(2);
905    rationalCurve(3);
906    rationalCurve(4);
907    rationalCurve(5);
908    rationalCurve(1,list(4,2));
909    rationalCurve(1,list(3,3));
910    rationalCurve(1,list(3,2,2));
911    rationalCurve(1,list(2,2,2,2));
912    rationalCurve(2,list(4,2));
913    rationalCurve(2,list(3,3));
914    rationalCurve(2,list(3,2,2));
915    rationalCurve(2,list(2,2,2,2));
916    rationalCurve(3,list(4,2));
917    rationalCurve(3,list(3,3));
918    rationalCurve(3,list(3,2,2));
919    rationalCurve(3,list(2,2,2,2));
920    rationalCurve(4,list(4,2));
921    rationalCurve(4,list(3,3));
922    rationalCurve(4,list(3,2,2));
923    rationalCurve(4,list(2,2,2,2));
924    rationalCurve(5,list(4,2));
925    rationalCurve(5,list(3,3));
926    rationalCurve(5,list(3,2,2));
927    rationalCurve(5,list(2,2,2,2));
928    */
929}
930
931////////////////////////////////////////////////////////////////////////////////
932/////////// Procedures concerned with graphs ///////////////////////////////////
933////////////////////////////////////////////////////////////////////////////////
934
935proc printGraph(graph G)
936"USAGE:     printGraph(G); G graph
937ASSUME:     G is a graph.
938THEORY:     This is the print function used by Singular to print a graph.
939KEYWORDS:   graph
940EXAMPLE:    example printGraph; shows an example
941"
942{
943    "A graph with", size(G.vertices), "vertices and", size(G.edges), "edges";
944}
945example
946{
947    "EXAMPLE:"; echo=2;
948    ring R=(0,x1,x2,x3,x4),(q1,q2,q3,q4,q5,q6),dp;
949    graph G = makeGraph(list(list(0,1,list(0,1,2)),list(1,1,list(1,0,2))),
950    list(list(0,1,2)));
951    G;
952}
953
954proc makeGraph(list v, list e)
955"USAGE:     makeGraph(v,e); v list, e list
956ASSUME:     v is a list of vertices, e is a list of edges.
957RETURN:     graph with vertices v and edges e.
958THEORY:     Creates a graph from a list of vertices and edges.
959KEYWORDS:   graph
960EXAMPLE:    example makeGraph; shows an example
961{
962    graph G;
963    G.vertices = v;
964    G.edges = e;
965    return(G);
966}
967example
968{
969    "EXAMPLE:"; echo=2;
970    ring R=(0,x1,x2,x3,x4),(q1,q2,q3,q4,q5,q6),dp;
971    graph G = makeGraph(list(list(0,1,list(0,1,2)),list(1,1,list(1,0,2))),
972    list(list(0,1,2)));
973    G;
974}
975
976static proc graph1(int d, int i, int j)
977{
978    graph G;
979    list f1 = i,j,d;
980    list f2 = j,i,d;
981    list v1 = i,1,f1;
982    list v2 = j,1,f2;
983    G.vertices = v1,v2;
984    G.edges = list(f1);
985    return (G);
986}
987
988static proc graph2(list d, int i, int j, int k)
989{
990    graph G;
991    list f1 = i,j,d[1];
992    list f2 = j,i,d[1];
993    list f3 = j,k,d[2];
994    list f4 = k,j,d[2];
995    list v1 = i,1,f1;
996    list v2 = j,2,f2,f3;
997    list v3 = k,1,f4;
998    G.vertices = v1,v2,v3;
999    G.edges = f1,f3;
1000    return (G);
1001}
1002
1003static proc graph31(list d, int i, int j, int k, int h)
1004{
1005    graph G;
1006    list f1 = i,j,d[1];
1007    list f2 = j,i,d[1];
1008    list f3 = j,k,d[2];
1009    list f4 = k,j,d[2];
1010    list f5 = k,h,d[3];
1011    list f6 = h,k,d[3];
1012    list v1 = i,1,f1;
1013    list v2 = j,2,f2,f3;
1014    list v3 = k,2,f4,f5;
1015    list v4 = h,1,f6;
1016    G.vertices = v1,v2,v3,v4;
1017    G.edges = f1,f3,f5;
1018    return (G);
1019}
1020
1021static proc graph32(list d, int i, int j, int k, int h)
1022{
1023    graph G;
1024    list f1 = i,j,d[1];
1025    list f2 = j,i,d[1];
1026    list f3 = j,k,d[2];
1027    list f4 = j,h,d[3];
1028    list f5 = k,j,d[2];
1029    list f6 = h,j,d[3];
1030    list v1 = i,1,f1;
1031    list v2 = j,3,f2,f3,f4;
1032    list v3 = k,1,f5;
1033    list v4 = h,1,f6;
1034    G.vertices = v1,v2,v3,v4;
1035    G.edges = f1,f3,f4;
1036    return (G);
1037}
1038
1039static proc graph41(list d, int i, int j, int k, int h, int l)
1040{
1041    graph G;
1042    list f1 = i,j,d[1];
1043    list f2 = j,i,d[1];
1044    list f3 = j,k,d[2];
1045    list f4 = k,j,d[2];
1046    list f5 = k,h,d[3];
1047    list f6 = h,k,d[3];
1048    list f7 = h,l,d[4];
1049    list f8 = l,h,d[4];
1050    list v1 = i,1,f1;
1051    list v2 = j,2,f2,f3;
1052    list v3 = k,2,f4,f5;
1053    list v4 = h,2,f6,f7;
1054    list v5 = l,1,f8;
1055    G.vertices = v1,v2,v3,v4,v5;
1056    G.edges = f1,f3,f5,f7;
1057    return (G);
1058}
1059
1060static proc graph42(list d, int i, int j, int k, int h, int l)
1061{
1062    graph G;
1063    list f1 = i,j,d[1];
1064    list f2 = j,i,d[1];
1065    list f3 = j,k,d[2];
1066    list f4 = k,j,d[2];
1067    list f5 = k,h,d[3];
1068    list f6 = k,l,d[4];
1069    list f7 = h,k,d[3];
1070    list f8 = l,k,d[4];
1071    list v1 = i,1,f1;
1072    list v2 = j,2,f2,f3;
1073    list v3 = k,3,f4,f5,f6;
1074    list v4 = h,1,f7;
1075    list v5 = l,1,f8;
1076    G.vertices = v1,v2,v3,v4,v5;
1077    G.edges = f1,f3,f5,f6;
1078    return (G);
1079}
1080
1081static proc graph43(list d, int i, int j, int k, int h, int l)
1082{
1083    graph G;
1084    list f1 = i,j,d[1];
1085    list f2 = j,i,d[1];
1086    list f3 = j,k,d[2];
1087    list f4 = j,h,d[3];
1088    list f5 = j,l,d[4];
1089    list f6 = k,j,d[2];
1090    list f7 = h,j,d[3];
1091    list f8 = l,j,d[4];
1092    list v1 = i,1,f1;
1093    list v2 = j,4,f2,f3,f4,f5;
1094    list v3 = k,1,f6;
1095    list v4 = h,1,f7;
1096    list v5 = l,1,f8;
1097    G.vertices = v1,v2,v3,v4,v5;
1098    G.edges = f1,f3,f4,f5;
1099    return (G);
1100}
1101
1102static proc graph51(list d, int i, int j, int k, int h, int m, int n)
1103{
1104    graph G;
1105    list f1 = i,j,d[1];
1106    list f2 = j,i,d[1];
1107    list f3 = j,k,d[2];
1108    list f4 = k,j,d[2];
1109    list f5 = k,h,d[3];
1110    list f6 = h,k,d[3];
1111    list f7 = h,m,d[4];
1112    list f8 = m,h,d[4];
1113    list f9 = m,n,d[5];
1114    list f10 = n,m,d[5];
1115    list v1 = i,1,f1;
1116    list v2 = j,2,f2,f3;
1117    list v3 = k,2,f4,f5;
1118    list v4 = h,2,f6,f7;
1119    list v5 = m,2,f8,f9;
1120    list v6 = n,1,f10;
1121    G.vertices = v1,v2,v3,v4,v5,v6;
1122    G.edges = f1,f3,f5,f7,f9;
1123    return (G);
1124}
1125
1126static proc graph52(list d, int i, int j, int k, int h, int m, int n)
1127{
1128    graph G;
1129    list f1 = i,j,d[1];
1130    list f2 = j,i,d[1];
1131    list f3 = j,k,d[2];
1132    list f4 = k,j,d[2];
1133    list f5 = k,h,d[3];
1134    list f6 = h,k,d[3];
1135    list f7 = h,m,d[4];
1136    list f8 = m,h,d[4];
1137    list f9 = h,n,d[5];
1138    list f10 = n,h,d[5];
1139    list v1 = i,1,f1;
1140    list v2 = j,2,f2,f3;
1141    list v3 = k,2,f4,f5;
1142    list v4 = h,3,f6,f7,f9;
1143    list v5 = m,1,f8;
1144    list v6 = n,1,f10;
1145    G.vertices = v1,v2,v3,v4,v5,v6;
1146    G.edges = f1,f3,f5,f7,f9;
1147    return (G);
1148}
1149
1150static proc graph53(list d, int i, int j, int k, int h, int m, int n)
1151{
1152    graph G;
1153    list f1 = i,j,d[1];
1154    list f2 = j,i,d[1];
1155    list f3 = j,k,d[2];
1156    list f4 = k,j,d[2];
1157    list f5 = k,h,d[3];
1158    list f6 = h,k,d[3];
1159    list f7 = k,m,d[4];
1160    list f8 = m,k,d[4];
1161    list f9 = k,n,d[5];
1162    list f10 = n,k,d[5];
1163    list v1 = i,1,f1;
1164    list v2 = j,2,f2,f3;
1165    list v3 = k,4,f4,f5,f7,f9;
1166    list v4 = h,1,f6;
1167    list v5 = m,1,f8;
1168    list v6 = n,1,f10;
1169    G.vertices = v1,v2,v3,v4,v5,v6;
1170    G.edges = f1,f3,f5,f7,f9;
1171    return (G);
1172}
1173
1174static proc graph54(list d, int i, int j, int k, int h, int m, int n)
1175{
1176    graph G;
1177    list f1 = i,j,d[1];
1178    list f2 = j,i,d[1];
1179    list f3 = j,k,d[2];
1180    list f4 = k,j,d[2];
1181    list f5 = j,h,d[3];
1182    list f6 = h,j,d[3];
1183    list f7 = h,m,d[4];
1184    list f8 = m,h,d[4];
1185    list f9 = h,n,d[5];
1186    list f10 = n,h,d[5];
1187    list v1 = i,1,f1;
1188    list v2 = j,3,f2,f3,f5;
1189    list v3 = k,1,f4;
1190    list v4 = h,3,f6,f7,f9;
1191    list v5 = m,1,f8;
1192    list v6 = n,1,f10;
1193    G.vertices = v1,v2,v3,v4,v5,v6;
1194    G.edges = f1,f3,f5,f7,f9;
1195    return (G);
1196}
1197
1198static proc graph55(list d, int i, int j, int k, int h, int m, int n)
1199{
1200    graph G;
1201    list f1 = i,j,d[1];
1202    list f2 = j,i,d[1];
1203    list f3 = j,k,d[2];
1204    list f4 = k,j,d[2];
1205    list f5 = k,h,d[3];
1206    list f6 = h,k,d[3];
1207    list f7 = k,m,d[4];
1208    list f8 = m,k,d[4];
1209    list f9 = h,n,d[5];
1210    list f10 = n,h,d[5];
1211    list v1 = i,1,f1;
1212    list v2 = j,2,f2,f3;
1213    list v3 = k,3,f4,f5,f7;
1214    list v4 = h,2,f6,f9;
1215    list v5 = m,1,f8;
1216    list v6 = n,1,f10;
1217    G.vertices = v1,v2,v3,v4,v5,v6;
1218    G.edges = f1,f3,f5,f7,f9;
1219    return (G);
1220}
1221
1222static proc graph56(list d, int i, int j, int k, int h, int m, int n)
1223{
1224    graph G;
1225    list f1 = i,j,d[1];
1226    list f2 = j,i,d[1];
1227    list f3 = j,k,d[2];
1228    list f4 = k,j,d[2];
1229    list f5 = j,h,d[3];
1230    list f6 = h,j,d[3];
1231    list f7 = j,m,d[4];
1232    list f8 = m,j,d[4];
1233    list f9 = j,n,d[5];
1234    list f10 = n,j,d[5];
1235    list v1 = i,1,f1;
1236    list v2 = j,5,f2,f3,f5,f7,f9;
1237    list v3 = k,1,f4;
1238    list v4 = h,1,f6;
1239    list v5 = m,1,f8;
1240    list v6 = n,1,f10;
1241    G.vertices = v1,v2,v3,v4,v5,v6;
1242    G.edges = f1,f3,f5,f7,f9;
1243    return (G);
1244}
1245
1246static proc graph61(list d, int i, int j, int k, int h, int m, int n, int p)
1247{
1248    graph G;
1249    list f1 = i,j,d[1];
1250    list f2 = j,i,d[1];
1251    list f3 = j,k,d[2];
1252    list f4 = k,j,d[2];
1253    list f5 = k,h,d[3];
1254    list f6 = h,k,d[3];
1255    list f7 = h,m,d[4];
1256    list f8 = m,h,d[4];
1257    list f9 = m,n,d[5];
1258    list f10 = n,m,d[5];
1259    list f11 = n,p,d[6];
1260    list f12 = p,n,d[6];
1261    list v1 = i,1,f1;
1262    list v2 = j,2,f2,f3;
1263    list v3 = k,2,f4,f5;
1264    list v4 = h,2,f6,f7;
1265    list v5 = m,2,f8,f9;
1266    list v6 = n,2,f10,f11;
1267    list v7 = p,1,f12;
1268    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1269    G.edges = f1,f3,f5,f7,f9,f11;
1270    return (G);
1271}
1272
1273static proc graph62(list d, int i, int j, int k, int h, int m, int n, int p)
1274{
1275    graph G;
1276    list f1 = i,j,d[1];
1277    list f2 = j,i,d[1];
1278    list f3 = j,k,d[2];
1279    list f4 = k,j,d[2];
1280    list f5 = k,h,d[3];
1281    list f6 = h,k,d[3];
1282    list f7 = h,m,d[4];
1283    list f8 = m,h,d[4];
1284    list f9 = m,n,d[5];
1285    list f10 = n,m,d[5];
1286    list f11 = m,p,d[6];
1287    list f12 = p,m,d[6];
1288    list v1 = i,1,f1;
1289    list v2 = j,2,f2,f3;
1290    list v3 = k,2,f4,f5;
1291    list v4 = h,2,f6,f7;
1292    list v5 = m,3,f8,f9,f11;
1293    list v6 = n,1,f10;
1294    list v7 = p,1,f12;
1295    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1296    G.edges = f1,f3,f5,f7,f9,f11;
1297    return (G);
1298}
1299
1300static proc graph63(list d, int i, int j, int k, int h, int m, int n, int p)
1301{
1302    graph G;
1303    list f1 = i,j,d[1];
1304    list f2 = j,i,d[1];
1305    list f3 = j,k,d[2];
1306    list f4 = k,j,d[2];
1307    list f5 = k,h,d[3];
1308    list f6 = h,k,d[3];
1309    list f7 = h,m,d[4];
1310    list f8 = m,h,d[4];
1311    list f9 = h,n,d[5];
1312    list f10 = n,h,d[5];
1313    list f11 = n,p,d[6];
1314    list f12 = p,n,d[6];
1315    list v1 = i,1,f1;
1316    list v2 = j,2,f2,f3;
1317    list v3 = k,2,f4,f5;
1318    list v4 = h,3,f6,f7,f9;
1319    list v5 = m,1,f8;
1320    list v6 = n,2,f10,f11;
1321    list v7 = p,1,f12;
1322    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1323    G.edges = f1,f3,f5,f7,f9,f11;
1324    return (G);
1325}
1326
1327static proc graph64(list d, int i, int j, int k, int h, int m, int n, int p)
1328{
1329    graph G;
1330    list f1 = i,j,d[1];
1331    list f2 = j,i,d[1];
1332    list f3 = j,k,d[2];
1333    list f4 = k,j,d[2];
1334    list f5 = k,h,d[3];
1335    list f6 = h,k,d[3];
1336    list f7 = h,m,d[4];
1337    list f8 = m,h,d[4];
1338    list f9 = h,n,d[5];
1339    list f10 = n,h,d[5];
1340    list f11 = h,p,d[6];
1341    list f12 = p,h,d[6];
1342    list v1 = i,1,f1;
1343    list v2 = j,2,f2,f3;
1344    list v3 = k,2,f4,f5;
1345    list v4 = h,4,f6,f7,f9,f11;
1346    list v5 = m,1,f8;
1347    list v6 = n,1,f10;
1348    list v7 = p,1,f12;
1349    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1350    G.edges = f1,f3,f5,f7,f9,f11;
1351    return (G);
1352}
1353
1354static proc graph65(list d, int i, int j, int k, int h, int m, int n, int p)
1355{
1356    graph G;
1357    list f1 = i,j,d[1];
1358    list f2 = j,i,d[1];
1359    list f3 = j,k,d[2];
1360    list f4 = k,j,d[2];
1361    list f5 = k,h,d[3];
1362    list f6 = h,k,d[3];
1363    list f7 = k,m,d[4];
1364    list f8 = m,k,d[4];
1365    list f9 = k,n,d[5];
1366    list f10 = n,k,d[5];
1367    list f11 = n,p,d[6];
1368    list f12 = p,n,d[6];
1369    list v1 = i,1,f1;
1370    list v2 = j,2,f2,f3;
1371    list v3 = k,4,f4,f5,f7,f9;
1372    list v4 = h,1,f6;
1373    list v5 = m,1,f8;
1374    list v6 = n,2,f10,f11;
1375    list v7 = p,1,f12;
1376    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1377    G.edges = f1,f3,f5,f7,f9,f11;
1378    return (G);
1379}
1380
1381static proc graph66(list d, int i, int j, int k, int h, int m, int n, int p)
1382{
1383    graph G;
1384    list f1 = i,j,d[1];
1385    list f2 = j,i,d[1];
1386    list f3 = j,k,d[2];
1387    list f4 = k,j,d[2];
1388    list f5 = k,h,d[3];
1389    list f6 = h,k,d[3];
1390    list f7 = k,m,d[4];
1391    list f8 = m,k,d[4];
1392    list f9 = h,n,d[5];
1393    list f10 = n,h,d[5];
1394    list f11 = m,p,d[6];
1395    list f12 = p,m,d[6];
1396    list v1 = i,1,f1;
1397    list v2 = j,2,f2,f3;
1398    list v3 = k,3,f4,f5,f7;
1399    list v4 = h,2,f6,f9;
1400    list v5 = m,1,f8,f11;
1401    list v6 = n,1,f10;
1402    list v7 = p,1,f12;
1403    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1404    G.edges = f1,f3,f5,f7,f9,f11;
1405    return (G);
1406}
1407
1408static proc graph67(list d, int i, int j, int k, int h, int m, int n, int p)
1409{
1410    graph G;
1411    list f1 = i,j,d[1];
1412    list f2 = j,i,d[1];
1413    list f3 = j,k,d[2];
1414    list f4 = k,j,d[2];
1415    list f5 = j,h,d[3];
1416    list f6 = h,j,d[3];
1417    list f7 = h,m,d[4];
1418    list f8 = m,h,d[4];
1419    list f9 = m,n,d[5];
1420    list f10 = n,m,d[5];
1421    list f11 = m,p,d[6];
1422    list f12 = p,m,d[6];
1423    list v1 = i,1,f1;
1424    list v2 = j,3,f2,f3,f5;
1425    list v3 = k,1,f4;
1426    list v4 = h,2,f6,f7;
1427    list v5 = m,3,f8,f9,f11;
1428    list v6 = n,1,f10;
1429    list v7 = p,1,f12;
1430    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1431    G.edges = f1,f3,f5,f7,f9,f11;
1432    return (G);
1433}
1434
1435static proc graph68(list d, int i, int j, int k, int h, int m, int n, int p)
1436{
1437    graph G;
1438    list f1 = i,j,d[1];
1439    list f2 = j,i,d[1];
1440    list f3 = j,k,d[2];
1441    list f4 = k,j,d[2];
1442    list f5 = j,h,d[3];
1443    list f6 = h,j,d[3];
1444    list f7 = h,m,d[4];
1445    list f8 = m,h,d[4];
1446    list f9 = h,n,d[5];
1447    list f10 = n,h,d[5];
1448    list f11 = h,p,d[6];
1449    list f12 = p,h,d[6];
1450    list v1 = i,1,f1;
1451    list v2 = j,3,f2,f3,f5;
1452    list v3 = k,1,f4;
1453    list v4 = h,4,f6,f7,f9,f11;
1454    list v5 = m,1,f8;
1455    list v6 = n,1,f10;
1456    list v7 = p,1,f12;
1457    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1458    G.edges = f1,f3,f5,f7,f9,f11;
1459    return (G);
1460}
1461
1462static proc graph69(list d, int i, int j, int k, int h, int m, int n, int p)
1463{
1464    graph G;
1465    list f1 = i,j,d[1];
1466    list f2 = j,i,d[1];
1467    list f3 = j,k,d[2];
1468    list f4 = k,j,d[2];
1469    list f5 = j,h,d[3];
1470    list f6 = h,j,d[3];
1471    list f7 = h,m,d[4];
1472    list f8 = m,h,d[4];
1473    list f9 = h,n,d[5];
1474    list f10 = n,h,d[5];
1475    list f11 = n,p,d[6];
1476    list f12 = p,n,d[6];
1477    list v1 = i,1,f1;
1478    list v2 = j,3,f2,f3,f5;
1479    list v3 = k,1,f4;
1480    list v4 = h,3,f6,f7,f9;
1481    list v5 = m,1,f8;
1482    list v6 = n,2,f10,f11;
1483    list v7 = p,1,f12;
1484    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1485    G.edges = f1,f3,f5,f7,f9,f11;
1486    return (G);
1487}
1488
1489static proc graph610(list d, int i, int j, int k, int h, int m, int n, int p)
1490{
1491    graph G;
1492    list f1 = i,j,d[1];
1493    list f2 = j,i,d[1];
1494    list f3 = j,k,d[2];
1495    list f4 = k,j,d[2];
1496    list f5 = k,h,d[3];
1497    list f6 = h,k,d[3];
1498    list f7 = k,m,d[4];
1499    list f8 = m,k,d[4];
1500    list f9 = k,n,d[5];
1501    list f10 = n,k,d[5];
1502    list f11 = k,p,d[6];
1503    list f12 = p,k,d[6];
1504    list v1 = i,1,f1;
1505    list v2 = j,2,f2,f3;
1506    list v3 = k,5,f4,f5,f7,f9,f11;
1507    list v4 = h,1,f6;
1508    list v5 = m,1,f8;
1509    list v6 = n,1,f10;
1510    list v7 = p,1,f12;
1511    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1512    G.edges = f1,f3,f5,f7,f9,f11;
1513    return (G);
1514}
1515
1516static proc graph611(list d, int i, int j, int k, int h, int m, int n, int p)
1517{
1518    graph G;
1519    list f1 = i,j,d[1];
1520    list f2 = j,i,d[1];
1521    list f3 = j,k,d[2];
1522    list f4 = k,j,d[2];
1523    list f5 = j,h,d[3];
1524    list f6 = h,j,d[3];
1525    list f7 = j,m,d[4];
1526    list f8 = m,j,d[4];
1527    list f9 = j,n,d[5];
1528    list f10 = n,j,d[5];
1529    list f11 = j,p,d[6];
1530    list f12 = p,j,d[6];
1531    list v1 = i,1,f1;
1532    list v2 = j,6,f2,f3,f5,f7,f9,f11;
1533    list v3 = k,1,f4;
1534    list v4 = h,1,f6;
1535    list v5 = m,1,f8;
1536    list v6 = n,1,f10;
1537    list v7 = p,1,f12;
1538    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1539    G.edges = f1,f3,f5,f7,f9,f11;
1540    return (G);
1541}
1542
1543////////////////////////////////////////////////////////////////////////////////
1544/// Auxilary Static Procedures in this Library /////////////////////////////////
1545////////////////////////////////////////////////////////////////////////////////
1546
1547proc part(poly f, int n)
1548"USAGE:     part(f,n); f poly, n int
1549RETURN:     poly
1550PURPOSE:    computing the homogeneous component of a polynomial.
1551EXAMPLE:    example part; shows examples
1552"
1553{
1554    int i;
1555    poly p;
1556    for (i=1;i<=size(f);i++)
1557    {
1558        if (deg(f[i])==n) {p=p+f[i];}
1559    }
1560    return (p);
1561}
1562example
1563{
1564    "EXAMPLE:"; echo=2;
1565    ring r = 0,(x,y,z),wp(1,2,3);
1566    poly f = 1+x+x2+x3+x4+y+y2+y3+z+z2+xy+xz+yz+xyz;
1567    part(f,0);
1568    part(f,1);
1569    part(f,2);
1570    part(f,3);
1571    part(f,4);
1572    part(f,5);
1573    part(f,6);
1574}
1575
1576proc parts(poly f, int i, int j)
1577"USAGE:     parts(f,i,j); f poly, i int, j int
1578RETURN:     poly
1579THEORY:     computing a polynomial which is the sum of the homogeneous
1580            components of a polynomial.
1581EXAMPLE:    example parts; shows examples
1582"
1583{
1584    int k;
1585    poly p;
1586    for (k=i;k<=j;k++)
1587    {
1588        p=p+part(f,k);
1589    }
1590    return (p);
1591}
1592example
1593{
1594    "EXAMPLE:"; echo=2;
1595    ring r = 0,(x,y,z),wp(1,2,3);
1596    poly f = 1+x+x2+x3+x4+y+y2+y3+z+z2+xy+xz+yz+xyz;
1597    parts(f,2,4);
1598}
1599
1600proc logg(poly f, int n)
1601"USAGE:     logg(f,n); f poly, n int
1602RETURN:     poly
1603THEORY:     computing Chern characters from total Chern classes.
1604EXAMPLE:    example logg; shows examples
1605"
1606{
1607    poly p;
1608    int i,j,k,m;
1609    if (n==0) {p=0;}
1610    if (n==1) {p=part(f,1);}
1611    else
1612    {
1613        list l=-part(f,1);
1614        for (j=2;j<=n;j++)
1615        {
1616            poly q;
1617            for (k=1;k<j;k++)
1618            {
1619                q=q+part(f,k)*l[j-k];
1620            }
1621            q=-j*part(f,j)-q;
1622            l=insert(l,q,size(l));
1623            kill q;
1624        }
1625        for (m=1;m<=n;m++)
1626        {
1627            p=p+1/factorial(m)*(-1)^m*l[m];
1628        }
1629    }
1630    return (p);
1631}
1632example
1633{
1634    "EXAMPLE:"; echo=2;
1635    ring r = 0,(x,y),wp(1,2);
1636    poly f = 1+x+y;
1637    logg(f,4);
1638}
1639
1640proc expp(poly f, int n)
1641"USAGE:     expp(f,n); f poly, n int
1642RETURN:     poly
1643PURPOSE:    computing total Chern classes from Chern characters.
1644EXAMPLE:    example expp; shows examples
1645"
1646{
1647    poly p;
1648    int i,j,k;
1649    if (deg(f)==0) {p=1;}
1650    else
1651    {
1652        list l=1;
1653        for (i=1;i<=n;i++)
1654        {
1655            poly q;
1656            for (j=1;j<=i;j++)
1657            {
1658                q=q+factorial(j)*(-1)^(j-1)*l[i-j+1]*part(f,j)/i;
1659            }
1660            l=insert(l,q,size(l));
1661            kill q;
1662        }
1663        for (k=1;k<=size(l);k++)
1664        {
1665            p=p+l[k];
1666        }
1667    }
1668    return (p);
1669}
1670example
1671{
1672    "EXAMPLE:"; echo=2;
1673    ring r = 0,(x),dp;
1674    poly f = 3+x;
1675    expp(f,3);
1676}
1677
1678static proc adams(poly f, int n)
1679{
1680    poly p;
1681    int i;
1682    for (i=0;i<=deg(f);i++)
1683    {
1684        p=p+n^i*part(f,i);
1685    }
1686    return (p);
1687}
1688
1689static proc wedges(int n, poly f, int d)
1690{
1691    int i,j;
1692    list l;
1693    if (n==0) {l=1;}
1694    if (n==1) {l=1,f;}
1695    else
1696    {
1697        l=1,f;
1698        for (i=2;i<=n;i++)
1699        {
1700            poly q;
1701            for (j=1;j<=i;j++)
1702            {
1703                q=q+((-1)^(i-j))*parts(l[j]*adams(f,i-j+1),0,d)/i;
1704            }
1705            l=insert(l,q,size(l));
1706            kill q;
1707        }
1708    }
1709    return (l);
1710}
1711
1712static proc schur(list p, poly f)
1713{
1714    int i,j;
1715    int n = size(p);
1716    matrix M[n][n];
1717    for (i=1;i<=n;i++)
1718    {
1719        for (j=1;j<=n;j++)
1720        {
1721            M[i,j] = part(f,p[i]+j-i);
1722        }
1723    }
1724    return (det(M));
1725}
1726
1727////////////////////////////////////////////////////////////////////////////////
1728//////// Procedures concerned with abstract varieties //////////////////////////
1729////////////////////////////////////////////////////////////////////////////////
1730
1731proc printVariety(variety V)
1732"USAGE:     printVariety(V); V variety
1733ASSUME:     V is an abstract variety
1734THEORY:     This is the print function used by Singular to print an abstract
1735            variety.
1736KEYWORDS:   abstract variety, projective space, Grassmannian
1737EXAMPLE:    example printVariety; shows an example
1738"
1739{
1740    "A variety of dimension", V.dimension;
1741}
1742example
1743{
1744    "EXAMPLE:"; echo=2;
1745    ring r = 0, (h,e), wp(1,1);
1746    ideal rels = he,h2+e2;
1747    variety V = makeVariety(2,rels);
1748    V;
1749}
1750
1751proc makeVariety(int d, ideal i)
1752"USAGE:     makeVariety(d,i); d int, i ideal
1753ASSUME:     d is a nonnegative integer, i is an ideal
1754RETURN:     variety
1755THEORY:     create an abstract variety which has dimension d, and its Chow ring
1756            should be a quotient ring
1757KEYWORDS:   abstract variety, projective space, Grassmannian
1758EXAMPLE:    example makeVariety; shows an example
1759"
1760{
1761    def R = basering;
1762    variety V;
1763    V.dimension = d;
1764    V.baseRing = R;
1765    V.relations = i;
1766    return(V);
1767}
1768<<<<<<< HEAD
1769
1770proc dimension(variety V)
1771=======
1772example
1773>>>>>>> 2ba3231... chg: new version of schubert.lib
1774{
1775    "EXAMPLE:"; echo=2;
1776    ring r = 0, (h,e), wp(1,1);
1777    ideal rels = he,h2+e2;
1778    variety V = makeVariety(2,rels);
1779    V;
1780    V.dimension;
1781    V.relations;
1782}
1783
1784proc ChowRing(variety V)
1785"USAGE:     ChowRing(V); V variety
1786ASSUME:     V is an abstract variety
1787RETURN:     qring
1788KEYWORDS:   Chow ring, abstract variety, projective space, Grassmannian
1789EXAMPLE:    example makeVariety; shows an example
1790"
1791{
1792    def R = V.baseRing;
1793    setring R;
1794    ideal rels = V.relations;
1795    qring CR = std(rels);
1796    return (CR);
1797}
1798example
1799{
1800    "EXAMPLE:"; echo=2;
1801    ring r = 0, (h,e), wp(1,1);
1802    ideal rels = he,h2+e2;
1803    int d = 2;
1804    variety V = makeVariety(2,rels);
1805    ChowRing(V);
1806}
1807
1808////////////////////////////////////////////////////////////////////////////////
1809
1810proc Grassmannian(int k, int n, list #)
1811"USAGE:     Grassmannian(k,n); k int, n int
1812RETURN:     variety
1813THEORY:     create a Grassmannian G(k,n) as an abstract variety. This abstract
1814            variety has diemnsion k(n-k) and its Chow ring is the quotient ring
1815            of a polynomial ring in n-k variables q(1),...,q(n-k), which are the
1816            Chern classes of tautological quotient bundle on G(k,n), modulo some
1817            ideal generated by n-k polynomials which come from the Giambelli
1818            formula. The monomial ordering of this Chow ring is 'wp' with vector
1819            (1..k,1..n-k). Moreover, we export the Chern characters of
1820            tautological subbundle and quotient bundle on G(k,n)
1821            (say 'subBundle' and 'quotientBundle').
1822KEYWORDS:   Grassmannian, abstract variety, Schubert calculus
1823SEE ALSO:   projectiveSpace, projectiveBundle
1824EXAMPLE:    example Grassmannian; shows examples
1825"
1826{
1827    string q;
1828    if (size(#)==0) {q = "q";}
1829    else
1830    {
1831        if (typeof(#[1]) == "string") {q = #[1];}
1832        else {Error("invalid optional argument");}
1833    }
1834    variety G;
1835    G.dimension = k*(n-k);
1836    execute("ring r = 0,("+q+"(1..n-k)),wp(1..n-k);");
1837    setring r;
1838    G.baseRing = r;
1839    int i,j;
1840    poly v = 1;
1841    poly u = 1;
1842    for (j=1;j<=n-k;j++) {v=v+q(j);}
1843    list l;
1844    for (i=1;i<=k;i++)
1845    {
1846        l=insert(l,1,size(l));
1847        u=u+(-1)^i*schur(l,v);
1848    }
1849    l=insert(l,1,size(l));
1850    ideal rels = schur(l,v);
1851    int h = k+2;
1852    while (h<=n)
1853    {
1854        l=insert(l,1,size(l));
1855        rels = rels,schur(l,v);
1856        h++;
1857    }
1858    G.relations = rels;
1859    int d = k*(n-k);
1860    poly subBundle = reduce(logg(u,d)+k,std(rels));
1861    poly quotientBundle = reduce(logg(v,d)+n-k,std(rels));
1862    export (subBundle,quotientBundle);
1863    kill u,v,d,l,rels;
1864    return (G);
1865}
1866example
1867{
1868    "EXAMPLE:"; echo=2;
1869    variety G24 = Grassmannian(2,4);
1870    G24;
1871    def r = G24.baseRing;
1872<<<<<<< HEAD
1873=======
1874    setring r;
1875>>>>>>> 2ba3231... chg: new version of schubert.lib
1876    subBundle;
1877    quotientBundle;
1878    G24.dimension;
1879    G24.relations;
1880    ChowRing(G24);
1881}
1882
1883proc projectiveSpace(int n, list #)
1884"USAGE:     projectiveSpace(n); n int
1885RETURN:     variety
1886THEORY:     create a projective space of dimension n as an abstract variety. Its
1887            Chow ring is a quotient ring in one variable h modulo the ideal
1888            generated by h^(n+1).
1889KEYWORDS:   projective space, abstract variety
1890SEE ALSO:   Grassmannian, projectiveBundle
1891EXAMPLE:    example projectiveSpace; shows examples
1892"
1893{
1894    string h;
1895    if (size(#)==0) {h = "h";}
1896    else
1897    {
1898        if (typeof(#[1]) == "string") {h = #[1];}
1899        else {Error("invalid optional argument");}
1900    }
1901    variety P;
1902    P.dimension = n;
1903    execute("ring r = 0, ("+h+"), wp(1);");
1904    setring r;
1905    P.baseRing = r;
1906    ideal rels = var(1)^(n+1);
1907    P.relations = rels;
1908    poly u = 1;
1909    poly v = 1 + var(1);
1910    list l;
1911    int i;
1912    for (i=1;i<=n;i++)
1913    {
1914        l=insert(l,1,size(l));
1915        u=u+(-1)^i*schur(l,v);
1916    }
1917    poly subBundle = reduce(logg(u,n)+n,std(rels));
1918    poly quotientBundle = reduce(logg(v,n)+1,std(rels));
1919    export(subBundle,quotientBundle);
1920    kill rels,u,v,l;
1921    return (P);
1922}
1923example
1924{
1925    "EXAMPLE:"; echo=2;
1926    variety P = projectiveSpace(3);
1927    P;
1928    P.dimension;
1929    def r = P.baseRing;
1930    setring r;
1931    P.relations;
1932    ChowRing(P);
1933}
1934
1935proc projectiveBundle(sheaf S, list #)
1936"USAGE:     projectiveBundle(S); S sheaf
1937INPUT:      a sheaf on an abstract variety
1938RETURN:     variety
1939THEORY:     create a projective bundle as an abstract variety. This is related
1940            to the enumeration of conics.
1941KEYWORDS:   projective bundle, abstract variety, sheaf, enumeration of conics
1942SEE ALSO:   projectiveSpace, Grassmannian
1943EXAMPLE:    example projectiveBundle; shows examples
1944"
1945{
1946    string z;
1947    if (size(#)==0) {z = "z";}
1948    else
1949    {
1950        if (typeof(#[1]) == "string") {z = #[1];}
1951        else {Error("invalid optional argument");}
1952    }
1953    variety A;
1954    def B = S.currentVariety;
1955    def R = B.baseRing;
1956    setring R;
1957    ideal rels = B.relations;
1958    int r = rankSheaf(S);
1959    A.dimension = r - 1 + B.dimension;
1960    poly c = totalChernClass(S);
1961    execute("ring P = 0, ("+z+"), wp(1);");
1962    def CR = P + R;
1963    setring CR;
1964    A.baseRing = CR;
1965    poly c = imap(R,c);
1966    ideal rels = imap(R,rels);
1967    poly g = var(1)^r;
1968    int i;
1969    for (i=1;i<=r;i++) {g=g+var(1)^(r-i)*part(c,i);}
1970    A.relations = rels,g;
1971    poly u = 1 + var(1);
1972    poly f = logg(u,A.dimension)+1;
1973    poly QuotientBundle = reduce(f,std(A.relations));
1974    export (QuotientBundle);
1975    kill f,rels;
1976    return (A);
1977}
1978example
1979{
1980    "EXAMPLE:"; echo=2;
1981    variety G = Grassmannian(3,5);
1982    def r = G.baseRing;
1983    setring r;
1984    sheaf S = makeSheaf(G,subBundle);
1985    sheaf B = dualSheaf(S)^2;
1986    variety PB = projectiveBundle(B);
1987    PB;
1988    def R = PB.baseRing;
1989    setring R;
1990    QuotientBundle;
1991    ChowRing(PB);
1992}
1993
1994proc productVariety(variety U, variety V)
1995"USAGE:     productVariety(U,V); U variety, V variety
1996INPUT:      two abstract varieties
1997OUTPUT:     a product variety as an abstract variety
1998RETURN:     variety
1999KEYWORDS:   product variety, abstract variety
2000SEE ALSO:   projectiveSpace, Grassmannian, projectiveBundle
2001EXAMPLE:    example productVariety; shows examples
2002"
2003{
2004    //def br = basering;
2005    def ur = U.baseRing; setring ur;
2006    ideal ii1 = U.relations;
2007    def vr = V.baseRing; setring vr;
2008    ideal ii2 = V.relations;
2009    variety W;
2010    W.dimension = U.dimension + V.dimension;
2011    def temp = ringtensor(ur,vr);
2012    setring temp;
2013    W.baseRing = temp;
2014    ideal i1 = imap(ur,ii1);
2015    ideal i2 = imap(vr,ii2);
2016    W.relations = i1 + i2;
2017    setring ur;
2018    kill ii1;
2019    setring vr;
2020    kill ii2;
2021    //setring br;
2022    return (W);
2023}
2024example
2025{
2026    "EXAMPLE:"; echo=2;
2027    variety P = projectiveSpace(3);
2028    variety G = Grassmannian(2,4);
2029    variety W = productVariety(P,G);
2030    W;
2031    W.dimension == P.dimension + G.dimension;
2032    def r = W.baseRing;
2033    setring r;
2034    W.relations;
2035}
2036
2037////////////////////////////////////////////////////////////////////////////////
2038
2039proc integral(variety V, poly f)
2040"USAGE:     integral(V,f); V variety, f poly
2041INPUT:      a abstract variety and a polynomial
2042RETURN:     int
2043PURPOSE:    computing intersection numbers.
2044EXAMPLE:    example integral; shows an example
2045"
2046{
2047    def R = V.baseRing;
2048    setring R;
2049    ideal rels = V.relations;
2050    return (leadcoef(reduce(f,std(rels))));
2051}
2052example
2053{
2054    "EXAMPLE:"; echo=2;
2055    variety G = Grassmannian(2,4);
2056    def r = G.baseRing;
2057    setring r;
2058    integral(G,q(1)^4);
2059}
2060
2061proc SchubertClass(list p)
2062"USAGE:     SchubertClass(p); p list
2063INPUT:      a list of integers which is a partition
2064RETURN:     poly
2065PURPOSE:    compute the Schubert classes on a Grassmannian.
2066EXAMPLE:    example SchubertClass; shows an example
2067"
2068{
2069    def R = basering;
2070    setring R;
2071    poly f = 1;
2072    if (size(p) == 0) {return (f);}
2073    int i;
2074    for (i=1;i<=nvars(R);i++)
2075    {
2076        f = f + var(i);
2077    }
2078    return (schur(p,f));
2079}
2080example
2081{
2082    "EXAMPLE:"; echo=2;
2083    variety G = Grassmannian(2,4);
2084    def r = G.baseRing;
2085    setring r;
2086    list p = 1,1;
2087    SchubertClass(p);
2088}
2089
2090////////////////////////////////////////////////////////////////////////////////
2091
2092proc dualPartition(int k, int n, list p)
2093"USAGE:     dualPartition(k,n,p); k int, n int, p list
2094INPUT:      two integers and a partition
2095RETURN:     list
2096PURPOSE:    compute the dual of a partition.
2097SEE ALSO:   SchubertClass
2098EXAMPLE:    example dualPartition; shows an example
2099"
2100{
2101    while (size(p) < k)
2102    {
2103        p = insert(p,0,size(p));
2104    }
2105    int i;
2106    list l;
2107    for (i=1;i<=size(p);i++)
2108    {
2109        l[i] = n-k-p[size(p)-i+1];
2110    }
2111    return (l);
2112}
2113example
2114{
2115    "EXAMPLE:"; echo=2;
2116    ring r = 0,(x),dp;
2117    dualPartition(2,4,list(2,1));
2118}
2119
2120////////////////////////////////////////////////////////////////////////////////
2121////////// Procedures concerned with sheaves ///////////////////////////////////
2122////////////////////////////////////////////////////////////////////////////////
2123
2124proc printSheaf(sheaf S)
2125"USAGE:     printSheaf(S); S sheaf
2126RETURN:     string
2127INPUT:      a sheaf
2128THEORY:     This is the print function used by Singular to print a sheaf.
2129SEE ALSO:   makeSheaf, rankSheaf
2130EXAMPLE:    example printSheaf; shows an example
2131"
2132{
2133    "A sheaf of rank ", rankSheaf(S);
2134}
2135example
2136{
2137    "EXAMPLE:"; echo=2;
2138    variety X;
2139    X.dimension = 4;
2140    ring r = 0,(c(1..2),d(1..3)),wp(1..2,1..3);
2141    setring r;
2142    X.baseRing = r;
2143    poly c = 1 + c(1) + c(2);
2144    poly ch = 2 + logg(c,4);
2145    sheaf S = makeSheaf(X,ch);
2146    S;
2147}
2148
2149proc makeSheaf(variety V, poly ch)
2150"USAGE:     makeSheaf(V,ch); V variety, ch poly
2151RETURN:     sheaf
2152THEORY:     create a sheaf on an abstract variety, and its Chern character is
2153            the polynomial ch.
2154SEE ALSO:   printSheaf, rankSheaf
2155EXAMPLE:    example makeSheaf; shows an example
2156"
2157{
2158    def R = basering;
2159    sheaf S;
2160    S.currentVariety = V;
2161    S.ChernCharacter = ch;
2162    return(S);
2163}
2164example
2165{
2166    "EXAMPLE:"; echo=2;
2167    variety X;
2168    X.dimension = 4;
2169    ring r = 0,(c(1..2),d(1..3)),wp(1..2,1..3);
2170    setring r;
2171    X.baseRing = r;
2172    poly c = 1 + c(1) + c(2);
2173    poly ch = 2 + logg(c,4);
2174    sheaf S = makeSheaf(X,ch);
2175    S;
2176}
2177
2178proc rankSheaf(sheaf S)
2179"USAGE:     rankSheaf(S); S sheaf
2180RETURN:     int
2181INPUT:      S is a sheaf
2182OUTPUT:     a positive integer which is the rank of a sheaf.
2183SEE ALSO:   makeSheaf, printSheaf
2184EXAMPLE:    example rankSheaf; shows an example
2185"
2186{
2187    variety V = S.currentVariety;
2188    def R = V.baseRing;
2189    setring R;
2190    poly f = S.ChernCharacter;
2191    return (int(part(f,0)));
2192}
2193example
2194{
2195    "EXAMPLE:"; echo=2;
2196    variety G = Grassmannian(2,4);
2197    def R = G.baseRing;
2198    setring R;
2199    sheaf S = makeSheaf(G,subBundle);
2200    rankSheaf(S);
2201}
2202
2203proc totalChernClass(sheaf S)
2204"USAGE:     totalChernClass(S); S sheaf
2205RETURN:     poly
2206INPUT:      S is a sheaf
2207OUTPUT:     a polynomial which is the total Chern class of a sheaf
2208SEE ALSO:   totalSegreClass, topChernClass, ChernClass
2209EXAMPLE:    example totalChernClass; shows an example
2210"
2211{
2212    variety V = S.currentVariety;
2213    int d = V.dimension;
2214    def R = V.baseRing;
2215    setring R;
2216    poly ch = S.ChernCharacter;
2217    poly f = expp(ch,d);
2218    ideal rels = std(V.relations);
2219    return (reduce(f,rels));
2220}
2221example
2222{
2223    "EXAMPLE:"; echo=2;
2224    variety X;
2225    X.dimension = 4;
2226    ring r = 0,(c(1..2),d(1..3)),wp(1..2,1..3);
2227    setring r;
2228    X.baseRing = r;
2229    poly c = 1 + c(1) + c(2);
2230    poly ch = 2 + logg(c,4);
2231    sheaf E = makeSheaf(X,ch);
2232    sheaf S = E^3;
2233    totalChernClass(S);
2234}
2235
2236proc ChernClass(sheaf S, int i)
2237"USAGE:     ChernClass(S,i); S sheaf, i int
2238INPUT:      S is a sheaf, i is a nonnegative integer
2239RETURN:     poly
2240THEORY:     This is the i-th Chern class of a sheaf
2241SEE ALSO:   topChernClass, totalChernClass
2242EXAMPLE:    example ChernClass; shows an example
2243"
2244{
2245    return (part(totalChernClass(S),i));
2246}
2247example
2248{
2249    "EXAMPLE:"; echo=2;
2250    variety X;
2251    X.dimension = 4;
2252    ring r = 0,(c(1..2),d(1..3)),wp(1..2,1..3);
2253    setring r;
2254    X.baseRing = r;
2255    poly c = 1 + c(1) + c(2);
2256    poly ch = 2 + logg(c,4);
2257    sheaf E = makeSheaf(X,ch);
2258    sheaf S = E^3;
2259    ChernClass(S,1);
2260    ChernClass(S,2);
2261    ChernClass(S,3);
2262    ChernClass(S,4);
2263}
2264
2265proc topChernClass(sheaf S)
2266"USAGE:     topChernClass(S); S sheaf
2267RETURN:     poly
2268INPUT:      S is a sheaf
2269THEORY:     This is the top Chern class of a sheaf
2270SEE ALSO:   ChernClass, totalChernClass
2271EXAMPLE:    example topChernClass; shows an example
2272"
2273{
2274    return (ChernClass(S,rankSheaf(S)));
2275}
2276example
2277{
2278    "EXAMPLE:"; echo=2;
2279    variety G = Grassmannian(2,4);
2280    def R = G.baseRing;
2281    setring R;
2282    sheaf S = makeSheaf(G,quotientBundle);
2283    sheaf B = S^3;
2284    topChernClass(B);
2285}
2286
2287proc totalSegreClass(sheaf S)
2288"USAGE:     totalSegreClass(S); S sheaf
2289RETURN:     poly
2290INPUT:      S is a sheaf
2291THEORY:     This is the total Segre class of a sheaf.
2292SEE AlSO:   totalChernClass
2293EXAMPLE:    example totalSegreClass; shows an example
2294"
2295{
2296    //def D = dualSheaf(S);
2297    variety V = S.currentVariety;
2298    def R = V.baseRing;
2299    setring R;
2300    poly f = totalChernClass(S);
2301    poly g;
2302    int d = V.dimension;
2303    ideal rels = std(V.relations);
2304    if (f == 1) {return (1);}
2305    else
2306    {
2307        poly t,h;
2308        int i,j;
2309        for (i=0;i<=d;i++) {t = t + (1-f)^i;}
2310        for (j=0;j<=d;j++) {h = h + part(t,j);}
2311        return (reduce(h,rels));
2312    }
2313}
2314example
2315{
2316    "EXAMPLE:"; echo=2;
2317    variety G = Grassmannian(2,4);
2318    def R = G.baseRing;
2319    setring R;
2320    sheaf S = makeSheaf(G,subBundle);
2321    totalSegreClass(S);
2322}
2323
2324proc dualSheaf(sheaf S)
2325"USAGE:     dualSheaf(S); S sheaf
2326RETURN:     sheaf
2327THEORY:     This is the dual of a sheaf
2328SEE ALSO:   addSheaf, symmetricPowerSheaf, tensorSheaf, quotSheaf
2329EXAMPLE:    example dualSheaf; shows examples
2330"
2331{
2332    variety V = S.currentVariety;
2333    int d = V.dimension;
2334    def R = V.baseRing;
2335    setring R;
2336    poly ch = S.ChernCharacter;
2337    poly f = adams(ch,-1);
2338    sheaf D;
2339    D.currentVariety = V;
2340    D.ChernCharacter = f;
2341    return (D);
2342}
2343example
2344{
2345    "EXAMPLE:"; echo=2;
2346    variety G = Grassmannian(2,4);
2347    def R = G.baseRing;
2348    setring R;
2349    sheaf S = makeSheaf(G,subBundle);
2350    sheaf D = dualSheaf(S);
2351    D;
2352}
2353
2354proc tensorSheaf(sheaf A, sheaf B)
2355"USAGE:     tensorSheaf(A,B); A sheaf, B sheaf
2356RETURN:     sheaf
2357THEORY:     This is the tensor product of two sheaves
2358SEE ALSO:   addSheaf, symmetricPowerSheaf, quotSheaf, dualSheaf
2359EXAMPLE:    example tensorSheaf; shows examples
2360"
2361{
2362    sheaf S;
2363    variety V1 = A.currentVariety;
2364    variety V2 = B.currentVariety;
2365    def R1 = V1.baseRing;
2366    setring R1;
2367    poly c1 = A.ChernCharacter;
2368    def R2 = V2.baseRing;
2369    setring R2;
2370    poly c2 = B.ChernCharacter;
2371    if (nvars(R1) < nvars(R2))
2372    {
2373        S.currentVariety = V2;
2374        poly c = imap(R1,c1);
2375        poly f = parts(c*c2,0,V2.dimension);
2376        S.ChernCharacter = f;
2377        return (S);
2378    }
2379    else
2380    {
2381        setring R1;
2382        S.currentVariety = V1;
2383        poly c = imap(R2,c2);
2384        poly f = parts(c1*c,0,V1.dimension);
2385        S.ChernCharacter = f;
2386        return (S);
2387    }
2388}
2389example
2390{
2391    "EXAMPLE:"; echo=2;
2392    variety G = Grassmannian(3,4);
2393    def R = G.baseRing;
2394    setring R;
2395    sheaf S = makeSheaf(G,subBundle);
2396    sheaf Q = makeSheaf(G,quotientBundle);
2397    sheaf T = S*Q;
2398    T;
2399}
2400
2401proc symmetricPowerSheaf(sheaf S, int n)
2402"USAGE:     symmetricPowerSheaf(S,n); S sheaf, n int
2403RETURN:     sheaf
2404THEORY:     This is the n-th symmetric power of a sheaf
2405SEE ALSO:   quotSheaf, addSheaf, tensorSheaf, dualSheaf
2406EXAMPLE:    example symmetricPowerSheaf; shows examples
2407"
2408{
2409    variety V = S.currentVariety;
2410    def R = V.baseRing;
2411    setring R;
2412    int r = rankSheaf(S);
2413    int d = V.dimension;
2414    int i,j,m;
2415    poly f = S.ChernCharacter;
2416    poly result;
2417    list s,w;
2418    if (n==0) {result=1;}
2419    if (n==1) {result=f;}
2420    else
2421    {
2422        s = 1,f;
2423        w = wedges(n,f,d);
2424        for (i=2;i<=n;i++)
2425        {
2426            if (i<=r) {m=i;}
2427            else {m=r;}
2428            poly q;
2429            for (j=1;j<=m;j++)
2430            {
2431                q = q + ((-1)^(j+1))*parts(w[j+1]*s[i-j+1],0,d);
2432            }
2433            s = insert(s,q,size(s));
2434            kill q;
2435        }
2436        result = s[n+1];
2437    }
2438    sheaf A;
2439    A.currentVariety = V;
2440    A.ChernCharacter = result;
2441    return (A);
2442}
2443example
2444{
2445    "EXAMPLE:"; echo=2;
2446    variety G = Grassmannian(2,4);
2447    def R = G.baseRing;
2448    setring R;
2449    sheaf S = makeSheaf(G,quotientBundle);
2450    sheaf B = symmetricPowerSheaf(S,3);
2451    B;
2452    sheaf A = S^3;
2453    A;
2454    A.ChernCharacter == B.ChernCharacter;
2455}
2456
2457proc quotSheaf(sheaf A, sheaf B)
2458"USAGE:     quotSheaf(A,B); A sheaf, B sheaf
2459RETURN:     sheaf
2460THEORY:     This is the quotient of two sheaves
2461SEE ALSO:   addSheaf, symmetricPowerSheaf, tensorSheaf, dualSheaf
2462EXAMPLE:    example quotSheaf; shows an example
2463"
2464{
2465    sheaf S;
2466    variety V1 = A.currentVariety;
2467    variety V2 = B.currentVariety;
2468    def R1 = V1.baseRing;
2469    setring R1;
2470    poly c1 = A.ChernCharacter;
2471    def R2 = V2.baseRing;
2472    setring R2;
2473    poly c2 = B.ChernCharacter;
2474    if (nvars(R1) < nvars(R2))
2475    {
2476        S.currentVariety = V2;
2477        poly c = imap(R1,c1);
2478        S.ChernCharacter = c - c2;
2479        return (S);
2480    }
2481    else
2482    {
2483        setring R1;
2484        S.currentVariety = V1;
2485        poly c = imap(R2,c2);
2486        S.ChernCharacter = c1 - c;
2487        return (S);
2488    }
2489}
2490example
2491{
2492    "EXAMPLE:"; echo=2;
2493    variety G = Grassmannian(3,5);
2494    def r = G.baseRing;
2495    setring r;
2496    sheaf S = makeSheaf(G,subBundle);
2497    sheaf B = dualSheaf(S)^2;
2498    sheaf B3 = dualSheaf(S)^3;
2499    sheaf B5 = dualSheaf(S)^5;
2500    variety PB = projectiveBundle(B);
2501    def R = PB.baseRing;
2502    setring R;
2503    sheaf Q = makeSheaf(PB,QuotientBundle);
2504    sheaf V = dualSheaf(Q)*B3;
2505    sheaf A = B5 - V;
2506    A;
2507}
2508
2509proc addSheaf(sheaf A, sheaf B)
2510"USAGE:     addSheaf(A,B); A sheaf, B sheaf
2511RETURN:     sheaf
2512THEORY:     This is the direct sum of two sheaves.
2513SEE ALSO:   quotSheaf, symmetricPowerSheaf, tensorSheaf, dualSheaf
2514EXAMPLE:    example addSheaf; shows an example
2515"
2516{
2517    sheaf S;
2518    variety V1 = A.currentVariety;
2519    variety V2 = B.currentVariety;
2520    def R1 = V1.baseRing;
2521    setring R1;
2522    poly c1 = A.ChernCharacter;
2523    def R2 = V2.baseRing;
2524    setring R2;
2525    poly c2 = B.ChernCharacter;
2526    if (nvars(R1) < nvars(R2))
2527    {
2528        S.currentVariety = V2;
2529        poly c = imap(R1,c1);
2530        S.ChernCharacter = c + c2;
2531        return (S);
2532    }
2533    else
2534    {
2535        setring R1;
2536        S.currentVariety = V1;
2537        poly c = imap(R2,c2);
2538        S.ChernCharacter = c1 + c;
2539        return (S);
2540    }
2541}
2542example
2543{
2544    "EXAMPLE:"; echo=2;
2545    variety G = Grassmannian(3,5);
2546    def r = G.baseRing;
2547    setring r;
2548    sheaf S = makeSheaf(G,subBundle);
2549    sheaf Q = makeSheaf(G,quotientBundle);
2550    sheaf D = S + Q;
2551    D;
2552    D.ChernCharacter == rankSheaf(D);
2553    totalChernClass(D) == 1;
2554}
Note: See TracBrowser for help on using the repository browser.