File: ModuleDeformations.m2

package info (click to toggle)
macaulay2 1.24.11%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 171,648 kB
  • sloc: cpp: 107,850; ansic: 16,307; javascript: 4,188; makefile: 3,947; lisp: 682; yacc: 604; sh: 476; xml: 177; perl: 114; lex: 65; python: 33
file content (647 lines) | stat: -rw-r--r-- 27,183 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
-- ModuleDeformations.m2
--
-- Copyright 2007-08 Bradford Hovinen
-- Licensed under the GNU GPL version 2.0

newPackage(
     "ModuleDeformations",
     Version => "1.0",
     Date => "28 October 2009",
     Authors => {{Name => "Bradford Hovinen",
	          Email => "hovinen@math.uni-hannover.de"}},
     Headline => "versal deformations of maximal Cohen-Macaulay modules",
     Keywords => {"Deformation Theory"},
     PackageImports => { "Truncations" },
     Certification => {
	  "journal name" => "The Journal of Software for Algebra and Geometry: Macaulay2",
	  "journal URI" => "https://msp.org/jsag/",
	  "article title" => "Deformations of Matrix Factorisations with Macaulay2",
	  "acceptance date" => "2010-04-17",
	  "published article URI" => "https://msp.org/jsag/2010/2-1/p02.xhtml",
	  "published article DOI" => "10.2140/jsag.2010.2.6",
	  "published code URI" => "https://msp.org/jsag/2010/2-1/jsag-v2-n1-x02-code.zip",
	  "repository code URI" => "https://github.com/Macaulay2/M2/blob/master/M2/Macaulay2/packages/ModuleDeformations.m2",
	  "release at publication" => "314a1e7a1a5f612124f23e2161c58eabeb491f46",
	  "version at publication" => "1.0",
	  "volume number" => "2",
	  "volume URI" => "https://msp.org/jsag/2010/2-1/"
	  },
     DebuggingMode => false
)

export {"deformMCMModule", "xi"}

xi = new IndexedVariableTable;

-- ShiftRowDegs(M,d)
--
-- Given a homogeneous matrix of degree e, return a new matrix of
-- degree d+e with row degrees shifted by -d

ShiftRowDegs = (M, d) -> (
     map(target M**(ring M)^{-d}, source M, M, Degree=>(d + degree M))
)

-- ShiftColDegs(M,d)
--
-- Given a homogeneous matrix of degree e, return a new matrix of
-- degree d+e with col degrees shifted by d

ShiftColDegs = (M, d) -> (
     map(target M, source M**(ring M)^{d}, M, Degree=>(d + degree M))
)

-- HomBoundaryMaps
--
-- Given a matrix factorization corresponding to an MCM module M,
-- compute the boundary maps in the complex Hom^*(M,M). Since the
-- resolution of M is two-periodic, there are two such maps. They are
-- returned as (2n^2)x(2n^2) matrices, where n is the rank of M. The
-- first map is the even-degree differential, and the second is the
-- odd-degree differential.
--
-- The matrices should be defined over the ring of the hypersurface over
-- which they represent an MCM.

HomBoundaryMaps = (A, B) -> (
     ((ShiftRowDegs(Hom(source A,A) | Hom(A,source B), -degree A)) ||
      (ShiftRowDegs(-Hom(B,source A) | -Hom(source B,B), -degree B)),
      
      ShiftColDegs ((ShiftColDegs(Hom(source A,B) || -Hom(B,source B), -degree B)) |
                    (ShiftColDegs(Hom(A,source A) || -Hom(source B,A), -degree A)), degree B + degree A))
)

-- VectToMatPair
--
-- Convert a matrix pair represented as a column vector to a pair of
-- matrices with the correct degrees.

VectToMatPair = (v, source1, target1, deg1, source2, target2, deg2) -> (
     M := reshape (source1, target1 ++ target2, transpose v);
     
     (map (target1, source1, M_[0], Degree=>deg1),
      map (target2, source2, M_[1], Degree=>deg2))
)

-- MatPairToVect
--
-- Given a pair of matrices, represent it as single column vector with
-- the correct degrees. The row degrees are prescribed.

MatPairToVect = (M1, M2) -> (
     n := numgens target M1;
     N := 2 * n^2;
     reshape ((ring M1)^N,(ring M1)^1, M1 | M2)
)

-- ComputeExtBasisVectors
--
-- Given even and odd differentials of complex, compute a basis of
-- Ext^1. Return the result as columns of a matrix.

ComputeExtBasisVectors = (A,B,i) -> (
     d := HomBoundaryMaps (A,B);
     ExtModule := trim(ker d_i/image d_(1-i));
     
     -- Workaround for bug in Macaulay2 1.1
     if dim ExtModule > 0 then
     	  error "ExtModule has infinite dimension";
     
     ExtMatrix := super basis ExtModule;
     
     -- For some reason, this computation returns the direct sum of
     -- two modules, only the first of which is the correct one.
     ExtMatrix_{0..numgens source ExtMatrix // 2 - 1}
)

-- ComputeExtBasis
--
-- Given even and odd differentials of complex, compute a basis of
-- Ext^1. Return the result as pairs of matrices. Also return the
-- degrees of the generators.

ComputeExtBasis = (A,B,i) -> (
     ExtBasisVect := ComputeExtBasisVectors(A,B,i);
     ExtBasisVect = map (ambient target ExtBasisVect, source ExtBasisVect, ExtBasisVect);
     ExtDegs := - (degrees ExtBasisVect)_1;
     ExtBasis := (i -> VectToMatPair (ExtBasisVect_{i},
				      source A, target A, degree A + (degrees ExtBasisVect)_1_i,
			              source B, target B, degree B + (degrees ExtBasisVect)_1_i)) \
			toList(0..numgens source ExtBasisVect - 1);

     (ExtBasis, ExtDegs)
)

-- ConstructAmbientRing
--
-- Construct the ambient product ring in quotients of which all
-- computations take place

ConstructAmbientRing = (OY,OSigma,Ext1degs,pIdeal) -> (
     dimExt1 := length Ext1degs;

     -- We pull out the variables coming from Sigma and treat them
     -- separately for term ordering purposes
     SigmaVars := if (pIdeal == 0) then {} else flatten entries mingens pIdeal;
     YVars := select (flatten entries vars OY, (v -> not member(v, SigmaVars)));
     SigmaVarDegs := SigmaVars / (v -> degree v);
     YVarDegs := YVars / (v -> degree v);
     
     OYAmbientxSAmbient := QQ(monoid [YVars, SigmaVars, xi_1..xi_dimExt1,
			      Degrees=>(YVarDegs | SigmaVarDegs | Ext1degs),
			      MonomialOrder=>{Position => Down, Weights => Eliminate(length YVars)}]);
     OSAmbient := QQ(monoid [SigmaVars, xi_1..xi_dimExt1,
		     Degrees=>(SigmaVarDegs | Ext1degs)]);
     (OSAmbient, OYAmbientxSAmbient/(substitute (ideal OY, OYAmbientxSAmbient)))
)

-- FirstDeformation
--
-- Deform a module into its first infinitesimal neighbourhood.

FirstDeformation = (OYxSAmbient,pIdeal,A,B,d,Ext1,Ext2Vect) -> (
     dimExt1 := length Ext1;
     
     Xi := ideal (gens OYxSAmbient)_{ -dimExt1..-1};
     OYxS1 := OYxSAmbient / ((substitute(pIdeal, OYxSAmbient) +  Xi)^2);

     At := substitute (A, OYxS1);
     Bt := substitute (B, OYxS1);
     lhs := -At*Bt;
     vlhs := map(substitute(target d_1,OYxS1),, MatPairToVect (lhs, -lhs));
     psolvect := vlhs // substitute (d_1, ring vlhs);

     psol := VectToMatPair (psolvect, source At, target At, degree At, source Bt, target Bt, degree Bt);
     
     n := numgens OYxS1;
     A = fold (plus, ((j -> (OYxS1_(n-dimExt1+j) * substitute ((Ext1_j)_0, OYxS1))) \ (0 .. dimExt1 - 1))) + psol_0 + At;
     B = fold (plus, ((j -> (OYxS1_(n-dimExt1+j) * substitute ((Ext1_j)_1, OYxS1))) \ (0 .. dimExt1 - 1))) + psol_1 + Bt;

     
     (A, B)
)

-- LiftExt2Basis
--
-- Lift a given basis of Ext2 to the given ring

LiftExt2Basis = (Ext2Vect, R) -> (
     map(coker substitute(presentation target Ext2Vect, R), substitute(source Ext2Vect, R), 
	 substitute(map(ambient target Ext2Vect, source Ext2Vect, Ext2Vect), R))
)

-- ExtendDeformation
--
-- Given a deformation, extend it by one more infinitesimal
-- neighbourhood.

ExtendDeformation = (OYxSAmbient,pIdeal,i,A,B,d,dimExt1,Ext2Vect,obstruction) -> (
     Xi := ideal (gens OYxSAmbient)_{ -dimExt1..-1};
     OYxSi := OYxSAmbient / ((pIdeal + Xi)^(i+1));	       
     At := substitute (A, OYxSi);
     Bt := substitute (B, OYxSi);

     lhs1 := -Bt*At;
     lhs2 := -At*Bt;
     
     -- Check whether we are done. If the left-hand-side modulo the
     -- existing obstruction is done, then a particular solution is
     -- zero and no further computation is necessary.
     
     obstruction = obstruction / (f -> substitute (f, OYxSi));
     obsIdeal := ideal obstruction;
     if (all (flatten flatten entries lhs1, f -> (f % obsIdeal == 0)) and
         all (flatten flatten entries lhs2, f -> (f % obsIdeal == 0)))
	 then return (At, Bt, obstruction, false);

     -- This computation must take place in the ambient ring of O_Y,
     -- since otherwise relations in O_Y may screw up the degrees in
     -- the particular solution.
     Xi = ideal (gens ambient OYxSAmbient)_{ -dimExt1..-1};
     OYAmbientxSi := (ambient OYxSAmbient) / ((substitute(pIdeal,ambient OYxSAmbient) + Xi)^(i+1));

     Ext2VectOYAmbientxSi := LiftExt2Basis(Ext2Vect,OYAmbientxSi);
     
     vlhs := map(substitute(target d_1, OYAmbientxSi),, substitute(MatPairToVect (lhs1, -lhs2),OYAmbientxSi));
     vlhsobs := map(target Ext2VectOYAmbientxSi,, vlhs % substitute (d_1, OYAmbientxSi));
     obsi := (vlhsobs // Ext2VectOYAmbientxSi) % (syz map (ambient target Ext2VectOYAmbientxSi,, Ext2VectOYAmbientxSi));
     
     obstruction = flatten entries (substitute(obsi,OYxSi))_0;
     
     rawpsol := substitute(substitute(vlhs,OYAmbientxSi) // substitute (d_1, OYAmbientxSi), OYxSi);

     psol := VectToMatPair (rawpsol, source At, target At, degree At, source Bt, target Bt, degree Bt);

     (At + psol_0, Bt + psol_1, obstruction, false)
)

-- deformMCMModule
--
-- Deform a maximal Cohen-Macaulay module on a hypersurface into a
-- module over the ring of the hypersurface defined by the given polynomial
-- up to the given maximal degree of the indeterminate. Return the
-- resulting matrix factorization and the obstruction.

deformMCMModule = method(Options => {DegreeLimit => 10})
deformMCMModule(Module,RingMap) := o -> (M0,phi) -> (
     -- Check preconditions
     if (codim prune ring M0 > 1) then error "This procedure only works with modules over hypersurfaces.";

     -- If M0 is already free, then it is rigid, so just return the free module
     if (syz presentation M0 == 0) then return (source phi,(target phi)^(degrees prune M0));

     -- Otherwise, make sure M0 is maximal Cohen-Macaulay
     A0 := presentation M0;
     if (numrows A0 != numcols A0 or det lift (A0, ambient ring A0) == 0) then error "M0 is not maximal Cohen-Macaulay";

     if (dim Ext^1(M0,M0) > 0) then error "Ext^1(M0,M0) has infinite dimension. Cannot construct versal deformation.";

     -- Extract the other matrix of the matrix factorization
     Ml := coker substitute (presentation M0, prune ring M0);
     C := chainComplex lift (presentation Ml, ambient ring Ml);
     f := (mingens ideal ring Ml)_0_0;
     B0 := substitute ((nullhomotopy (f * id_C))_0, ring M0);
     
     if (B0*A0 != 0) then error "B0 A0 is not zero";
     if (A0*B0 != 0) then error "A0 B0 is not zero";
     
     OY := target phi;
     OSigma := source phi;
     pIdeal := phi(ideal vars OSigma);

     d := HomBoundaryMaps (A0, B0);
     Ext2BasisVect := ComputeExtBasisVectors (A0, B0, 0);

     dimExt2 := numgens source Ext2BasisVect;
     obstruction := toList (dimExt2 : 0_(OY/pIdeal));

     (Ext1, Ext1degs) := ComputeExtBasis (A0, B0, 1);
     
     (OSAmbient, OYxSAmbient) := ConstructAmbientRing (OY, OSigma, Ext1degs, pIdeal);
     (A,B) := FirstDeformation (OYxSAmbient, pIdeal, A0, B0, d, Ext1, Ext2BasisVect);
     
     pIdeal = substitute(pIdeal, OYxSAmbient);

     for i from 2 to o.DegreeLimit do
            (
		 local done;
		 (A,B,obstruction,done) = ExtendDeformation (OYxSAmbient, pIdeal, i, A, B, d, length Ext1, Ext2BasisVect, obstruction);
        	 if done then break);

     OYAmbientxSAmbient := ambient OYxSAmbient;
     OYAmbientxS := (OYAmbientxSAmbient) / ideal (obstruction / (f -> substitute (f, ambient OYAmbientxSAmbient)));
     OS := (OSAmbient) / ideal (obstruction / (f -> substitute (f, OSAmbient)));
     (OS, coker substitute (A, OYAmbientxSAmbient))
)

-- deformMCMModule
--
-- Deform a maximal Cohen-Macaulay module on a hypersurface. Return
-- the resulting matrix factorization and the obstruction.
deformMCMModule(Module) := o -> (M0) -> (
     R := ring M0;
     OSigma := QQ[];
     phi := map (R, OSigma, matrix (R, {{}}));
     return deformMCMModule (M0, phi, o)
)

beginDocumentation()

document {
     Key => ModuleDeformations,
     Headline => "versal deformations of modules on hypersurfaces",
     "Given a regular element ", TEX "$ f $", " in ", TEX "$ R $", ", ", TEX "$ R $",
     " a regular ring, a ", ITALIC "matrix factorisation", " of ", TEX "$ f $",
     " is a pair ", TEX "$ (A,B) $", " of square matrices of the same size ",
     "over ", TEX "$ S $", " such that ", TEX "$ AB = fI = BA $", ", where ", TEX "$ I $",
     " is the identity matrix of the same dimension. ",
     "Matrix factorisations of ", TEX "$ f $", " are equivalent to maximal ",
     "Cohen-Macaulay (MCM) modules on the hypersurface defined by ",
     TEX "$ f $", ": given a matrix factorisation ", TEX "$ (A,B) $", " of ",
     TEX "$f$", ", the cokernel of ", TEX "$ A $", " is an MCM-module over ",
     TEX "$ S/(f) $", ", and all MCM-modules over ", TEX "$ S/(f) $", " arise in this way. ",
     PARA {},
     "Let ", TEX "$ X $", " be a germ of a hypersurface at a point 0 and ", TEX "$ M_0 $",
     " be a maximal Cohen-Macaulay module over ", TEX "$ X $", ". Let ", TEX "$ Y \\rightarrow{} \\Sigma $",
     " a flat map of germs of affine varieties at 0 whose fibre over 0 of ", TEX "$\\Sigma$", " is isomorphic to ",
     TEX "$X$", ". A ", ITALIC "deformation", " of ", TEX "$ M_0 $", " (in the deformation theory defined by the map ",
     TEX "$ Y \\rightarrow{} \\Sigma $", ") is a pair ",
     TEX "$ (S,M) $", " with ", TEX "$ S $", " a germ equipped with a map ",
     TEX "$ S \\rightarrow{} \\Sigma $", " and ", TEX "$ M $", " a module over ", TEX "$ S \\times_\\Sigma Y $",
     " flat over ", TEX "$ S $", ", whose restriction to ", TEX "$ 0 \\times_\\Sigma X $",
     " is isomorphic to ", TEX "$ M_0 $", ".",
     PARA {},
     "A deformation ", TEX "$ (T,M') $", " is ", ITALIC "induced from", TEX "$ (S,M) $",
     " if there exists a map ", TEX "$ \\phi:T \\rightarrow{} S $", " commuting with the maps ",
     TEX "$ T \\rightarrow{} \\Sigma $", " and ", TEX "$ S \\rightarrow{} \\Sigma $", " and such that ",
     TEX "$ M' $", " is isomorphic to ", TEX "$ (\\phi \\times_\\Sigma id_Y)*M $", ".",
     PARA {},
     "The deformation ", TEX "$ (S,M) $", " is ", ITALIC "versal",
     " if any deformation of ", TEX "$ M_0 $", " is induced from ", TEX "$ (S,M) $", ".",
     PARA {},
     "In this package, a germ is represented as the coordinate ring ", TEX "R", " of an affine variety ",
     "and the distinguished point 0 of a germ is assumed to be the ideal generated by the ",
     "variables of ", TEX "R", ". It is an error if the ideal generated by the variables of ",
     TEX "R", " is not prime, e.g. if it is all of ", TEX "R", ".",
     PARA {},
     "This package contains two entry points. One interface may be used only in the ",
     ITALIC "absolute", " case, where ",
     TEX "$ \\Sigma $", " is a reduced point, and the module ", TEX "$ M_0 $",
     " is deformed over ", TEX "$ Y $", " only. The other interface may be used when ",
     TEX "$ \\Sigma $", " is the base space of a nontrivial deformation of ",
     TEX "$ X $", " and ", TEX "$ Y $", " is the total space of the deformation. ",
     "In such a case, ", TEX "$ M_0 $", " is deformed also along the given deformation of ",
     TEX "$ X $", ".",
     PARA {},
     "The implementation has been designed to take advantage of graded ",
     "structure when available. Thus the user is highly recommended to ",
     "assign degrees to the inputs so as to make the rings, ",
     "homomorphism, and deformation module homogeneous when ",
     "possible. Doing so may greatly improve performance."
}
document {
     Key => {deformMCMModule},
     Headline => "versal deformation of MCM-module on hypersurface",
     "This is the main interface for the package ", TO "ModuleDeformations",
     ". It has two signatures: one for the absolute case and one for the general case. Both ",
     "versions return a pair ", TT "(S,M)", "where ", TT "S", " is a ring ",
     "representing the base space of the deformation and ", TT "M", " is a module ",
     "representing the deformation module.",
     PARA {},
     "The module ", TEX "$M$", " is not defined ",
     "over the product ", TEX "$S \\times{} Y$", " but instead over the polynomial ",
     "ring in which ", TEX "$S \\times{} Y$", " is defined. Attempting to construct ",
     TEX "$M$", " over ", TEX "$S \\times{} Y$", " may result in computational ",
     "blowup in certain cases. Reducing ", TEX "$M$", " modulo the defining equations of ",
     TEX "$S \\times{} Y$", " gives the deformation module itself.",     
     PARA {},
     "The function ", TT "deformMCMModule", " returns an error if the given module ",
     TT "M0", " is not maximal Cohen-Macaulay, if it is not defined ",
     "over a hypersurface, or if its module ", TEX "$Ext^1(M0,M0)$", " of ",
     "first-order deformations is not finite-dimensional as a vector ",
     "space. If ", TT "M0", " is free, then ", TT "deformMCMModule",
     " returns a pair with a trivial base space ", TT "S", " and a free ",
     "module ", TT "M", " generated in the same degrees as ", TT "M0",
     ".",
     PARA {},
     "The parameters of the base space, that is, the coordinates over ",
     "which ", TT "S", " is defined, are labelled ", TT "xi_1",
     " through ", TT "xi_d", ", where ", TT "d", " is the dimension as a ",
     "vector space of the module of first-order deformations of the ",
     "module being deformed.",
     PARA {},     
     "The function ", TT "deformMCMModule", " computes a deformation only up to a ",
     "degree limit given by the optional parameter ", TT "DegreeLimit",
     ", whose default value is 10. The procedure is optimized so that ",
     "specifying too large a degree limit should not result in ",
     "substantial computational difficulties in most cases.",
}

document {
     Key => {(deformMCMModule,Module)},
     Headline => "deformation in the absolute case",
     Usage => "deformMCMModule M0",
     Inputs => { "M0" => Module => "the module to be deformed; it must be maximal Cohen-Macaulay" },
     Outputs => {
	  "S" => Ring => {"a ring representing the base space of the versal deformation of ", TT "M0"},
	  "M" => Module => {"a module representing the module of the versal deformation"}
     },
     "This interface to ", TT "deformMCMModule", " computes a ",
     "deformation in the absolute case. Its inputs consist only of the ",
     "module ", TT "M0", " to deform.",
     PARA {},
     "If ", TT "M0", " is free, then ", TT "deformMCMModule", " returns ", TT "(QQ[], M)", ", ",
     "where ", TT "M", " is isomorphic as a graded module to ",
     TT "M0", ".",
     EXAMPLE lines ///
     	 R = QQ[x,y, Degrees => {3,4}]/(x^4-y^3);
	 deformMCMModule R^1
     ///,
     PARA {},
     "The next example computes a versal deformation of the maximal ",
     "ideal of the E6 singularity. The deformation theory of this module ",
     "is equivalent to that of the residue field, whose versal deformation ",
     "is the Hilbert scheme of one point on the singularity. ",     
     EXAMPLE lines ///
     	 M0 = truncate(1,R^1)
         (S,M) = deformMCMModule M0
	 prune S
     ///,
     "The base space of the deformation is therefore isomorphic to the ",
     "singularity itself. The substitution ", TT "x => -xi_2, y => xi_1",
     " shows that this is indeed the case with the result of the computation ",
     "above.",
     PARA {},
     "The resulting module ", TEX "$M$", ", when restricted to the product of ",
     "the singularity with the base space, is isomorphic to the ideal defining the diagonal ",
     "embedding of the singularity.",
     PARA {},
     "The following example demonstrates the performance advantage of ",
     "making use of a graded structure when possible. We deform the ",
     "ideal generated by ", TEX "$ x^2, xy $", " and ", TEX "$ y^2 $",
     " of the ", TEX "$ E_6 $", " curve singularity. In ",
     "the first case, the module is input as a graded module.",
     EXAMPLE lines ///
     	 use R;  
         N0 = module ideal (x^2,y^2)
         (S,N) = time deformMCMModule N0 
	 prune S
     ///,
     "In the second case, we strip the grading from the module and rerun ",
     "the computation.",
     EXAMPLE lines ///
         N0' = coker matrix entries presentation N0
         (S',N') = time deformMCMModule N0'
	 prune S'
     ///,
     "On the author's computer, the second computation takes approximately ",
     "of 10% more processor time as the first. The user may see by ",
     "inspection that the outputs of the two computations are isomorphic. ",
     "More complicated examples, such as the square of the maximal ideal, ",
     "show a much greater difference."
}

document {
     Key => {(deformMCMModule,Module,RingMap)},
     Headline => "deformation in the relative case",
     Usage => "(S,M) = deformMCMModule(M0,phi)",
     Inputs => {
         "M0" => Module => {"the module to be deformed"}, 
         "phi" => RingMap => {"a ring homomorphism representing the map ", TEX "$\\phi : Y \\rightarrow{} \\Sigma$"} },
     Outputs => {
	  "S" => Ring => {"a ring representing the base space of the versal deformation of ", TT "M0"},
	  "M" => Module => {"a module representing the module of the versal deformation"}
	  },
     "This interface to ", TT "deformMCMModule", " constructs a versal ",
     "deformation of ", TT "M0", " in the general case. That is, there is ",
     "given a map of varieties ", TEX "$\\phi:Y \\rightarrow{}  \\Sigma$", " and a module ", TT "M0", " defined ",
     "over the fibre over 0 of ", TEX "$\\phi$", ". A versal deformation of ", TT "M0",
     " is then constructed in the deformation theory so defined. Thus its ",
     "inputs consist of ", TT "M0", " and a ring homomorphism ",
     TEX "$\\phi^*$", " representing the map ", TEX "$\\phi:Y \\rightarrow{}  \\Sigma$", ". The procedure ",
     "requires that ", TT "M0", " be an MCM module over the ring ",
     TEX "\\mathcal{O}_Y/\\phi^*(m_\\Sigma)", ", where ", TEX "m_\\Sigma",
     " is the ideal generated by the variables of ", TEX "\\mathcal{O}_\\Sigma", ". Otherwise an ",
     "error will result.",
     PARA {},
     "If ", TT "M0", " is free, then ", TT "deformMCMModule", " returns ", TT "(S,M)", ", ",
     "where ", TT "S", " is the source of ", TT "phi", " and ", 
     TT "M", " is a free module over the ambient ring of ", TT "Y", ", ",
     "generated in the same degrees as ", TT "M0", ".",
     PARA {},
     EXAMPLE lines ///
	 OSigma = QQ[x, Degrees=>{2}];
         OY = QQ[y,z,x, Degrees=>{2,3,2}]/(z^2-(y-x)*y^2);
	 phi = map(OY,OSigma, {x})
     	 use OSigma
         OX = trim (OY/phi(ideal x))
         (OS,M) = deformMCMModule(module ideal (y,z),phi)
	 prune OS
     ///,
     "The above example deforms the maximal ideal of the A2 singularity ",
     "onto the Whitney umbrella ", TEX "$Y$", " (whose ring is ", TT "OY",
     " above, of which the former is a hyperplane section given by the ",
     "fibre over 0 of the map ", TEX "$Y \\rightarrow{} \\Sigma$",
     " defined by ", TEX "$\\phi$", " above. The resulting base space ", TT "S",
     " (whose ring ", TT "OS", " is part of the output of ", TT "deformMCMModule", ") is the ",
     "Hilbert scheme of one point on the Whitney umbrella, which is ",
     "isomorphic to ", TEX "$Y$", ". The substitution ",
     TT "y => -xi_2, z => xi_1", " shows this isomorphism.",
     PARA {},
     "The resulting module ", TEX "$M$", ", when restricted to the fibre product ",
     "of ", TEX "$Y$", " and ", TEX "$S$", " over ", TEX "$\\Sigma$", ", is isomorphic to ",
     "the ideal defining the diagonal embedding of ", TEX "$Y$", "."
}

document {
     Key => [deformMCMModule, DegreeLimit],
     Headline => "Compute only up to this exponent",
     "This parameter is an integer ", TEX "$ n $", " such that in the result of the computation ",
     "the versality criterion holds only after reducing the relevant rings modulo ",
     "the maximal homogeneous ideal to the power ", TEX "$ n+1 $", ". Concretely, this means ",
     "that the output may have incorrect terms with total exponent greater than ", TEX "$ n $",
     ". If the input is positively ",
     "graded, all deformation parameters have strictly positive degree, and ",
     TEX "$ n $", " is sufficiently large, then no terms of degree greater than ",
     TEX "$ n $", " appear in the output, and the result is versal. In this case, the maximum ",
     "of ", TEX "$ d / deg x $", " where ", TEX "$ d $", " is the degree of the equation of the ",
     "hypersurface and ", TEX "$ x $", " ranges over all variables in the ring of the hypersurface and ",
     "all deformation parameters, should suffice."
     }

document {
     Key => {xi},
     Headline => "Indexed variable of deformation parameters"
     }

TEST ///
R=QQ[x,y,Degrees=>{2,3}]/(x^3-y^2);
(S,M)=deformMCMModule(module ideal (x,y));
RS=ring M
RSp=ring M / ideal (RS_0 + RS_3, RS_1 - RS_2)
ideal R
ideal S
assert (substitute (ideal R, RSp) == substitute (ideal S, RSp))
I=ideal (mingens substitute (ideal R, RS) + mingens substitute (ideal S, RS))
assert (I == ideal det presentation M)
///

TEST ///
OSigma=QQ[x,Degrees=>{2}]
OY=QQ[y,z,x,Degrees=>{2,3,2}]/(z^2-(y-x)*y^2)
phi=map(OY,OSigma,matrix({{x}}))
use OSigma 
OX=trim (OY/phi(ideal x))
(S,M)=deformMCMModule(module ideal (y,z),phi)
RS=ring M
RSp=ring M / ideal (RS_0 + RS_4, RS_1 - RS_3)
assert (substitute (ideal OY, RSp) == substitute (ideal S, RSp))
I=ideal (mingens substitute (ideal OY, RS) + mingens substitute (ideal S, RS))
assert (I == ideal det presentation M)
///

TEST ///
R=QQ[x,y,Degrees=>{3,4}]/(x^4-y^3);
(S,M)=deformMCMModule(module ideal (x^2,y));
assert (isHomogeneous S)
assert (isHomogeneous M)
assert (numgens trim ideal S == 2)
assert (codim ideal S == 2)
assert (codim trim minors (2, jacobian S) == 1)
///


end
--------------------------------------------------------------------------------
restart
uninstallPackage "ModuleDeformations"
installPackage "ModuleDeformations"
check "ModuleDeformations"

needsPackage "ModuleDeformations"
R = QQ[x,y,Degrees=>{3,4}]/(x^4-y^3)
deformMCMModule(module ideal(x^2,y))
x


R = QQ[x,y, Degrees => {3,4}]/(x^4-y^3);
deformMCMModule R^1
M0 = truncate(1,R^1)
(S,M) = deformMCMModule M0
prune S
use R;  
N0 = module ideal (x^2,y^2)
(S,N) = time deformMCMModule N0 


restart
needsPackage "ModuleDeformations";
R = QQ[x,y, Degrees => {3,4}] / (x^4-y^3);
deformMCMModule(module ideal(x^2,y));
xi
xi_1
x
use o3_0
xi
xi_1

restart
needsPackage "ModuleDeformations";
R = QQ[x,y, Degrees => {3,4}] / (x^4-y^3);
(S,M) = deformMCMModule(module ideal(x^2,y));
xi
xi_1
x




--------------------------------------------------------------------------------
restart
needsPackage "ModuleDeformations";
R = QQ[x,y, Degrees => {3,4}] / (x^4-y^3);
(OS,M) = deformMCMModule module ideal (x,y);
describe OS
M
presentation module ideal (x,y)


OSigma = QQ[x, Degrees => {2}];
OY = QQ[y,z,x, Degrees => {2,3,2}] / (z^2-(y-x)*y^2);
phi = map(OY, OSigma, matrix {{x}});
OX = trim (OY / phi ideal OSigma_0);
(S,M) = deformMCMModule(module ideal (y,z), phi);
describe S
M

OSigma = QQ[a_2, Degrees => {2}];
R = QQ[a_2,a_3,a_4, Degrees => {2,3,4}] / 
  ideal(a_4^3-a_3^4+6*a_2*a_3^2*a_4-6*a_2^2*a_4^2-2*a_2^3*a_3^2+9*a_2^4*a_4);
phi = map(R,OSigma, matrix {{a_2}});
use OSigma
Rtilde = R / phi ideal OSigma_0;
(S,M) = deformMCMModule(module (ideal (a_3,a_4))^2, phi);
ambient S
degrees S
dim S
numgens trim ideal S