-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCompleteIntersectionResolutions.m2
3901 lines (3524 loc) · 101 KB
/
CompleteIntersectionResolutions.m2
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
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
newPackage(
"CompleteIntersectionResolutions",
Version => "0.7",
Date => "Feb 2013",
Authors => {{Name => "David Eisenbud",
Email => "[email protected]",
HomePage => "http://www.msri.org/~de"}},
Headline => "Analyzing Resolutions over a Complete Intersection",
PackageExports => {"BGG"},
DebuggingMode => true
)
export{
--some utilities
hf,
submoduleByDegrees,
submatrixByDegrees,
toArray,
--things related to complete intersection resolutions
ExtModule,
evenExtModule,
oddExtModule,
ExtModuleData,
makeT,
isSurjCIOperator,
splittings,
splitResolution,
decomposeResolution,
cosyzygy,
matrixFactorization,
Check, -- optional arg for matrixFactorization
-- BRanks,
Branks,
-- BMatrices,
Bmats,
Amats,
mfBound,
highSyzygy,
Optimism, -- optional arg for highSyzygy
finiteBettiNumbers,
infiniteBettiNumbers,
makeHomotopies,
makeHomotopies1,
exteriorTorModule,
TateResolution,
makeModule,
isLinear,
freeExteriorSummand,
S2,
twoMonomials,
sumTwoMonomials,
moduleAsExt
}
truncate(ZZ, ChainComplex) := (i, GG) ->(
chainComplex(apply(length GG - i, j->GG.dd_(i+j+1)))
)
hf=(range, m)->(
apply(range,i->hilbertFunction(i, m)))
ExtModule = method()
ExtModule Module := M -> (
--If M is a module over a complete intersection R
--of codim c, the script returns
--Ext^*(M,(ring M)^1/(ideal vars ring M))
--graded in POSITIVE degrees
--as a module over the polynomial ring kk[X_1..X_(codim R)],
--where the vars have degree 2
R := ring M;
kk := coefficientRing R;
kkk := (ring M)^1/(ideal vars ring M);
E := Ext(M,kkk);
TE := ring E;
c := numgens source presentation R;
X := local X;
T := kk[X_0..X_(c-1), Degrees => toList(c:{2})];
v := map(T,
ring E,
vars T | matrix{toList ((numgens R):0_T)},
DegreeMap => i -> {-first i} );
prune coker v presentation E)
///
restart
needsPackage "CompleteIntersectionResolutions"
kk = ZZ/101
S = kk[a,b,c]
R = S/ideal"a2,b3,c4"
M = R^1/ideal"a,b,c"
E = ExtModule M
///
evenExtModule = method()
evenExtModule Module := M -> (
--If M is a module over a complete intersection R
--of codim c, the script returns
--Ext^(even)(M,(ring M)^1/(ideal vars ring M))
--as a module generated in degree 0
--over the polynomial ring kk[X_1..X_(codim R)],
--where the vars have degree 1
E := ExtModule M;
P := positions(flatten degrees E, even);
Ee:=prune image (E_P);
T := ring E;
kk:= coefficientRing T;
X := symbol X;
T1 := kk[X_0..X_(numgens T -1)];
v1 := map(T1, T, vars T1, DegreeMap => i->{(first i)//2});
coker v1 presentation Ee
)
oddExtModule = method()
oddExtModule Module := M -> (
--If M is a module over a complete intersection R
--of codim c, the script returns
--Ext^(odd)(M,(ring M)^1/(ideal vars ring M))
--as a module generated in degree 0
--over the polynomial ring kk[X_1..X_(codim R)],
--where the vars have degree 1
E := ExtModule M;
P := positions(flatten degrees E, odd);
Eo:=prune image (E_P);
T := ring E;
kk:= coefficientRing T;
X := symbol X;
T1 := kk[X_0..X_(numgens T -1)];
v1 := map(T1, T,vars T1, DegreeMap => i->{(first i)//2});
coker v1 presentation Eo
)
ExtModuleData = method()
ExtModuleData Module := M -> (
--Suppose that M is a module over a complete intersection R
--of codim c, so that
--E := ExtModule M
--is a module generated in degrees >=0
--over a polynomial ring T
--generated in degree 2, and
--E0 := evenExtModule M and
--E1 := oddExtModule M
--are modules generated in degree >= 0
-- over a polynomial ring T' with generators
--in degree 1.
--
--The script returns
--{E0,E1,reg0,reg1}
--where regi = regularity Ei
--and prints a message if reg0 != reg1
--If we set r = max(2*reg0, 1+2*reg1),
--and F is a resolution of M, then
--coker F.dd_(r+1)
--is the first szygy module of M such that
--regularity evenExtModule M =0 AND
--regularity oddExtModule M =0
--We have been using regularity ExtModule M
--as a substitute for r,
--but that's not always the same.
E := ExtModule M;
P0 := positions(flatten degrees E, even);
P1 := positions(flatten degrees E, odd);
E0':=prune image (E_P0);
E1':=prune image (E_P1);
T' := ring E;
kk:= coefficientRing T';
X := symbol X;
T := kk[X_0..X_(numgens T' -1)];
v1 := map(T, T' ,vars T, DegreeMap => i->{(first i)//2});
E0 := coker v1 presentation E0';
E1 := coker v1 presentation E1';
r0 := max(0, regularity E0);
r1 := max(0, regularity E1);
--I've temporarily commented out the following because
--of the bug in Ext (12/29/12)
{* if abs(r0-r1)>1 then (
<<"regularities of even and odd Ext modules differ by more than 1" <<endl;
<<"module with presentation matrix" <<endl;
<<toString presentation M);
*}
{E0,E1,r0,r1}
)
///
restart
uninstallPackage "CompleteIntersectionResolutions"
installPackage "CompleteIntersectionResolutions"
viewHelp ExtModuleData
viewHelp "CompleteIntersectionResolutions"
///
makeT = method()
makeT(Matrix, ChainComplex,ZZ) := (F,G,i) ->(
{*
If F is an m x 1 matrix and
G is a resolution of a module at least up to the i-th step,
over R = S/(ideal F),
of codim c this returns a list of the c ci-operators
G_i \to G_{i-2}
corresponding to the entries of F.
*}
c := numcols F;
degsF := flatten((degrees F)_1);
R := ring G;
S := ring F;
d0 := sub(G.dd_i, S);
d1 := sub(G.dd_(i-1), S);
Gtar := target d1;
Gsour := source d0;
d2 := d1*d0;
utemp := local utemp;
u := apply(c,i ->(
utemp = map(S^{-degsF_i}**Gtar, Gsour, d2//((target d2)**F_{i}));
d2 = d2 - utemp**F_{i};
utemp));
--check: is d1*d0 = sum F_{i}*u_i
if d1*d0 != map(Gtar, Gsour, sum(c, i-> u_i**F_{i})) then
error{"doesn't add up"};
ret := map(R,S);
apply(u, u1 -> ret u1)
)
--ADDED Oct 30.
--the following is a still untested version keeping one of
--the differentials. We could just do it when
--the G complex is already decomposed, and use the lifting
--as a direct sum, and define the u0 map directly as a projection,
--but it may not matter.
--The plan: To get consistent t's, we'd do this for the top map in
--the complex, then use the components to define the other t's.
makeT(Matrix, ChainComplex,Matrix, ZZ) := (F,G,t0,i) ->(
{*
If F is a c x 1 matrix and
G is a resolution of a module at least up to the i-th step,
over R = S/(ideal F),
of codim c this returns a list of the c ci-operators
G_i \to G_{i-2}
corresponding to the entries of F,
keeping t0 as the first of them.
*}
c := numcols F;
degsF := flatten((degrees F)_1);
R := ring G;
S := ring F;
d0 := sub(G.dd_i, S);
d1 := sub(G.dd_(i-1), S);
u0 := sub(t0,S);
Gtar := target d1;
Gsour := source d0;
d2 := d1*d0;
utemp := local utemp;
u := apply(toList(1..c-1),i ->(
utemp = map(S^{ -degsF_i}**Gtar, Gsour, d2//((target d2)**F_{i}));
d2 = d2 - utemp**F_{i};
--assert(isHomogeneous utemp);
utemp));
u = {u0}|u;
--check: is d1*d0 = sum F_{i}*u_i
if d1*d0 != map(Gtar, Gsour, sum(c, i-> u_i**F_{i})) then error{"doesn't add up"};
ret := map(R,S);
apply(u, u1 -> ret u1)
)
///
restart
loadPackage ("CompleteIntersectionResolutions", Reload=>true)
kk= ZZ/101
S = kk[x,y,z]
F = matrix"x3,y3"
R = S/ideal F;
M = coker random(R^{0,-1}, R^{-2,-4,-5});
G = res(M, LengthLimit =>10)
assert(isHomogeneous ((makeT(F,G,5))_0))
r = isSurjCIOperator(F,G)
M = coker random(R^{0,-1}, R^{-2,-4,-5});
M = R^1/ideal"x2, yz"
high = 10
low = r-2
E = decomposeResolution(F,G,low,10);
betti E
components E_10
(10-low)//2
A = new Array from 1..(10-low)//2
t0=E_10^A
T = makeT(F,E,t0,10);
T_0
T_1
--The components of E_i are numbered 0..(i-low)//2
--The sum of the first i components
--is the kernel of the i-th iteration of t
--(where the t_low and t_(low+1) are replaced by 0).
--note that t:G_i-->G_(i-2)(-degf) is now the projection
--E_i^[1..#(components G_i)-1]
///
isSurjCIOperator = method()
isSurjCIOperator(Matrix, ChainComplex, ZZ) := (F,G,i) ->(
{*
Assuming that G is a resolution over a complete intersection
S/ideal F with
F = matrix{{f1, f2, ...}}
returns "true" iff the operator G_i -> G_(i-2)
"corresponding to f1" is surjective.
*}
v := (makeT(F,G,i))_0;
0 == coker v
)
isSurjCIOperator(Matrix, ChainComplex) := (F,G) ->(
{*
Assuming that G is a resolution over a complete intersection
S/ideal F with
F = matrix{{f1, f2, ...}}
returns the smallest integer i
so that the operator
G_j -> G_(j-2)
"corresponding to f1"
is surjective for all i\leq j\leq length G.
Question: is it enough to check this up to the regularity of
Ext?
*}
r := length G;
if not isSurjCIOperator(F,G,r) then return -1;
for j from 0 to r-2 do
if not isSurjCIOperator(F,G,r-j) then return r-j+1;
2
)
///
restart
loadPackage "CompleteIntersectionResolutions"
kk= ZZ/101
S = kk[x,y,z]
F = matrix"x3,y3"
R = S/ideal F;
M = coker random(R^{0,-1}, R^{-2,-4,-5});
G = res(M, LengthLimit =>3)
isSurjCIOperator(F,G)
G = res(M, LengthLimit =>4)
isSurjCIOperator(F,G)
G = res(M, LengthLimit =>10)
isSurjCIOperator(F,G)
///
splittings = method()
splittings (Matrix, Matrix) := (a,b) -> (
{*
Assuming that (a,b) are the maps of a right exact
sequence
a b
0--> A ----> B ----> C ----> 0
with B, C free,
-- the script produces a list {tau,sigma}
the script produces a list {sigma, tau)
sigma: B --> A a splitting of a and
with tau: C --> B a splitting of b;
that is
a*sigma+tau*b = 1_B
sigma*a = 1_A
b*tau = 1_C
*}
if not isFreeModule source b then error("source b not free");
if not isFreeModule target b then error("target b not free");
(tau,remtau) := quotientRemainder(id_(target b),b);
if remtau !=0 then error("second map not splittable");
(sigma,remsigma) := quotientRemainder(id_(source b) - (tau*b),a);
if remsigma !=0 then error("first map not splittable");
{map(source a, target a, sigma), map(source b, target b,tau)}
)
///
restart
loadPackage "CompleteIntersectionResolutions"
kk= ZZ/101
S = kk[x,y,z]
t = random(S^{2:-1,2:-2}, S^{3:-1,4:-2})
t = id_(S^2)
betti t
isSurjective t
ss = splittings(syz t, t)
ss/betti
(A,B) = (syz t, t)
spl = splittings(A,B)
sigma = spl_0; tau=spl_1;
assert(A*sigma+tau*B == id_(source B));
assert(sigma*tau==0);
assert(B*tau == id_(target B));
assert(sigma*A == id_(source A));
///
splitResolution = method()
splitResolution(Matrix, ChainComplex, List) := (F,G,L)->(
{*
L is a list of integers corresponding
to spots in the resolution G over a complete
intersection R = S/ideal F, where F = matrix{{f0..fn}}.
Assumes that the operators
t_i: G_i --> G_(i-2)
corresponding to f0 are
surjective for all i in L.
computes s_i = ker t_i and splittings
sigma_i: G_i --> source s_i
tau_i : cover image t_i --> G_i
returns the list of quadruples
apply(L, i->
{s_i, sigma_i, tau_i,t_i}
)
t,s,sigma, tau implements the decomposition of G, in the sense that:
s_i = ker t_i,
sigma_i*s_i = 1,
t_i*tau_i = 1 (on G_(i-1) twisted by the degree of f0)
s_i*sigma_i + tau_i*t_i = 1_(G_i)
sigma_i * tau_i = 0
*}
t := apply(L, i->(makeT(F,G,i))_0);
--check whether the t's are surjective
apply(#L, i-> if 0 != coker t_i then
(print i;
error"operator not surjective at this stage"
));
--compute the maps decomposing the resolution relative
--to t_i for i in L.
s := apply(#L, i-> map(source t_i, , syz t_i));
--assert(isHomogeneous s_0);
Si := {};
splits := apply(#L, i->(Si = splittings(s_i,t_i);
assert(Si_0*s_i == id_(source s_i)); -- Si_0 == sigma_i
assert(t_i*Si_1 == id_(target t_i)); -- Si_1 == tau_i
{s_i, Si_0, Si_1,t_i}));
splits
)
--The following versio takes the low and high elements of L,
--returns a list where only the indices low to high are set,
--the others === null.
splitResolution(Matrix, ChainComplex, ZZ,ZZ) := (F,G,low, high)->(
L := toList(low..high);
s := new MutableList from {};
ss := splitResolution(F,G,L);
scan(L, i->s#i = ss_(i-low));
toList s)
///
restart
loadPackage "CompleteIntersectionResolutions"
kk= ZZ/101
S = kk[x,y,z]
F = matrix"x3,y3"
R = S/ideal F;
M = coker random(R^{0,-1}, R^{-2,-4,-5});
G = res(M, LengthLimit =>10)
ss1 = splitResolution(F,G,toList(5..7))
ss = splitResolution(F,G,5,7)
#ss
assert (ss1_0==ss_5)
///
decomposeResolution = method()
decomposeResolution(Matrix, ChainComplex,ZZ,ZZ) :=(F,G,low, high) ->(
{* F=matrix{{f0..fn}} is a matrix of a regular sequence in a poly ring S.
G is a resolution over R:=S/ideal F.
G_lower and G_upper are modules in the resolution G such that
f_0 defines a surjective
ci-operator t_i: G_i > G_(i-2) for each i = low+2..high.
(Really this is the CI operator defined by f1..fn.)
(thus low must be at least isSurjCIOperator(F,G) -2.)
The script computes
s_i: ker t_i > G_i
and chooses splittings
sigma_i: G_i > ker t_i
Setting K_i = source s_i = ker t_i,
we thus have G_i \cong K_i ++ K_(i-2) ++...
The script returns a copy E of the complex G
written in terms of this splitting,
so that the map K_(i-2j) > K_(i-1-2m) induced by G.dd_i
is (E.dd_i)^[j]_[m]. In particular, the map t:G_i>G_(i-2)
becomes
(E.dd_i)^[1,2,..]
The components of E_i are numbered 0..(i-low)//2
The sum of the first i components
is the kernel of the i-th iteration of t
(where the t_low and t_(low+1) are replaced by 0).
*}
R := ring G;
degf := (degree (flatten entries F)_0)_0;
L := toList(low+3..high);
L0 := toList(low+2..high);
L1 := toList(low..high);
L2 := toList(low+1..high);
ss := splitResolution(F, G, low+2, high);
--returns list of quadruples {s,sigma,tau,t}
--with s = ker t, sigma a splitting of s and tau a splitting of t.
s := new MutableList from {};
sigma := new MutableList from {};
t := new MutableList from {};
scan(L0, i-> (
s#i=ss_i_0;
sigma#i = ss_i_1;
t#i = ss_i_3));
--make a list of the building blocks of the resolution,
--which are the kernels of the operators t corresponding to f0
K := new MutableList;
K#(low) = G_(low);
sigma#(low) = id_(K#(low));
K#(low+1) = G_(low+1);
sigma#(low+1) = id_(K#(low+1));
scan(L0, i-> K#i = source s#i);
--now form the free modules
GG := new MutableList from {};
GG#(low) = R^{-low}**K#low;
GG#(low+1) = R^{-low}**K#(low+1);
scan(L0, i-> GG#i =
directSum apply(toList(0..(i-low)//2),
j->R^{ -low-j*degf}**K#(i-2*j))
);
--and the maps that will be isomorphisms from old to new
iso:= new MutableList from {};
maplist :={};
mati := local mati;
iso#(low) = id_(GG#(low));
iso#(low+1) = id_(GG#(low+1));
scan(L0, i-> (maplist = apply(toList(0..(i-low)//2),
j->(
(sigma#(i-2*j))*
product apply (toList(0..j-1),m->
t#(i-2*(j-1)+2*m))));
mati = maplist_0;
for u from 1 to #maplist-1 do mati =
mati || maplist_u;
iso#i = map(GG#i, G_i,mati))
);
--finally, move the differential to the new resolution
--via the isomorphisms.
H := chainComplex apply(L2,
i->(iso#(i-1))*G.dd_i*((iso#i)^(-1)));
H[-low]
)
///
restart
loadPackage "CompleteIntersectionResolutions"
kk= ZZ/101
S = kk[x,y,z]
F = matrix"x3,y3"
R = S/ideal F;
M = coker random(R^{0,-1}, R^{-2,-4,-5});
M = R^1/ideal"x2, yz"
high = 10
G = res(M, LengthLimit =>high)
r = isSurjCIOperator(F,G)
low = r-2
E = decomposeResolution(F,G,low,10);
betti E
betti G
betti E == betti truncate(low,G)
--The components of E_i are numbered 0..(i-low)//2
for i from low to high do
assert(#components E_i == ((i-low)//2)+1)
--The sum of the first i components
--is the kernel of the i-th iteration of t
--(where the t_low and t_(low+1) are replaced by 0).
#components E_9
--component({1},{0}, E.dd_10)
E.dd_10
(E_7)_[0]--inclusion of the kernel of t
(E_6)^[1]--projection to first factor, in this case = t.
(E_10)_[0,1,2] -- kernel of the third iterate t^3: E_10 -> E_4
--note that t:G_i-->G_(i-2)(-degf) is now the projection onto
--E_i^[1..#(components G_i)-1]
-- also, each differential is an explicit component of the one
--two steps further up.
for i from 5 to 10 do assert(
(R^{ -3}**E.dd_(i-2))==
E_(i-1)^(splice[(1..#(components E_(i-1))-1)])*
((E.dd_i)*
((E_i)_(splice[(1..#(components E_i)-1)])))
)
--further, the sub-diagonal blocks of the differential are zero
betti E.dd_i
betti (R^{ -3}**E.dd_(i-2))
for p from 0 to #components E_10 -1 do
for q from 0 to p-1 do
assert (0==component({p}, {q}, E.dd_10))
///
toArray = method()
toArray List := L -> splice [toSequence L]
toArray ZZ := n->[n]
///
component = method()
component(List, List, Matrix) := (Ltar, Lsour, m) ->(
{*Checks that m is a map between direct sum modules
with components corresponding to the elements of Ltar
and Lsour, and returns the submatrix corresponding to
those components.
*}
cs := components source m;
ct := components target m;
if min Lsour<0 or max Lsour > #cs-1 then
error"not enough components in source";
if min Ltar<0 or max Ltar > #ct-1 then
error"not enough components in target";
((target m)^(toArray Ltar)) * m * ((source m)_(toArray Lsour))
)
///
///
toArray 5
toArray {3,5,6}
toArray {a,b,c}
kk= ZZ/101
S = kk[x,y,z]
A= (matrix"x2"|matrix"xy")||matrix"y2"|matrix"2x2"
B = map(S^1++S^1, S^{-2}++S^{-2}, A)
component({1},{0,1},B)
truncate(ZZ, ChainComplex) := (low, G) -> (
GG := chainComplex apply(toList(low+1..length G), i->G.dd_i);
(ring G)^{-low}**GG[-low])
///
///
restart
loadPackage "CompleteIntersectionResolutions"
kk= ZZ/101
S = kk[x,y,z]
F = matrix"x3,y3"
R = S/ideal F;
M = coker random(R^{0,-1}, R^{-2,-4,-5});
--M = R^1/ideal"x2, yz"
high = 10
G = res(M, LengthLimit =>high)
r = isSurjCIOperator(F,G)
low = r-2
betti truncate(low, G)
betti G
E = decomposeResolution(F,G,low,10);
///
transpose Module := M -> coker transpose presentation M
--this is Auslanders transpose functor
cosyzygy = method()
cosyzygy (ZZ,Module) := (p,M)-> (
--returns a p+1-step resolution F of the
--p-th cosyzygy of M (so F.dd_p is the presentation
--matrix of M.)
--This is zero if the module
--is annihilated by a nonzerodivisor. Makes most sense for
--and MCM over a Gorenstein ring.
E:=res (transpose M, LengthLimit => p+1);
chainComplex apply(p+1, j->transpose E.dd_(p+1-j))
)
cosyzygy Module := M -> cosyzygy(2,M)
///
restart
loadPackage "CompleteIntersectionResolutions"
--Example3
S = kk[a,b,c]
ff = (vars S)^[3]
ff1 = random(S^1, S^{3: -1})
R = S/ideal ff;
M0= R^1/ideal"ab"
regularity ExtModule M0
len = 14
betti (FF = res(M0, LengthLimit => len))
M = coker (FF.dd_len)
betti presentation M
betti ((cosyzygy(2, M)).dd_3)
betti (cosyzygy(2, M))
///
matrixFactorization = method(Options=>{Check => true})
matrixFactorization(Matrix, Module) := opts -> (ff, M) -> (
--Inputs:
--ff = {{f1,..,fc}} is a 1 x c matrix
--whose entries are a sufficiently
--general regular sequence in S.
--R#c := S/(ideal ff).
--M an R#c-module that is a high syzygy over R#c.
--
--If opts#check == true (the default value) then various
--tests are performed along the way.
--Outputs:
--d: a triangular map of direct-sum modules,
--the matrix factorization differential.
--
--h: a hashTable where the h#p are maps of direct sum modules.
--the partial homotopies.
--
--Description:
--Atar#p = (target BS#1++..++target BS#p)
--Asour#p = (source BS#1++..++source BS#p), and
--
--d: Atar#c <-- Asour#c
--and h#p: Asour#p <--- Atar#p over S.
--The map
--d is a special upper triangular
--lifting to S of the presentation matrix
--of M over R#c.
--
--The map h#p is a homotopy for ff#p on the restriction
--dpartial#p: Atar#p <-- Asour#p of d, over the ring R#(p-1),
--so dpartial#p * h#p = ff#p mod (ff#1..ff#(p-1).
--
--In addition, h#p * dpartial#p induces f#p on B1#p.
--
--Notation:
--B1#i is the i-th matrix (ie, complex)
--of the matrix factorization tower,
--regarded as a map over R#(i-1);
--A#(p-1) is the matrix over R#p obtained inductively
--as the induced map on the complex
--ker A1#(p) -->> B1#(p), where A1#p is A#p lifted to R#(p-1).
--inc#(p,0): source A#(p-1) \to source A#p -- inclusion
--inc'#(p,0): splits inc#(p,0)
--inc#(p,1) and inc'#(p,1): same for targets
--proj#(p,0):source A1#p -->> source B1#p
--proj'#(p,0):its splitting
--proj#(p,1), proj'#(p,1): same for targets.
--Initialize local variables
spl:= null; -- a dummy variable for splittings
h := new MutableHashTable;
A := new MutableHashTable;
A1 := new MutableHashTable;
--A1#p is A#p substituteed into R#(p-1)
B1 := new MutableHashTable;
--B1#p would be B#p over R#(p-1) (there is no B)
BS := new MutableHashTable; --same over S
dpartial := new MutableHashTable;
psi:= new MutableHashTable;--psi#p: B1#p-->target A#(p-1)
psiS:= new MutableHashTable;--psi#p: B1#p-->target A#(p-1)
inc := new MutableHashTable; --the #p versison are over R#(p-1)
inc' := new MutableHashTable;
inc'S := new MutableHashTable;
proj := new MutableHashTable;
projS := new MutableHashTable;
proj' := new MutableHashTable;
E := null; -- cosyzygy complex over R#p
E1 := new MutableHashTable;
--E1#i will be E.dd_i substituted into R#(p-1)
--Substance begins HERE.
fail := false; --flag to escape if a CI op is not surjective
--Put the regular sequence and the factor rings into hash tables:
--ci#i is the i-th element; R#i is codim i.
c := numcols ff;
S := ring ff;
ci := hashTable apply(toList(1..c),
p->{p,ff_{p-1}});--values are 1x1 matrices
degs := hashTable apply(toList(1..c),
p->{p,(degree ci#p_0_0)_0});--values are ZZ
R := hashTable apply(toList(0..c),
p->(if p==0 then {0,S}
else {p,S/ideal apply(toList(1..p), j->ci#(j))}));
--MAIN LOOP: work from p = c down to p = 1, creating the B1#p etc
A#c = presentation M; --initialize
scan(reverse toList(1..c), p->(
E = cosyzygy(2, coker A#p);
--sub into R#(p-1)
A1#p = substitute (A#p, R#(p-1));
scan(toList(1..3), i->E1#i = sub(E.dd_i,R#(p-1)));
--define the ci operators proj#(p,j), A1#c --> B#c
--and their kernels inc#(p,j) over R#(c-1).
scan(2, j->(
proj#(p,j) = map(R#(p-1)^{ -degs#p}**target E1#(j+1),
source E1#(j+2),
E1#(j+1)*E1#(j+2)//((target E1#(j+1)**ci#p)));
inc#(p,j) = syz proj#(p,j)
));
--if one of the proj#(p,j) is not surjective then
--set fail = true and break from loop
scan(2,j->
if not isSurjective proj#(p,j) then(
<< "CI operator not surjective at level codim " << c << endl;
<< "on example M = coker " << endl;
<<toString presentation M <<endl;
fail = true;
break;
));
if fail == true then break;
--make the splittings to/from A1#p, over R#(p-1)
scan(2, j-> (
spl :=splittings(inc#(p,j),proj#(p,j));
inc'#(p,j) = spl_0;
proj'#(p,j) = spl_1));
--make B1#p, A#(p-1), and
--the map psi#p: source B1#p -> target A1#(p-1)
B1#p = proj#(p,0)*A1#p*proj'#(p,1); -- B#p over R#(p-1)
A#(p-1) = inc'#(p,0)*A1#p*inc#(p,1);
psi#p = inc'#(p,0)*A1#p*proj'#(p,1);
));
--END OF MAIN LOOP
--Now put together the maps for output. All the work is done except
--for the creation of the homotopies.
if fail == true then return("cannot complete MF");
--lift all the relevant maps to S
scan(toList(1..c), p-> (
BS#p = substitute(B1#p, S);
psiS#(p)= substitute(psi#p, S);
scan(2, j->(
projS#(p,j)= substitute(proj#(p,j), S);
inc'S#(p,j)= substitute(inc'#(p,j), S)
))
));
--make psi(q,p): BS#(q,0) <-- BS#(p,1) (note direction!)
scan(toList(1..c), p->scan(toList(1..c), q->(
if q>p then psi#(q,p) = map(target BS#q,source BS#p, 0)
else if q == p then psi#(q,p) = BS#p
--if q< p then psi#(q,p) is a composition of
--a projection and a sequence of inclusions.
else if q<p then(
spl = psiS#p;
scan(reverse toList(q+1..p-1), j ->
spl = inc'S#(j,0)*spl);
psi#(q,p) = projS#(q,0)*spl
)
)));
--construct the triangular differential d:Asour --> Atar,
--first as a list of lists of matrices
Atar := directSum(apply(toList(1..c), p->target BS#p));
Asour := directSum(apply(toList(1..c), p->source BS#p));
LL := apply(toList(1..c),
q->apply(toList(1..c),
p->psi#(q,p)));
d := map(Atar, Asour, matrix LL);
--make homotopies h#p for ci#p on A1#p.
--BUG: tensoring with R#(p-1) destroys the cache of components
--of a direct sum, so
--define dpartial#p over S, to be
--the restriction of d to the first p summands.
scan(toList(1..c), p->(
dpartial#p = map(
target Atar^(toArray toList(0..p-1)),
source Asour_(toArray toList(0..p-1)),
Atar^(toArray toList(0..p-1))*
d*
Asour_(toArray toList(0..p-1)));
h#p = map(source dpartial#p,
S^{ -degs#p}**target dpartial#p,
substitute(
(R#(p-1)**(target dpartial#p**ci#p))//
(R#(p-1)**dpartial#p),
S));
--optionally check that dpartial and h have the right relationship
if opts#Check==true then(
if not isHomogeneous h#p
then error "homotopy not homogeneous";
if 0 != R#(p-1)**dpartial#p*h#p -
R#(p-1)**(target dpartial#p)**ci#p
then error "homotopy not good";
if 0!= R#(p-1)**(target h#p)^[p-1]*h#p*dpartial#p-
R#(p-1)**(target h#p)^[p-1]**ci#p
then error "homotopy on B not good";
)
));
--H = flatten apply(#h, p->(source d)h#p
--(source d)_[0,1]*H#2
{d,hashTable pairs h}
)
Branks = method()
Branks List := MF -> (
B0 := (target MF_0).cache.components;
B1 := (source MF_0).cache.components;
apply(#B0, i-> {rank B0_i, rank B1_i}
))
--BRanks = BRanks
Bmats = method()
Bmats List := MF -> (
d := MF_0;
apply(#Branks MF, i-> (
(target d)^[i]*d*(source d)_[i]))
)
Amats = method()
Amats List := MF -> (
d := MF_0;
apply(#Branks MF, i-> (
(target d)^(toArray toList(0..i))*d*(source d)_(toArray toList(0..i))))
)
mfBound = method()
mfBound Module := M0 ->(
--gives (conjectural) bound for which map in the resolution
--of M0 will have cokernel a high syzygy
E := ExtModuleData M0;
1+max(2*E_2, 1+2*E_3)
)
highSyzygy = method(Options=>{Optimism => 0})
highSyzygy Module := opts -> M0 ->(
--with increment => 0 (the default) this gives our conjectural
--bound, which is best possible.
-- But if that's not good enough, use Optimism=>-1 etc
len := mfBound M0-opts#Optimism;
F := res(M0, LengthLimit => len);
coker F.dd_len)
///%%
restart
loadPackage ("CompleteIntersectionResolutions", Reload=>true)
--viewHelp matrixFactorization
--Example 0
S = kk[a,b]
ff = matrix"ab"
R = S/ideal ff
M0 = R^1/ideal"a,b"
regularity ExtModule M0 -- 2
len = 2
F = res(M0, LengthLimit =>len)
--
MF = matrixFactorization(ff,coker F.dd_len)
MF = matrixFactorization(ff,coker F.dd_len,Check=>false)
MF = matrixFactorization(ff,highSyzygy M0)
betti MF_0
betti MF_1#1
MF_0*MF_1#1
BRanks MF
--Example 0a
S = kk[a,b,c]
ff = matrix"ac-b2"
R = S/ideal ff
m = matrix"a,b;b,c"
betti m
M0 = coker m
MF = matrixFactorization(ff,highSyzygy M0)
BRanks MF
--Example1
S = kk[a,b,u,v]
ff = matrix"au,bv"
R = S/ideal ff
M0 = R^1/ideal"a,b"
MF = matrixFactorization(ff,highSyzygy M0)
BRanks MF
--Example2
S = kk[a,b]
ff = (vars S)^[3]
R = S/ideal ff;
M0=R^1/ideal"ab"
MF = matrixFactorization (ff, highSyzygy M0)
Branks MF
--Example3
S = kk[a,b,c]
ff = matrix"a3,b3,c3"
betti ff
ff1 = ff*random(S^{3: -3}, S^{3: -3})
R = S/ideal ff;
M0= R^1/ideal"ab"
MF = matrixFactorization (ff1, highSyzygy M0)
netList Branks MF
--Example4
S = ZZ/101[a,b,c,d]
mm= ideal vars S