source: git/Singular/LIB/schubert.lib @ 7476bc

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