-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeometricDecomposability.m2
2384 lines (1961 loc) · 107 KB
/
GeometricDecomposability.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
-- -*- coding: utf-8 -*-
newPackage(
"GeometricDecomposability",
Version => "1.4",
Date => "November 7, 2023",
Headline => "A package to check whether ideals are geometrically vertex decomposable",
Authors => {
{
Name => "Mike Cummings",
Email => "cummim5@mcmaster.ca",
HomePage => "https://math.mcmaster.ca/~cummim5/"
},
{
Name => "Adam Van Tuyl",
Email => "vantuyl@math.mcmaster.ca",
HomePage => "https://ms.mcmaster.ca/~vantuyl/"
}
},
Keywords => {"Commutative Algebra"},
PackageImports => {"Depth", "PrimaryDecomposition"}
)
export {
-- methods
"findLexCompatiblyGVDOrders",
"findOneStepGVD",
"getGVDIdeal",
"initialYForms",
"isGeneratedByIndeterminates",
"isGVD",
"isLexCompatiblyGVD",
"isUnmixed",
"isWeaklyGVD",
"oneStepGVD",
"oneStepGVDCyI",
"oneStepGVDNyI",
-- options
"AllowSub",
"CheckCM",
"CheckDegenerate",
"CheckUnmixed",
"IsIdealHomogeneous",
"IsIdealUnmixed",
"OnlyDegenerate",
"OnlyNondegenerate",
"SquarefreeOnly",
"UniversalGB"
};
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- METHODS
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
findLexCompatiblyGVDOrders = method(
TypicalValue => List,
Options => {CheckUnmixed => true}
)
findLexCompatiblyGVDOrders(Ideal) := opts -> I -> (
if isGVDBaseCase I then (
return permutations gens ring I;
);
try (
orders := sort lexOrderHelper({I}, {}, CheckUnmixed=>opts.CheckUnmixed);
truncatedOrders := recursiveFlatten orders;
)
then (
allLexOrders := permutations gens ring I;
validLexOrders := select(allLexOrders, lexOrder -> inTruncatedList(lexOrder, truncatedOrders) );
return validLexOrders;
)
else (
return {};
)
)
--------------------------------------------------------------------------------
findOneStepGVD = method(
TypicalValue => List,
Options => {
AllowSub => false,
CheckUnmixed => true,
OnlyDegenerate => false,
OnlyNondegenerate => false,
SquarefreeOnly => false,
UniversalGB => false,
Verbose => false
}
)
findOneStepGVD(Ideal) := opts -> I -> (
-- returns a list of indeterminates for which there exists a one-step geometric vertex decomposition
if opts.OnlyDegenerate and opts.OnlyNondegenerate then (
error("a geometric vertex decomposition cannot be both degenerate and nondegenerate");
return {};
);
R := ring I;
indets := support I;
if opts.SquarefreeOnly then (
if (opts.CheckUnmixed or opts.OnlyDegenerate or opts.OnlyNondegenerate) then (
printIf(opts.Verbose, "ignoring unmixedness/degeneracy checks");
);
-- we use [KR, Lemma 2.6] and [KR, Lemma 2.12]
-- first get the indets with respect to which the ideal is "clearly" squarefree
-- the variables y such that y^2 does not divide any term of any generator of I
gensTerms := flatten apply(I_*, terms);
isSquarefreeIndet := (termsList, y) -> (
L := apply(gensTerms, m -> degree(y, m));
return max L <= 1 or (opts.AllowSub and #(delete(0, L)) <= 1)
);
return select(indets, z -> isSquarefreeIndet(gensTerms, z));
);
-- in this case, we compute a Gröbner basis for each indeterminate in support I
oneSteps := apply(indets, y -> join(toSequence {y}, oneStepGVD(I, y, AllowSub=>opts.AllowSub, CheckDegenerate=>(opts.OnlyDegenerate or opts.OnlyNondegenerate), CheckUnmixed=>opts.CheckUnmixed, UniversalGB=>opts.UniversalGB, Verbose=>opts.Verbose)));
-- finish by proceeding by cases on degenerate/nondegenerate checks
if opts.OnlyDegenerate then (
return apply(select(oneSteps, o -> o_1 and o_4 == "degenerate"), t -> t_0);
);
if opts.OnlyNondegenerate then (
return apply(select(oneSteps, o -> o_1 and o_4 == "nondegenerate"), t -> t_0);
);
return apply(select(oneSteps, o -> o_1), t -> t_0);
)
--------------------------------------------------------------------------------
getGVDIdeal = method(
TypicalValue => List,
Options => {
CheckUnmixed => true,
UniversalGB => false
}
)
getGVDIdeal(Ideal, List) := opts -> (I, L) -> (
CNs := new HashTable from {
"C" => oneStepGVDCyI,
"N" => oneStepGVDNyI
};
return accumulate( (i, j) -> CNs#(j_0)(i, j_1, CheckUnmixed=>opts.CheckUnmixed, UniversalGB=>opts.UniversalGB) , prepend(I, L) ); -- last entry is the desired ideal
)
--------------------------------------------------------------------------------
-- [KMY, Section 2.1]
initialYForms = method(
TypicalValue => Ideal,
Options => {UniversalGB => false}
)
initialYForms(Ideal, RingElement) := opts -> (I, y) -> (
givenRing := ring I;
-- set up the ring
indeterminates := switch(0, index y, gens ring y);
cr := coefficientRing ring I;
initYFormRing := (cr) monoid([indeterminates, MonomialOrder=>ProductOrder{1, #indeterminates - 1}]);
-- get the ideal of initial y-forms using the product order
I = sub(I, initYFormRing);
y = sub(y, initYFormRing);
-- compute in_y(I) manually if we have a UGB using [KMY, Theorem 2.1(a)]
if opts.UniversalGB then (
listOfInitYForms := apply(I_*, f -> leadTerm(1, f));
return sub(ideal listOfInitYForms, givenRing);
);
-- if we don't have a universal Gröbner bais
inyFormIdeal := ideal leadTerm(1,I);
return sub(inyFormIdeal, givenRing);
)
--------------------------------------------------------------------------------
isGeneratedByIndeterminates = method(TypicalValue => Boolean)
isGeneratedByIndeterminates(Ideal) := I -> (
R := ring I;
indeterminates := gens R;
gensI := first entries gens I;
return isSubset(delete(0, gensI), indeterminates);
)
--------------------------------------------------------------------------------
-- [KR, Definition 2.7]
isGVD = method(
TypicalValue => Boolean,
Options => {
AllowSub => false,
CheckCM => "always",
CheckUnmixed => true,
IsIdealHomogeneous => false,
IsIdealUnmixed => false,
UniversalGB => false,
Verbose => false
}
)
isGVD(Ideal) := opts -> I -> (
if not instance(opts.CheckCM, String) then (
error "value of CheckCM must be a string";
) else (
if not isSubset({opts.CheckCM}, {"always", "once", "never"}) then error ///unknown value of CheckCM; options are "once" (default), "always", "never"///;
);
R := ring I;
printIf(opts.Verbose, "I = " | toString I);
if I == 0 then (printIf(opts.Verbose, "-- zero ideal"); return true);
if I == 1 then (printIf(opts.Verbose, "-- unit ideal"); return true);
if (isGeneratedByIndeterminates I) then (printIf(opts.Verbose, "-- generated by indeterminates"); return true);
-- check if we can write I = I1 + I2 where (support I1) and (support I2) are disjoint
-- using the result of [CDSRVT, Theorem 2.9] (and a straightforward generalization when we allow substitutions)
-- only do this if (support I) is not too large
if #(support I) <= 25 then (
(I1, I2) := sumGenerators I;
-- I2 is the zero ideal if no nontrivial I1, I2 can be found
if I2 != 0 then (
printIf(opts.Verbose, "Writing I as a sum:");
printIf(opts.Verbose, toString I1);
printIf(opts.Verbose, "+ " | toString I2);
isgvdI1 := isGVD(I1, AllowSub => opts.AllowSub, CheckCM => opts.CheckCM, CheckUnmixed => opts.CheckUnmixed, IsIdealHomogeneous => opts.IsIdealHomogeneous,
IsIdealUnmixed => opts.IsIdealUnmixed, UniversalGB => opts.UniversalGB, Verbose => opts.Verbose);
if not isgvdI1 then return false;
isgvdI2 := isGVD(I2, AllowSub => opts.AllowSub, CheckCM => opts.CheckCM, CheckUnmixed => opts.CheckUnmixed, IsIdealHomogeneous => opts.IsIdealHomogeneous,
IsIdealUnmixed => opts.IsIdealUnmixed, UniversalGB => opts.UniversalGB, Verbose => opts.Verbose);
return isgvdI2;
);
);
-- Cohen-Macaulay check when the ideal is homogeneous [KR, Corollary 4.5] (i.e., homogeneous and not CM => not GVD)
-- (if we are here, the ideal is proper)
x := opts.IsIdealHomogeneous or isHomogeneous(I);
checkCohenMacaulay := x and (opts.CheckCM == "once" or opts.CheckCM == "always");
if checkCohenMacaulay then (
-- Auslander-Buchsbaum in this case says that Cohen-Macaulay is equivalent to pdim == codim
if pdim(R^1 / I) != codim(I) then (
printIf(opts.Verbose, "-- not Cohen-Macaulay");
return false;
);
);
-- Cohen-Macaulay implies unmixed so we need only check unmixed if Cohen-Macaulayness was false or not checked
if opts.CheckUnmixed and not checkCohenMacaulay then (
if not opts.IsIdealUnmixed then (
if not (isUnmixed I) then (printIf(opts.Verbose, "-- ideal is not unmixed"); return false);
);
);
-- to get the value of CheckCM in next call of isGVD
CMTable := new HashTable from {
"always" => "always",
"once" => "never",
"never" => "never"
};
-- iterate over all indeterminates, first trying the ones which appear squarefree in the given generators for I
squarefreeIndets := findOneStepGVD(I, AllowSub=>opts.AllowSub, SquarefreeOnly=>true, UniversalGB=>opts.UniversalGB);
remainingIndets := (support I) - set(squarefreeIndets);
iterIndets := join(squarefreeIndets, remainingIndets);
for y in iterIndets do (
printIf(opts.Verbose, "-- decomposing with respect to " | toString y);
(isValid, C, N) := oneStepGVD(I, y, AllowSub=>opts.AllowSub, CheckUnmixed=>opts.CheckUnmixed, UniversalGB=>opts.UniversalGB, Verbose=>opts.Verbose);
if not isValid then continue; -- go back to top of for loop
printIf(opts.Verbose, "-- C = " | toString C);
printIf(opts.Verbose, "-- N = " | toString N);
-- check N first (the link of a Cohen-Macaulay simplicial complex will be Cohen-Macaulay, but the deletion need not be
-- so probably will be more likely to catch a false in the N branch than the C branch)
NisGVD := isGVD(N, AllowSub=>opts.AllowSub, CheckCM=>CMTable#(opts.CheckCM), CheckUnmixed=>opts.CheckUnmixed, IsIdealHomogeneous=>x, IsIdealUnmixed=>true, UniversalGB=>opts.UniversalGB, Verbose=>opts.Verbose);
if not NisGVD then continue;
-- if we are here, then NisGVD is true
CisGVD := isGVD(C, AllowSub=>opts.AllowSub, CheckCM=>CMTable#(opts.CheckCM), CheckUnmixed=>opts.CheckUnmixed, IsIdealHomogeneous=>x, IsIdealUnmixed=>true, UniversalGB=>opts.UniversalGB, Verbose=>opts.Verbose);
if CisGVD and NisGVD then return true; -- otherwise, try next variable
);
-- if we are here, no choice of y worked
return false;
)
--------------------------------------------------------------------------------
-- [KR, Definition 2.11]
isLexCompatiblyGVD = method(
TypicalValue => Boolean,
Options => {
CheckCM => "always",
CheckUnmixed => true,
IsIdealHomogeneous => false,
IsIdealUnmixed => false,
UniversalGB => false,
Verbose => false
}
)
isLexCompatiblyGVD(Ideal, List) := opts -> (I, indetOrder) -> (
if not instance(opts.CheckCM, String) then (
error "value of CheckCM must be a string";
) else (
if not isSubset({opts.CheckCM}, {"always", "once", "never"}) then error ///unknown value of CheckCM, options are "once" (default), "always", "never"///;
);
R := ring I;
printIf(opts.Verbose, "I = " | toString I);
if I == 0 then (printIf(opts.Verbose, "-- zero ideal"); return true);
if I == 1 then (printIf(opts.Verbose, "-- unit ideal"); return true);
if (isGeneratedByIndeterminates I) then (printIf(opts.Verbose, "-- generated by indeterminates"); return true);
-- check if we can write I = I1 + I2 where (support I1) and (support I2) are disjoint
-- using the result of [CDSRVT, Theorem 2.9] (and a straightforward generalization when we allow substitutions)
-- only do this if (support I) is not too large
if #(support I) <= 25 then (
(I1, I2) := sumGenerators I;
-- I2 is the zero ideal if no nontrivial I1, I2 can be found
if I2 != 0 then (
printIf(opts.Verbose, "Writing I as a sum:");
printIf(opts.Verbose, toString I1);
printIf(opts.Verbose, "+ " | toString I2);
isgvdI1 := isLexCompatiblyGVD(I1, indetOrder, AllowSub => opts.AllowSub, CheckCM => opts.CheckCM, CheckUnmixed => opts.CheckUnmixed,
IsIdealHomogeneous => opts.IsIdealHomogeneous, IsIdealUnmixed => opts.IsIdealUnmixed, UniversalGB => opts.UniversalGB, Verbose => opts.Verbose);
if not isgvdI1 then return false;
isgvdI2 := isLexCompatiblyGVD(I2, indetOrder, AllowSub => opts.AllowSub, CheckCM => opts.CheckCM, CheckUnmixed => opts.CheckUnmixed,
IsIdealHomogeneous => opts.IsIdealHomogeneous, IsIdealUnmixed => opts.IsIdealUnmixed, UniversalGB => opts.UniversalGB, Verbose => opts.Verbose);
return isgvdI2;
);
);
supportIndets := support I;
trimmedOrder := select(indetOrder, i -> member(sub(i, R), supportIndets));
-- Cohen-Macaulay check when the ideal is homogeneous [KR, Corollary 4.5]
-- (if we are here, the ideal is proper)
x := opts.IsIdealHomogeneous or isHomogeneous(I);
checkCohenMacaulay := x and (opts.CheckCM == "once" or opts.CheckCM == "always");
if checkCohenMacaulay then (
-- Auslander-Buchsbaum in this case says that Cohen-Macaulay is equivalent to pdim == codim
if pdim(R^1 / I) != codim(I) then (
printIf(opts.Verbose, "-- not Cohen-Macaulay");
return false;
);
);
-- Cohen-Macaulay implies unmixed so we need only check unmixed if C-M was false or not checked
if opts.CheckUnmixed and not checkCohenMacaulay then (
if not opts.IsIdealUnmixed then (
if not (isUnmixed I) then (printIf(opts.Verbose, "-- ideal is not unmixed"); return false);
);
);
-- to get the value of CheckCM in next call of isLexCompatiblyGVD
CMTable := new HashTable from {
"always" => "always",
"once" => "never",
"never" => "never"
};
-- check next indeterminate in list
y := first trimmedOrder;
remainingOrder := take(trimmedOrder, {1, #trimmedOrder});
printIf(opts.Verbose, "-- decomposing with respect to " | toString y);
(isValid, C, N) := oneStepGVD(I, y, CheckUnmixed=>opts.CheckUnmixed, UniversalGB=>opts.UniversalGB, Verbose=>opts.Verbose);
if not isValid then return false; -- order didn't work
printIf(opts.Verbose, "-- C = " | toString C);
printIf(opts.Verbose, "-- N = " | toString N);
-- check N first, same reasoning as in isGVD
NisGVD := isLexCompatiblyGVD(N, remainingOrder, CheckCM=>CMTable#(opts.CheckCM), CheckUnmixed=>opts.CheckUnmixed, IsIdealHomogeneous=>x, IsIdealUnmixed=>true, UniversalGB=>opts.UniversalGB, Verbose=>opts.Verbose);
if not NisGVD then return false;
-- if are here, then NisGVD is true
CisGVD := isLexCompatiblyGVD(C, remainingOrder, CheckCM=>CMTable#(opts.CheckCM), CheckUnmixed=>opts.CheckUnmixed, IsIdealHomogeneous=>x, IsIdealUnmixed=>true, UniversalGB=>opts.UniversalGB, Verbose=>opts.Verbose);
return CisGVD;
)
--------------------------------------------------------------------------------
isUnmixed = method(TypicalValue => Boolean)
isUnmixed(Ideal) := I -> (
R := ring I;
D := primaryDecomposition I;
if #D <= 1 then return true;
commonDim := dim(R/(D_0));
remainingPrimes := drop(D, 1);
for P in remainingPrimes do (
if dim(P) != commonDim then return false;
);
return true;
)
--------------------------------------------------------------------------------
-- [KR, Definition 4.6]
isWeaklyGVD = method(
TypicalValue => Boolean,
Options => {
AllowSub => false,
CheckUnmixed => true,
IsIdealUnmixed => false,
UniversalGB => false,
Verbose => false
}
)
isWeaklyGVD(Ideal) := opts -> I -> (
R := ring I;
printIf(opts.Verbose, "I = " | toString I);
if I == 0 then (printIf(opts.Verbose, "-- zero ideal"); return true);
if I == 1 then (printIf(opts.Verbose, "-- unit ideal"); return true);
if (isGeneratedByIndeterminates I) then (printIf(opts.Verbose, "-- generated by indeterminates"); return true);
if opts.CheckUnmixed then (
if not opts.IsIdealUnmixed then (
if not (isUnmixed I) then (printIf(opts.Verbose, "-- ideal is not unmixed"); return false);
);
);
-- iterate over all indeterminates, first trying the ones which appear squarefree in the given generators for I
squarefreeIndets := findOneStepGVD(I, SquarefreeOnly=>true, UniversalGB=>opts.UniversalGB);
remainingIndets := (support I) - set(squarefreeIndets);
iterIndets := join(squarefreeIndets, remainingIndets);
-- check all options for y until one works
for y in iterIndets do (
printIf(opts.Verbose, "-- decomposing with respect to " | toString y);
oneStep := oneStepGVD(I, y, AllowSub=>opts.AllowSub, CheckDegenerate=>true, CheckUnmixed=>opts.CheckUnmixed, UniversalGB=>opts.UniversalGB, Verbose=>opts.Verbose);
isValid := oneStep_0;
if not isValid then continue; -- go back to top of for loop
(C, N, degenerateOutput) := (oneStep_1, oneStep_2, oneStep_3);
isDegenerate := (degenerateOutput == "degenerate");
degenerateTable := new HashTable from {true => "degenerate", false => "nondegenerate"};
printIf(opts.Verbose, "-- C = " | toString C);
printIf(opts.Verbose, "-- N = " | toString N);
printIf(opts.Verbose, "-- form a " | degenerateTable#isDegenerate | " geometric vertex decomposition");
if isDegenerate then (
-- degenerate case
if isWeaklyGVD(N, AllowSub=>opts.AllowSub, CheckUnmixed=>opts.CheckUnmixed, IsIdealUnmixed=>true, UniversalGB=>opts.UniversalGB, Verbose=>opts.Verbose) then return true else continue;
) else (
-- nondegenerate case
NisRadical := (N == radical(N, Unmixed=>true));
NisCM := if (isHomogeneous N) then pdim( (ring N)^1/N ) == codim N else isCM(ring N/N);
if not (NisRadical and NisCM) then continue;
-- otherwise, we need only check that C is weakly GVD
if isWeaklyGVD(C, AllowSub=>opts.AllowSub, CheckUnmixed=>opts.CheckUnmixed, IsIdealUnmixed=>true, UniversalGB=>opts.UniversalGB, Verbose=>opts.Verbose) then return true else continue;
)
);
-- if we are here, no choice of y worked
return false;
)
--------------------------------------------------------------------------------
oneStepGVD = method(
TypicalValue => Sequence,
Options => {
AllowSub => false,
CheckDegenerate => false,
CheckUnmixed => true,
UniversalGB => false,
Verbose => false
}
)
oneStepGVD(Ideal, RingElement) := opts -> (I, y) -> (
-- set up the rings
indeterminates := switch(0, index y, gens ring y);
remainingIndets := drop(gens ring y, {index y, index y});
cr := coefficientRing ring I;
givenRing := ring I;
lexRing := (cr) monoid([indeterminates, MonomialOrder=>Lex]);
contractedRing := (cr) monoid([remainingIndets]);
-- pull everthing into the new rings and get a (reduced) Gröbner basis
J := sub(I, lexRing);
z := sub(y, lexRing);
G := if opts.UniversalGB then J_* else first entries gens gb J;
-- check whether the intersection condition holds
isValid := isValidOneStep(G, z, opts.AllowSub);
if not isValid then (
printIf(opts.Verbose, "Warning: not a valid geometric vertex decomposition");
);
-- get N_{y,I}
NyI := ideal select(G, g -> degree(z, g) == 0);
-- get C_{y, I}
gensC := apply(G, g -> isInC(g, z));
CyI := ideal (gensC / last);
-- sub C and N into original ring
-- by [CDSRVT, Theorem 2.9] variables in ring not appearing in the ideal do not matter
C := sub(CyI, givenRing);
N := sub(NyI, givenRing);
-- check unmixed & degenerate as needed, and return
if opts.CheckUnmixed and opts.CheckDegenerate then (
unmixedIdeals := unmixedCheck(C, N, opts.Verbose);
degeneracyStatus := degeneracyCheck(C, N);
return (isValid and unmixedIdeals, C, N, degeneracyStatus);
);
if opts.CheckUnmixed then ( -- not needed to CheckDegenerate
unmixedIdeals1 := unmixedCheck(C, N, opts.Verbose);
return (isValid and unmixedIdeals1, C, N);
);
if opts.CheckDegenerate then ( -- not needed to CheckUnmixed
degeneracyStatus1 := degeneracyCheck(C, N);
return (isValid, C, N, degeneracyStatus1);
);
-- otherwise, we don't need not check unmixed nor degeneracy
return (isValid, C, N);
)
--------------------------------------------------------------------------------
oneStepGVDCyI = method(
TypicalValue => Ideal,
Options => {
CheckUnmixed => true,
UniversalGB => false
}
)
oneStepGVDCyI(Ideal, RingElement) := opts -> (I, y) -> (oneStepGVD(I, y, CheckUnmixed=>opts.CheckUnmixed, UniversalGB=>opts.UniversalGB))_1;
--------------------------------------------------------------------------------
oneStepGVDNyI = method(
TypicalValue => Ideal,
Options => {
CheckUnmixed => true,
UniversalGB => false
}
)
oneStepGVDNyI(Ideal, RingElement) := opts -> (I, y) -> (oneStepGVD(I, y, CheckUnmixed=>opts.CheckUnmixed, UniversalGB=>opts.UniversalGB))_2;
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--** METHODS (Hidden from users, not exported)
areGensSquarefreeInY = method(TypicalValue => Boolean)
areGensSquarefreeInY(List, RingElement) := (L, y) -> (
-- L a list of polynomials (e.g., generators of some ideal), and y an indeterminate in the ring
-- returns true if and only if ideal(L) is squarefre in y, that is, if y^2 does not divide any term of any of the polynomials
return all( apply(L, m -> isSquarefreeInY(m, y)), i->i );
)
-- check if C_{y, I} and N_{y, I} form a degenerate (or not) geometric vertex decomposition
degeneracyCheck = method(TypicalValue => String)
degeneracyCheck(Ideal, Ideal) := (C, N) -> (
-- degenerate if C == 1 or radical C == radical N
if C == 1 then return "degenerate";
radC := radical(C, Unmixed=>true);
radN := radical(N, Unmixed=>true);
if (radC == radN) then return "degenerate";
-- if we are here, we are nondegenerate
return "nondegenerate";
)
isGVDBaseCase = method(TypicalValue => Boolean)
isGVDBaseCase(Ideal) := I -> (
return (I == 1 or I == 0 or isGeneratedByIndeterminates(I));
)
isIdealSquarefreeInY = method(TypicalValue => Boolean)
isIdealSquarefreeInY(Ideal, RingElement) := (I, y) -> (
-- returns true if and only if I is squarefree in y, that is: if and only if
-- y^2 does not divide any term of a Grobner basis of I with respect to a y-compatible monomial order
-- we use lex with y > all other variables
R := ring I;
cr := coefficientRing R;
indeterminates := switch(0, index y, gens ring y); -- assumes that y and I are "from" the same ring
S := (cr) monoid([indeterminates, MonomialOrder=>Lex]); -- ring that has lex order with y > all other variables
J := sub(I, S);
z := sub(y, S);
grobnerLeadTerms := first entries gens leadTerm J;
return areGensSquarefreeInY(grobnerLeadTerms, z);
)
isInC = method(TypicalValue => List)
isInC(RingElement, RingElement) := (f, y) -> (
-- f is a polynomial, y an indeterminate
if degree(y, f) == 0 then return (true, f);
if degree(y, f) == 1 then return (true, getQ(f, y));
return (false, getQ(f, y));
)
intersectLists = method(TypicalValue => List)
intersectLists(List) := L -> (
-- L is a list of lists
S := for l in L list (set l);
return toList fold(intersectSets, S)
)
intersectSets = method(TypicalValue => Set)
intersectSets(Set, Set) := (S1, S2) -> (
return S1 * S2;
)
inTruncatedList = method(TypicalValue => Boolean)
inTruncatedList(List, List) := (L, LL) -> (
-- LL is a list of lists
-- return True if: for some list l of length n in LL, the first n terms of L are exactly l
for l in LL do (
n := #l ;
for i from 0 to n-1 do (
if L_i != l_i then break;
return true;
);
);
return false;
-- old version, broken but not sure why
-- for l in LL do (
-- n := #l;
-- truncedL := take(L, n);
-- if l == truncedL then return true; -- M2 doesn't like the == here
-- );
-- return false;
)
getQ = method(TypicalValue => RingElement)
getQ(RingElement, RingElement) := (f, y) -> (
-- f is of the form q*y^d+r, return q
r := sub(f, y=>0);
qy := f - r;
return sub(qy, y=>1);
)
lexOrderHelper = method(TypicalValue => List, Options => {CheckUnmixed => true})
lexOrderHelper(List, List) := opts -> (idealList, order) -> (
-- remove ideals that are trivially GVD
nontrivialIdeals := select(idealList, i -> not isGVDBaseCase i);
-- if there are none left, return the order
if (#nontrivialIdeals) == 0 then (
return order;
);
-- for each ideal, get the indets which form a oneStepGVD
possibleIndets := apply(nontrivialIdeals, i -> findOneStepGVD(i, CheckUnmixed=>opts.CheckUnmixed));
commonPossibleIndets := intersectLists possibleIndets;
if commonPossibleIndets == {} then return;
-- for each variable, compute the C and N ideals
nextIdeals := for y in commonPossibleIndets list (
flatten apply( nontrivialIdeals, i -> (
oneStep := oneStepGVD(i, y);
{oneStep_1, oneStep_2}
))
);
L := for m from 0 to (#commonPossibleIndets)-1 list (
lexOrderHelper(nextIdeals#m, append(order, commonPossibleIndets#m))
);
return L;
)
isSquarefreeInY = method()
isSquarefreeInY(RingElement, RingElement) := (m, y) -> (
-- m a monomial, y an indeterminate
-- returns true if and only if m is squarefree in y
return not (m % y^2 == 0)
)
-- determine whether the one-step geometric vertex decomposition holds
-- uses [KR, Lemmas 2.6 and 2.12] and generalizations thereof
isValidOneStep = method(TypicalValue => Boolean)
isValidOneStep(List, RingElement, Boolean) := (G, y, allowingSub) -> (
-- G is a list, whose elements form a reduced Gröbner basis
-- analyze the powers of y appearing in the Gröbner basis
gbTerms := flatten apply(G, f -> terms f);
yDegrees := unique apply(gbTerms, m -> degree(y, m));
yMaxDegree := max yDegrees;
if not allowingSub then (
return yMaxDegree <= 1;
);
yOtherDegrees := delete(0, delete(yMaxDegree, yDegrees)); -- all degrees of y in the GB that are not 0 and not the highest degree
noOtherYDegrees := (#yOtherDegrees == 0);
return noOtherYDegrees;
)
sumGenerators = method(TypicalValue => List)
sumGenerators(Ideal) := I -> (
-- returns a list {I1, I2} where I = I1 + I2 and (support I1) and (support I2) are disjoint,
-- if no such I1 and I2 exist, then {I} is returned
-- only uses the given generators of I (does not compute a minimal generating set)
supp := support I;
suppSubsets := delete(supp, drop(subsets supp, {0, 0}));
-- nested list; each inner list has two lists that are disjoint sets of variables, whose union is support I
suppPartitions := unique apply(suppSubsets, s -> sort{s, supp - set(s)});
-- filter to those that partition the generators
gensPartitions := select(suppPartitions, L -> all(
I_*, f -> (isSubset(support f, L_0) xor isSubset(support f, L_1))
)
);
if #gensPartitions == 0 then return (I, ideal 0);
-- not sure what the "best" partition would be (computationally)
-- for now, just pick the first one
P := gensPartitions_0;
return (
ideal select(I_*, f -> isSubset(support f, P_0)),
ideal select(I_*, f -> isSubset(support f, P_1))
);
)
printIf = method()
printIf(Boolean, String) := (bool, str) -> (
if bool then print str;
)
recursiveFlatten = method(TypicalValue => List)
recursiveFlatten(List) := L -> (
Lstr := toString L;
if Lstr#2 == "{" then (
return recursiveFlatten flatten L;
)
else (
return L;
)
)
unmixedCheck = method(TypicalValue => Boolean)
unmixedCheck(Ideal, Ideal, Boolean) := (C, N, verb) -> (
CisCM := isHomogeneous C and (pdim((ring C)^1/C) == codim C);
NisCM := isHomogeneous N and (pdim((ring N)^1/N) == codim N);
isUnmixedC := CisCM or isUnmixed C;
isUnmixedN := NisCM or isUnmixed N;
bothUnmixed := (isUnmixedC and isUnmixedN);
if not isUnmixedC then (
printIf(verb, "Warning: CyI is not unmixed");
);
if not isUnmixedN then (
printIf(verb, "Warning: NyI is not unmixed");
);
return bothUnmixed;
)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- DOCUMENTATION
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
beginDocumentation()
--******************************************************************************
-- Documentation for package
--******************************************************************************
doc///
Node
Key
GeometricDecomposability
Headline
a package to check whether ideals are geometrically vertex decomposable
Description
Text
This package includes routines to check whether an ideal is
geometrically vertex decomposable.
Geometrically vertex
decomposable ideals can be viewed as a generalization of the properties
of the Stanley-Reisner ideal of a vertex decomposable simplicial complex.
This family of ideals is based upon the geometric vertex
decomposition property defined by Knutson, Miller, and Yong [KMY]. Klein and Rajchgot
then gave a recursive definition for
geometrically vertex decomposable ideals in [KR] using this notion.
An unmixed ideal $I$ in a polynomial ring $R$ is geometrically vertex
decomposable if it is the zero ideal, the unit ideal, an ideal generated
by indeterminates, or if there is a indeterminate $y$ of $R$ such that
two ideals $C_{y,I}$ and $N_{y,I}$ constructed from $I$ are
both geometrically vertex decomposable. For the complete definition, see
@TO isGVD@.
Observe that a geometrically vertex decomposable ideal is recursively
defined. The complexity of verifying that an ideal is geometrically
vertex decomposable will increase as the number of indeterminates
appearing in the ideal increases.
Acknowledgement
We thank Sergio Da Silva, Megumi Harada, Patricia Klein, and Jenna Rajchgot for feedback and suggestions.
Additionally, we thank the anonymous referees of the paper [CVT] for their concrete
suggestions that significantly improved that manuscript and this package.
Cummings was partially supported by an NSERC USRA and CGS-M and a Milos Novotny Fellowship.
Van Tuyl's research is partially supported by NSERC Discovery Grant 2019-05412.
References
[CDSRVT] Mike Cummings, Sergio Da Silva, Jenna Rajchgot, and Adam Van Tuyl.
Geometric vertex decomposition and liaison for toric ideals of
graphs. Algebr. Comb., 6(4):965--997, 2023.
[CVT] Mike Cummings and Adam Van Tuyl.
The GeometricDecomposability package for Macaulay2.
Preprint, available at @arXiv "2211.02471"@, 2022.
[DSH] Sergio Da Silva and Megumi Harada. Geometric vertex decomposition, Gröbner bases, and Frobenius
splittings for regular nilpotent Hessenberg Varieties.
Transform. Groups, 2023.
[KMY] Allen Knutson, Ezra Miller, and Alexander Yong. Gröbner geometry of vertex
decompositions and of flagged tableaux. J. Reine Angew. Math. 630 (2009) 1–31.
[KR] Patricia Klein and Jenna Rajchgot. Geometric vertex decomposition and
liaison. Forum Math. Sigma, 9 (2021) e70:1-23.
[SM] Hero Saremi and Amir Mafi. Unmixedness and arithmetic properties of
matroidal ideals. Arch. Math. 114 (2020) 299–304.
Subnodes
AllowSub
CheckCM
CheckDegenerate
CheckUnmixed
findLexCompatiblyGVDOrders
findOneStepGVD
getGVDIdeal
initialYForms
isGeneratedByIndeterminates
isGVD
IsIdealHomogeneous
IsIdealUnmixed
isLexCompatiblyGVD
isUnmixed
isWeaklyGVD
oneStepGVD
oneStepGVDCyI
oneStepGVDNyI
OnlyDegenerate
OnlyNondegenerate
SquarefreeOnly
UniversalGB
///
--******************************************************************************
-- Documentation for functions
--******************************************************************************
doc///
Node
Key
findLexCompatiblyGVDOrders
(findLexCompatiblyGVDOrders, Ideal)
Headline
finds all lexicographic monomial orders $<$ such that the ideal is $<$-compatibly geometrically vertex decomposable
Usage
findLexCompatiblyGVDOrders I
Inputs
I:Ideal
Outputs
:List
list containing all the lexicographical orders $<$ with respect to which
{\tt I} is $<$-compatibly geometrically vertex decomposable
Description
Text
An ideal $I$ is $<$-compatibly geometrically vertex decomposable if
there exists a (lexicographic) order $<$ such that $I$ is geometrically vertex
decomposable and for every (one-step) geometric vertex decomposition, we
pick $y$ to be the most expensive indeterminate remaining in the ideal according
to $<$ [KR, Definition 2.11].
For the definition of a (one-step) geometric vertex decomposition, see @TO oneStepGVD@.
This method computes all possible lex orders $<$ for which the ideal $I$ is $<$-compatibly
geometrically vertex decomposable.
Example
R = QQ[x,y,z];
I = ideal(x-y, x-z);
findLexCompatiblyGVDOrders I
Text
The ideal in the following example is not square-free with respect to
any indeterminate, so no one-step geometric vertex decomposition exists.
Example
R = QQ[x,y];
I = ideal(x^2-y^2);
findLexCompatiblyGVDOrders I
Caveat
In the ring $k[x_1, \ldots, x_n]$, there are $n!$ possible lexicographic
monomial orders, so this function can be computationally expensive.
References
[KR] Patricia Klein and Jenna Rajchgot. Geometric vertex decomposition and
liaison. Forum Math. Sigma, 9 (2021) e70:1-23.
SeeAlso
CheckUnmixed
isLexCompatiblyGVD
///
doc///
Node
Key
findOneStepGVD
(findOneStepGVD, Ideal)
[findOneStepGVD, Verbose]
Headline
for which indeterminates does there exist a geometric vertex decomposition
Usage
findOneStepGVD I
Inputs
I:Ideal
Outputs
:List
Description