/
StronglyStableIdeals.m2
1115 lines (957 loc) · 35 KB
/
StronglyStableIdeals.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("StronglyStableIdeals",
Version => "1.1",
Date => "June 2018",
Authors => {
{Name => "Davide Alberelli", Email => "davide.alberelli@gmail.com"},
{Name => "Paolo Lella", Email => "paolo.lella@polimi.it", HomePage => "http://www.paololella.it/"}
},
Headline => "A package to study strongly stable ideals related to Hilbert polynomials",
DebuggingMode => false,
PackageImports => {"gfanInterface"}
)
-- For information see documentation key "StronglyStableIdeals" below.
needsPackage("gfanInterface");
export {
-- methods
"isHilbertPolynomial",
"gotzmannDecomposition",
"macaulayDecomposition",
"gotzmannNumber",
"lexIdeal",
"stronglyStableIdeals",
"isGenSegment",
"isHilbSegment",
"isRegSegment",
-- Options
"MaxRegularity",
"OrderVariables"
}
---------------------------------------------------------------------------------
-- PROJECTIVE HILBERT POLYNOMIALS AND GOTZMANN DECOMPOSITION --
---------------------------------------------------------------------------------
--------
-- isHilbertPolynomial
--------
isHilbertPolynomial = method(TypicalValue => Boolean)
isHilbertPolynomial ProjectiveHilbertPolynomial := hp -> (
currentHP := hp;
k := 0;
while degree currentHP > 0 do
(
b := dim currentHP;
if b < 0 then return false;
currentHP = currentHP - projectiveHilbertPolynomial(b,-k);
k = k+1;
);
if degree currentHP != 0 then false else true
) -- END isHilbertPolynomial ProjectiveHilbertPolynomial
isHilbertPolynomial RingElement := p -> (
R := ring p;
if not isPolynomialRing R then return false;
if numgens R != 1 then return false;
if coefficientRing R =!= ZZ and coefficientRing R =!= QQ then return false;
currentP := p;
k := 0;
while leadCoefficient currentP > 0 do
(
b := first degree currentP;
currentP = currentP - polynomialBinom(b-k,b,R);
k = k+1;
);
if currentP != 0_R then false else true
) -- END isHilbertPolynomial RingElement
--------
-- gotzmannDecomposition
--------
gotzmannDecomposition = method(TypicalValue => List)
gotzmannDecomposition ProjectiveHilbertPolynomial := hp -> (
currentHP := hp;
decomposition := {};
k := 0;
while degree currentHP > 0 do
(
b := dim currentHP;
if b < 0 then error "argument 1: expected a Hilbert polynomial";
decomposition = decomposition | {projectiveHilbertPolynomial(b,-k)};
currentHP = currentHP - projectiveHilbertPolynomial(b,-k);
k = k+1;
);
if degree currentHP != 0 then
error "argument 1: expected a Hilbert polynomial"
else
decomposition
) -- END gotzmannDecomposition ProjectiveHilbertPolynomial
gotzmannDecomposition RingElement := p -> (
R := ring p;
if not isPolynomialRing R then error "argument 1: expected a polynomial";
if numgens R != 1 then error "argument 1: expected a univariate polynomial";
if coefficientRing R =!= ZZ and coefficientRing R =!= QQ then error "argument 1: expected a numerical polynomial";
currentP := p;
decomposition := {};
k := 0;
while leadCoefficient currentP > 0 do
(
b := first degree currentP;
decomposition = decomposition | {projectiveHilbertPolynomial(b,-k)};
currentP = currentP - polynomialBinom(b-k,b,R);
k = k+1;
);
if currentP != 0_R then
error "argument 1: expected a Hilbert polynomial"
else
decomposition
) -- END gotzmannDecomposition RingElement
--------
-- macaulayDecomposition
--------
macaulayDecomposition = method(TypicalValue => List)
macaulayDecomposition ProjectiveHilbertPolynomial := hp -> (
lexExp := lexIdealExponents hp;
d := dim hp;
macaulayCoeff := {sum lexExp};
for i from 0 to d-1 do macaulayCoeff = macaulayCoeff | {macaulayCoeff#-1 - lexExp#i};
flatten for i from 0 to d list {projectiveHilbertPolynomial(i+1,-1),-projectiveHilbertPolynomial(i+1,-1-macaulayCoeff#i)}
) -- END macaulayDecomposition ProjectiveHilbertPolynomial
macaulayDecomposition RingElement := p -> (
lexExp := lexIdealExponents p;
d := first degree p;
macaulayCoeff := {sum lexExp};
for i from 0 to d-1 do macaulayCoeff = macaulayCoeff | {macaulayCoeff#-1 - lexExp#i};
flatten for i from 0 to d list {projectiveHilbertPolynomial(i+1,-1),-projectiveHilbertPolynomial(i+1,-1-macaulayCoeff#i)}
) -- END macaulayDecomposition RingElement
--------
-- gotzmannNumber
--------
gotzmannNumber = method(TypicalValue => ZZ)
gotzmannNumber ProjectiveHilbertPolynomial := hp -> #gotzmannDecomposition hp
gotzmannNumber RingElement := p -> #gotzmannDecomposition p
--------
-- projectiveHilbertPolynomial
--------
projectiveHilbertPolynomial RingElement := p -> sum gotzmannDecomposition p
-----------------------------------------------------------------
-- STRONGLY STABLE IDEALS AND SEGMENT IDEALS --
-----------------------------------------------------------------
--------
-- lexIdeal
--------
lexIdeal = method(TypicalValue => Ideal,Options => {CoefficientRing=>QQ,OrderVariables=>Down})
lexIdeal (ProjectiveHilbertPolynomial,PolynomialRing) := opts -> (hp,R) -> (
if hp == hilbertPolynomial R then return ideal(0_R);
lexExp := lexIdealExponents hp;
d := dim hp;
n := numgens R;
if n < d+2 then error ("argument 2: expected at least " | toString(d+2) | " variables");
lexExp = lexExp | for i from 0 to n-d-3 list 0;
gensLex := {};
for i from 0 to n-2 do
(
T := R_(n-2-i)^(lexExp#i);
if i > 0 then T = T*R_(n-2-i);
for j from i+1 to n-2 do T = T*R_(n-2-j)^(lexExp#j);
gensLex = gensLex | {T};
);
trim ideal gensLex
) -- END lexIdeal (ProjectiveHilbertPolynomial,PolynomialRing)
lexIdeal (RingElement,PolynomialRing) := opts -> (p,R) -> lexIdeal(projectiveHilbertPolynomial p,R)
lexIdeal (ProjectiveHilbertPolynomial,ZZ) := opts -> (hp,n) -> (
if n < 2 then error "argument 2: expected at least 2 variables";
if not instance(opts.CoefficientRing,Ring) then error "option CoefficientRing: expected a ring";
if opts.OrderVariables != Up and opts.OrderVariables != Down then error "option OrderVariables: expected Down or Up";
R := (opts.CoefficientRing)(monoid [VariableBaseName=>getSymbol "x",Variables=>n]);
if opts.OrderVariables == Up then R = (opts.CoefficientRing)(monoid [sort gens R]);
lexIdeal(hp, R)
) -- END lexIdeal (ProjectiveHilbertPolynomial,ZZ)
lexIdeal (RingElement,ZZ) := opts -> (p,n) -> lexIdeal(projectiveHilbertPolynomial p,n,opts)
lexIdeal (ZZ,PolynomialRing) := opts -> (d,R) -> lexIdeal(projectiveHilbertPolynomial d_(QQ[local t]),R)
lexIdeal (ZZ,ZZ) := opts -> (d,n) -> lexIdeal(projectiveHilbertPolynomial d_(QQ[local t]),n,opts)
--------
-- stronglyStableIdeals
--------
stronglyStableIdeals = method(TypicalValue => List,Options => {MaxRegularity=>null,CoefficientRing=>QQ,OrderVariables=>Down})
stronglyStableIdeals (ProjectiveHilbertPolynomial,PolynomialRing) := opts -> (hp,R) -> (
gN := gotzmannNumber hp;
d := dim hp;
n := numgens(R);
if n < 2 then error "argument 2: expected at least 2 variables";
if d >= n-1 then return {}; -- there are no schemes of dimension d in the n-dimensional projective space
r := gN;
if opts.MaxRegularity =!= null then
(
if not instance(opts.MaxRegularity,ZZ) or opts.MaxRegularity <= 0 then error "option MaxRegularity: expected a positive integer";
r = min(opts.MaxRegularity,r);
);
hpSeq := for i from 0 to d list (diff(hp,i)) r;
local growthVec;
local B;
if d == n-2 then
(
if hpSeq#d > r then return {};
B = new BorelSet from {NumVariables => 2,
Degree => r,
Size => (hpSeq#d),
MinimalElements => {R_0^(hpSeq#d)*R_1^(r-hpSeq#d)},
MinimalGenerators => {R_0^(hpSeq#d)},
GrowthVector => toList ((r-hpSeq#d+1 : 0) | (hpSeq#d : 1)),
};
if n == 2 then {ideal(B.MinimalGenerators)} else recursiveCall(B,hpSeq)
)
else
(
B = new BorelSet from {NumVariables => n-d-1,
Degree => r,
Size => 0,
MinimalElements => {R_(n-d-2)^r},
MinimalGenerators => {1_R},
GrowthVector => toList(r+1 : 0),
};
recursiveCall(B,hpSeq)
)
) -- END stronglyStableIdeals (ProjectiveHilbertPolynomial,PolynomialRing)
stronglyStableIdeals (ProjectiveHilbertPolynomial,ZZ) := opts -> (hp,n) -> (
if n < 2 then error "argument 2: expected at least 2 variables";
if not instance(opts.CoefficientRing,Ring) then error "option CoefficientRing: expected a ring";
if opts.OrderVariables != Up and opts.OrderVariables != Down then error "option OrderVariables: expected Down or Up";
R := (opts.CoefficientRing)(monoid [VariableBaseName=>getSymbol "x",Variables=>n]);
if opts.OrderVariables == Up then R = (opts.CoefficientRing)(monoid [sort gens R]);
stronglyStableIdeals(hp, R, MaxRegularity=>opts.MaxRegularity)
) -- END stronglyStableIdeals (ProjectiveHilbertPolynomial,ZZ)
stronglyStableIdeals (RingElement,PolynomialRing) := opts -> (p,R) -> stronglyStableIdeals(projectiveHilbertPolynomial p, R, opts)
stronglyStableIdeals (RingElement,ZZ) := opts -> (p,n) -> stronglyStableIdeals(projectiveHilbertPolynomial p, n, opts)
stronglyStableIdeals (ZZ,PolynomialRing) := opts -> (d,R) -> stronglyStableIdeals (projectiveHilbertPolynomial d_(QQ[local t]), R, opts)
stronglyStableIdeals (ZZ,ZZ) := opts -> (d,n) -> stronglyStableIdeals (projectiveHilbertPolynomial d_(QQ[local t]), n, opts)
--------
-- isGenSegment
--------
isGenSegment = method(TypicalValue => Sequence)
isGenSegment MonomialIdeal := J -> (
if not isBorel J then error "argument 1: expected a strongly stable ideal";
R := ring J;
RmodJ := R/J;
markedTerms := gens R;
completePolynomials := for i from 0 to numgens R - 1 list if i != numgens R - 1 then R_i+R_(i+1) else R_i + 1;
for m in rsort J_* do
(
markedTerms = append(markedTerms,m);
completePolynomials = append(completePolynomials, m + sum(for t in flatten entries basis(first degree m,RmodJ) list lift(t,R)));
);
GC := gfanGroebnerCone markedPolynomialList {markedTerms, completePolynomials};
W := flatten entries interiorVector coneFromVData rays GC;
if isSegmentWeightVector(W,markedTerms,completePolynomials) then (true,W) else (false,null)
) -- END isGenSegment MonomialIdeal
isGenSegment Ideal := J -> (
if not isMonomialIdeal J then error "argument 1: expected a monomial ideal";
isGenSegment monomialIdeal J
)
--------
-- isRegSegment
--------
isRegSegment = method(TypicalValue => Sequence)
isRegSegment MonomialIdeal := J -> isGenSegment truncate(regularity J,J)
isRegSegment Ideal := J -> (
if not isMonomialIdeal J then error "argument 1: expected a monomial ideal";
isRegSegment monomialIdeal J
)
--------
-- isHilbSegment
--------
isHilbSegment = method(TypicalValue => Sequence)
isHilbSegment MonomialIdeal := J -> isGenSegment truncate(gotzmannNumber hilbertPolynomial J,J)
isHilbSegment Ideal := J -> (
if not isMonomialIdeal J then error "argument 1: expected a monomial ideal";
isHilbSegment monomialIdeal J
)
---------------------------------------------------------------
-- AUXILIARY TYPES AND METHODS (unexported) --
---------------------------------------------------------------
---------------------------------
polynomialBinom = method (TypicalValue => RingElement)
polynomialBinom (ZZ,ZZ,Ring) := (a,b,R) -> (
var := R_0;
product(for i from 0 to b-1 list (var+a-i)/(i+1))
)
---------------------------------
---------------------------------
lexIdealExponents = method(TypicalValue => List)
lexIdealExponents ProjectiveHilbertPolynomial := hp -> (
gotzmannDec := gotzmannDecomposition hp;
d := dim hp;
lexExp := new MutableList from for i from 0 to d list 0;
for s in gotzmannDec do lexExp#(dim s) = lexExp#(dim s)+1;
toList lexExp
)
lexIdealExponents RingElement := p -> (
gotzmannDec := gotzmannDecomposition p;
d := first degree p;
lexExp := new MutableList from for i from 0 to d list 0;
for s in gotzmannDec do lexExp#(dim s) = lexExp#(dim s)+1;
toList lexExp
)
---------------------------------
---------------------------------
BorelSet = new Type of HashTable
protect NumVariables
protect MinimalElements
protect Size
protect GrowthVector
---------------------------------
---------------------------------
recursiveCall = method (TypicalValue => List)
recursiveCall (BorelSet,List) := (B,hpSeq) -> (
newB := addNextVariable(B);
S := ring(B.MinimalElements#0);
toRemove := hpSeq#(numgens S - newB.NumVariables) - newB.Size;
if toRemove >= 0 then removeMonomials(newB, toRemove, 1_S, hpSeq) else {}
)
---------------------------------
---------------------------------
removeMonomials = method (TypicalValue=>List)
removeMonomials (BorelSet,ZZ,RingElement,List) := (B,toRemove,lastRemoved,hpSeq) -> (
S := ring(B.MinimalElements#0);
lastVar := B.NumVariables-1;
if toRemove == 0 then
(
if B.NumVariables == numgens(S) then return {ideal(B.MinimalGenerators)} else return recursiveCall(B,hpSeq);
)
else
(
output := {};
for m in B.MinimalElements do
(
if m > lastRemoved and degree(S_lastVar,m) > 0 then
(
newB := removeMinimal(B,m);
output = output | removeMonomials(newB,toRemove-1,m,hpSeq);
);
);
return output;
);
)
---------------------------------
---------------------------------
removeMinimal = method(TypicalValue => BorelSet)
removeMinimal (BorelSet,RingElement) := (B,m) -> (
S := ring(B.MinimalElements#0);
newMinimalElements := delete(m, B.MinimalElements);
n := B.NumVariables;
newMinimalElements = newMinimalElements | toList(select(apply(select(1..n-1, i -> degree(S_i, m) > 0), j -> (up := (m//S_j)*S_(j-1); if not precBorel(up, newMinimalElements) then return up)), i -> i=!=null));
h := degree(S_(B.NumVariables-1), m);
newGrowthVector := new MutableList from B.GrowthVector;
newGrowthVector#h = newGrowthVector#h + 1;
minGen := m//(S_(B.NumVariables-1)^h);
newMinimalGenerators := delete(minGen,B.MinimalGenerators);
newMinimalGenerators = newMinimalGenerators | for i in max(0, minimum(minGen)) .. B.NumVariables-2 list minGen*S_i;
new BorelSet from {NumVariables => B.NumVariables,
Degree => B.Degree,
Size => B.Size-1,
MinimalElements => rsort(newMinimalElements),
MinimalGenerators => sort(newMinimalGenerators),
GrowthVector => toList(newGrowthVector)}
)
---------------------------------
---------------------------------
addNextVariable = method(TypicalValue => BorelSet)
addNextVariable BorelSet := B -> (
v := B.NumVariables;
S := ring(B.MinimalElements#0);
newMinimalElements := {};
for monomial in B.MinimalElements do
(
lastDeg := degree(S_(v-1),monomial);
if lastDeg > 0 then
(
newMinimalElements = append(newMinimalElements, monomial//(S_(v-1)^lastDeg)*(S_v^lastDeg));
)
else
(
newMinimalElements = append(newMinimalElements, monomial);
);
);
newGrowthVector := {};
newSize := 0;
for i from 0 to B.Degree do
(
newGrowthVector = append(newGrowthVector, sum (for j from i to B.Degree list B.GrowthVector#j));
newSize = newSize + (B.GrowthVector#i)*(i+1);
);
new BorelSet from {NumVariables => v+1,
Degree => B.Degree,
Size => newSize,
MinimalElements => newMinimalElements,
MinimalGenerators => B.MinimalGenerators,
GrowthVector => newGrowthVector}
)
---------------------------------
---------------------------------
minimum = method(TypicalValue => ZZ)
minimum RingElement := m -> (
if first degree m == 0 then return 0;
R := ring m;
i := numgens R - 1;
while degree(R_i,m) == 0 do i = i-1;
i
)
---------------------------------
---------------------------------
precBorel = method(TypicalValue => Boolean)
precBorel (RingElement,RingElement) := (m,n) -> (
S := ring m;
v := numgens S;
s := 0;
for i from 0 to v-1 do (
s = s + degree(S_i,m) - degree(S_i,n);
if s < 0 then return false;
);
true
)
---------------------------------
---------------------------------
precBorel (RingElement, List) := (m,L) -> (
l:=#L;
for i from 0 to l-1 do (
if precBorel(m, L#i) then return true;
);
false
)
---------------------------------
---------------------------------
isSegmentWeightVector = method(TypicalValue=>Boolean)
isSegmentWeightVector (List, List, List) := (W,markedTerms,completePolynomials) -> (
for i from 0 to #markedTerms-1 do
(
for t in terms (completePolynomials#i - markedTerms#i) do
(
if dotProduct(W,flatten exponents(markedTerms#i)) <= dotProduct(W,flatten exponents(t)) then return false;
);
);
true
)
---------------------------------
---------------------------------
dotProduct = method(TypicalValue=>RingElement)
dotProduct (List, List) := (L,M) -> sum for i from 0 to #L-1 list L#i*M#i
---------------------------------
------------------------------------------
----- ASSERT TESTS -----
------------------------------------------
-- isHilbertPolynomial
TEST ///
QQ[t];
assert (isHilbertPolynomial(4*t));
assert (not isHilbertPolynomial(4*t-3));
assert (isHilbertPolynomial(projectiveHilbertPolynomial(3)));
assert (not isHilbertPolynomial(-projectiveHilbertPolynomial(2)));
///
-- gotzmannDecomposition
TEST ///
QQ[t];
p = 3*t+1;
assert (gotzmannDecomposition p == {projectiveHilbertPolynomial(1,0),
projectiveHilbertPolynomial(1,-1),
projectiveHilbertPolynomial(1,-2),
projectiveHilbertPolynomial(0,-3)});
q = 2*projectiveHilbertPolynomial(1,0);
assert (gotzmannDecomposition q == {projectiveHilbertPolynomial(1,0),
projectiveHilbertPolynomial(1,-1),
projectiveHilbertPolynomial(0,-2)});
///
-- macaulayDecomposition
TEST ///
QQ[t];
p = 3*t+1;
assert (macaulayDecomposition p == {projectiveHilbertPolynomial(1,-1),
-projectiveHilbertPolynomial(1,-1-4),
projectiveHilbertPolynomial(2,-1),
-projectiveHilbertPolynomial(2,-1-3)});
q = 2*projectiveHilbertPolynomial(1,0);
assert (macaulayDecomposition q == {projectiveHilbertPolynomial(1,-1),
-projectiveHilbertPolynomial(1,-1-3),
projectiveHilbertPolynomial(2,-1),
-projectiveHilbertPolynomial(2,-1-2)});
///
-- gotzmannNumber
TEST ///
QQ[t];
p = 3*t+1;
assert (gotzmannNumber p == 4);
QQ[x,y,z];
I = ideal(x^2,x*y,y^4);
assert (gotzmannNumber(hilbertPolynomial I) == 5);
///
-- projectiveHilbertPolynomial
TEST ///
QQ[t];
p = 2*t+2;
assert(projectiveHilbertPolynomial p == 2*projectiveHilbertPolynomial(1,0));
///
-- lexIdeal
TEST ///
S = QQ[x_0..x_2];
L = lexIdeal(10,S);
assert (L == ideal(x_0,x_1^10));
///
-- stronglyStableIdeals
TEST ///
QQ[t];
SSI = stronglyStableIdeals(4*t,4);
assert(#SSI == 4);
///
-- isGenSegment
TEST ///
QQ[x,y,z];
I = ideal(x^2,x*y,y^4);
assert((isGenSegment I)#0);
///
-- isRegSegment
TEST ///
QQ[x,y,z];
I = ideal(x^2,x*y,y^4);
assert((isRegSegment I)#0);
///
-- isHilbSegment
TEST ///
QQ[x,y,z];
I = ideal(x^2,x*y,y^4);
assert((isHilbSegment I)#0);
///
-------------------------------------------
----- DOCUMENTATION -----
-------------------------------------------
beginDocumentation()
doc ///
Key
StronglyStableIdeals
Headline
Find strongly stable ideals with a given Hilbert polynomial
Description
Text
{\bf Overview:}
Strongly stable ideals are a key tool in commutative algebra and algebraic geometry. These ideals have nice combinatorial properties
that make them well suited for both theoretical and computational applications. In the case of polynomial rings with coefficients in
a field of characteristic zero, the notion of strongly stable ideals coincides with the notion of Borel-fixed ideals. Such ideals are
fixed by the action of the Borel subgroup of triangular matrices and play a special role in theory of Gröbner bases because initial
ideals in generic coordinates are of this type by a famous result by Galligo.
In the context of parameter spaces of algebraic varieties, Galligo's theorem says that each component and each intersection of
components of a Hilbert scheme contains at least a point corresponding to a scheme defined by a Borel-fixed ideal. Hence, these ideals
are distributed throughout the Hilbert scheme and can be used to study its local structure. To this aim, in recent years several authors
developed algorithmic methods based on the use of strongly stable ideals to construct flat families corresponding to special loci of
the Hilbert scheme. In particular, a new open cover of the Hilbert scheme has been defined using strongly stable ideals and the action
of the projective linear group. In this construction, the list of all points corresponding to Borel-fixed ideals in a given Hilbert
scheme is needed.
The main feature of this package is a method to compute this set of points, i.e. the list of all saturated strongly stable ideals in
a polynomial ring with a given Hilbert polynomial. The method has been theoretically introduced in [CLMR11] and improved in [Lel12].
{\bf References:}
[CLMR11] F. Cioffi, P. Lella, M.G. Marinari, M. Roggero: Segments and Hilbert schemes of points, {\it Discrete Mathematics}, 311(20):2238–2252, 2011.
@BR{}@ Available at @HREF{"http://arxiv.org/abs/1003.2951"}@.
[Lel12] P. Lella: An efficient implementation of the algorithm computing the Borel-fixed points of a Hilbert scheme,
{\it ISSAC 2012 — Proceedings of the 37th International Symposium on Symbolic and Algebraic Computation}, 242–248, ACM, New York, 2012.
@BR{}@ Available at @HREF{"http://arxiv.org/abs/1205.0456"}@.
{\bf Key user functions:}
{\it Hilbert polynomials:}
@TO isHilbertPolynomial@ -- Test whether a numerical polynomial is a Hilbert polynomial.
@TO gotzmannDecomposition@ -- Compute Gotzmann's decomposition of a Hilbert polynomial.
@TO gotzmannNumber@ -- Compute the Gotzmann number of a Hilbert polynomial.
@TO macaulayDecomposition@ -- Compute Macaulay's decomposition of a Hilbert polynomial.
{\it Strongly stable ideals and segment ideals:}
@TO lexIdeal@ -- Compute the saturated lexicographic ideal with a given Hilbert polynomial.
@TO stronglyStableIdeals@ -- Compute the saturated strongly stable ideals with a given Hilbert polynomial.
@TO isGenSegment@ -- Test whether there exists a term ordering such that each minimal generator of a strongly stable ideal is greater than all mononials of the same degree outside the ideal.
@TO isRegSegment@ -- Test whether the truncation of a strongly stable ideal in degree equal to its regularity is a segment.
@TO isHilbSegment@ -- Test whether the truncation of a strongly stable ideal in degree equal to the Gotzmann number of its Hilbert polynomial is a segment.
///
doc ///
Key
isHilbertPolynomial
(isHilbertPolynomial, ProjectiveHilbertPolynomial)
(isHilbertPolynomial, RingElement)
Headline
Determine whether a numerical polynomial can be a Hilbert polynomial
Usage
isHilbertPolynomial p
Inputs
p : ProjectiveHilbertPolynomial
or
p : RingElement
a numerical univariate polynomial.
Outputs
: Boolean
Description
Text
Returns true if the input polynomial is an admissible Hilbert polynomial, false otherwise.
Example
QQ[t];
isHilbertPolynomial(3*t+4)
isHilbertPolynomial((2/3)*t-1)
isHilbertPolynomial(2*projectiveHilbertPolynomial(2))
isHilbertPolynomial(2*projectiveHilbertPolynomial(2,-1))
///
doc ///
Key
gotzmannDecomposition
(gotzmannDecomposition, ProjectiveHilbertPolynomial)
(gotzmannDecomposition, RingElement)
Headline
Compute Gotzmann's decomposition of Hilbert polynomial
Usage
gotzmannDecomposition hp
Inputs
hp : ProjectiveHilbertPolynomial
or
hp : RingElement
a Hilbert polynomial.
Outputs
: List
Description
Text
Returns the list of projective Hilbert polynomials of linear spaces summing up to the input polynomial:
Example
QQ[t];
hp = projectiveHilbertPolynomial(3*t+4)
gD = gotzmannDecomposition hp
sum gD
Description
Text
The decomposition suggests the most degenerate geometric object with the given Hilbert polynomial.
Example
R = QQ[x,y,z,w];
completeIntersection22 = ideal(random(2,R),random(2,R));
hp = hilbertPolynomial completeIntersection22
gD = gotzmannDecomposition hp
Description
Text
The degree of {\tt hp} is 1, so it is possible to obtain {\tt hp} as Hilbert polynomial of a
scheme in the plane. Gotzmann's decomposition has 4 terms of degree 1 and 2 term of degree 0.
This suggests that the generic union of 4 lines and 2 points in a plane should have Hilbert polynomial {\tt hp}:
Example
H = random(1,R);
fourLines = for i from 1 to 4 list ideal(H,random(1,R));
twoPoints = for i from 1 to 2 list ideal(H,random(1,R),random(1,R));
unionLinesPoints = intersect(fourLines|twoPoints);
hilbertPolynomial unionLinesPoints == hp
///
doc ///
Key
macaulayDecomposition
(macaulayDecomposition, ProjectiveHilbertPolynomial)
(macaulayDecomposition, RingElement)
Headline
Compute Macaulay's decomposition of Hilbert polynomial
Usage
macaulayDecomposition hp
Inputs
hp : ProjectiveHilbertPolynomial
or
hp : RingElement
a Hilbert polynomial.
Outputs
: List
Description
Text
Returns the list of projective Hilbert polynomials of linear spaces summing up to the input polynomial:
Example
QQ[t];
hp = projectiveHilbertPolynomial(3*t+4)
mD = macaulayDecomposition hp
sum mD
///
doc ///
Key
gotzmannNumber
(gotzmannNumber, ProjectiveHilbertPolynomial)
(gotzmannNumber, RingElement)
Headline
Compute the Gotzmann number of a Hilbert polynomial
Usage
gotzmannNumber hp
Inputs
hp : ProjectiveHilbertPolynomial
or
hp : RingElement
a Hilbert polynomial.
Outputs
: ZZ
Description
Text
Returns the Gotzmann number of the input polynomial, i.e. the length of its Gotzmann decomposition (see @TO gotzmannDecomposition@).
Example
QQ[t];
gotzmannNumber(3*t+4)
gotzmannDecomposition(3*t+4)
///
doc ///
Key
(projectiveHilbertPolynomial, RingElement)
Headline
Usage
projectiveHilbertPolynomial p
Inputs
p : RingElement
a Hilbert polynomial.
Outputs
: ProjectiveHilbertPolynomial
Description
Text
Convert a @TO RingElement@ representing a Hilbert polynomial to a @TO ProjectiveHilbertPolynomial@.
Example
QQ[t];
projectiveHilbertPolynomial (3*t+4)
///
doc ///
Key
OrderVariables
Headline
Option to set the order of indexed variables
Description
Text
This option can be used to specify the order of the indexed variables of the polynomial ring containing the ideals,
when calling @TO lexIdeal@ or @TO stronglyStableIdeals@ giving as input only the number of variables of the polynomial ring.
If @TO OrderVariables@ is set to @TO Up@ then @TT "x_i < x_j"@ iff @TT "i < j"@, otherwise
if @TO OrderVariables@ is set to @TO Down@ then @TT "x_i < x_j"@ iff @TT "i > j"@.
The default is @TO Down@.
Example
lexIdeal(3, 3, OrderVariables=>Down)
stronglyStableIdeals(3, 3, OrderVariables=>Up)
///
doc ///
Key
lexIdeal
(lexIdeal, ProjectiveHilbertPolynomial, PolynomialRing)
(lexIdeal, ProjectiveHilbertPolynomial, ZZ)
(lexIdeal, RingElement, PolynomialRing)
(lexIdeal, RingElement, ZZ)
(lexIdeal, ZZ, PolynomialRing)
(lexIdeal, ZZ, ZZ)
Headline
Compute the saturated lexicographic ideal in the given ambient space with given Hilbert polynomial
Usage
lexIdeal (hp ,S)
lexIdeal (hp, n)
lexIdeal (d, S)
lexIdeal (d, n)
Inputs
hp : ProjectiveHilbertPolynomial
or
hp : RingElement
a Hilbert polynomial;
d : ZZ
a positive integer corresponding to a constant Hilbert polynomial;
S : PolynomialRing
with @TT "numgens S > 1"@;
n : ZZ
number of variables of the polynomial ring.
Outputs
: Ideal
Description
Text
Returns the saturated lexicographic ideal defining a subscheme of \mathbb{P}^{n} or @TT "Proj S"@
with Hilbert polynomial @TT "hp"@ or @TT "d"@.
Example
QQ[t];
S = QQ[x,y,z,w];
lexIdeal(4*t, S)
lexIdeal(4*t, 5)
hp = hilbertPolynomial oo
lexIdeal(hp, S)
lexIdeal(hp, 3)
lexIdeal(5, S)
lexIdeal(5, 3)
///
doc ///
Key
[lexIdeal,CoefficientRing]
Headline
Option to set the ring of coefficients
Description
Text
This option can be used to specify the ring of coefficients of the polynomial ring containing the ideals,
when calling @TO lexIdeal@ giving as input only the number of variables of the polynomial ring.
The default is @TO QQ@.
Example
lexIdeal(10, 3, CoefficientRing=>ZZ/101)
///
doc ///
Key
[lexIdeal,OrderVariables]
Headline
Option to set the order of indexed variables
Description
Text
This option can be used to specify the order of the indexed variables of the polynomial ring containing the ideals,
when calling @TO lexIdeal@ giving as input only the number of variables of the polynomial ring.
If @TO OrderVariables@ is set to @TO Up@ then @TT "x_i < x_j"@ iff @TT "i < j"@, otherwise
if @TO OrderVariables@ is set to @TO Down@ then @TT "x_i < x_j"@ iff @TT "i > j"@.
The default is @TO Down@.
Example
lexIdeal(3, 3, OrderVariables=>Down)
lexIdeal(3, 3, OrderVariables=>Up)
///
doc ///
Key
stronglyStableIdeals
(stronglyStableIdeals, ProjectiveHilbertPolynomial, PolynomialRing)
(stronglyStableIdeals, ProjectiveHilbertPolynomial, ZZ)
(stronglyStableIdeals, RingElement, PolynomialRing)
(stronglyStableIdeals, RingElement, ZZ)
(stronglyStableIdeals, ZZ, PolynomialRing)
(stronglyStableIdeals, ZZ, ZZ)
Headline
Compute the saturated strongly stable ideals in the given ambient space with given Hilbert polynomial
Usage
stronglyStableIdeals (hp ,S)
stronglyStableIdeals (hp, n)
stronglyStableIdeals (d, S)
stronglyStableIdeals (d, n)
Inputs
hp : ProjectiveHilbertPolynomial
or
hp : RingElement
a Hilbert polynomial;
d : ZZ
a positive integer corresponding to a constant Hilbert polynomial;
S : PolynomialRing
with @TT "numgens S > 1"@;
n : ZZ
number of variables of the polynomial ring.
Outputs
: List
Description
Text
Returns the list of all the saturated strongly stable ideals defining subschemes of \mathbb{P}^{n} or @TT "Proj S"@
with Hilbert polynomial @TT "hp"@ or @TT "d"@.
Example
QQ[t];
S = QQ[x,y,z,w];
stronglyStableIdeals(4*t, S)
stronglyStableIdeals(4*t, 4)
hp = hilbertPolynomial(oo#0)
stronglyStableIdeals(hp, S)
stronglyStableIdeals(hp, 4)
stronglyStableIdeals(5, S)
stronglyStableIdeals(5, 4)
///
doc ///
Key
MaxRegularity
[stronglyStableIdeals,MaxRegularity]
Headline
Option to set the maximum regularity
Description
Text
This option can be used to give an upper bound to the regularity of the strongly stable ideals.
The default is null (i.e. no bound).
Example
QQ[t];
stronglyStableIdeals(4*t, 4, MaxRegularity=>4)
///
doc ///
Key
[stronglyStableIdeals,CoefficientRing]
Headline
Option to set the ring of coefficients
Description
Text
This option can be used to specify the ring of coefficients of the polynomial ring containing the ideals,
when calling @TO stronglyStableIdeals@ giving as input only the number of variables of the polynomial ring.