forked from pbelmans/hodge-diamond-cutter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiamond.py
3018 lines (2061 loc) · 85.7 KB
/
diamond.py
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
r"""
A tool to work with Hodge diamonds, comes with many varieties and constructions
built into it.
Hodge diamonds encode the Hodge numbers of a variety, and provide interesting
information about its structure. They provide a numerical incarnation of many
operations one can perform in algebraic geometry, such as blowups, projective
bundles, products. They are also computed for many more specific constructions
such as certain moduli spaces of sheaves, or flag varieties, ...
These Hodge numbers are defined as the dimensions of the sheaf cohomology of
exterior powers of the cotangent bundle, i.e.
.. MATH::
\mathrm{h}^{p,q}(X)=\dim\mathrm{H}^q(X,\Omega_X^p)
Here $p$ and $q$ range from $0$ to $n=\\dim X$. These numbers satisfy additional
symmetry properties:
* Hodge symmetry: $\\mathrm{h}^{p,q}(X)=\\mathrm{h}^{q,p}(X)$
* Serre duality: $\\mathrm{h}^{p,q}(X)=\\mathrm{h}^{n-p,n-q}(X)$
Because of these symmetries they are usually displayed as a diamond (it's
really just a square tilted 45 degrees), so that for a surface it would be::
h^{2,2}
h^{2,1} h^{1,2}
h^{2,0} h^{1,1} h^{0,2}
h^{1,0} h^{0,1}
h^{0,0}
One of their famous applications is the mirror symmetry prediction that every
Calabi-Yau 3-fold has a mirror Calabi-Yau threefold, which should imply that
their Hodge diamonds are transpositions. The first instance of this is the
quintic 3-fold and its mirror, whose Hodge diamonds are::
1
0 0
0 1 0
1 101 101 1
0 1 0
0 0
1
and::
1
0 0
0 101 0
1 1 1 1
0 101 0
0 0
1
The following are some very basic examples of operations and constructions one
can use within the Hodge diamond cutter. To get started we do::
sage: load("diamond.py")
after starting Sage.
Pretty print the Hodge diamond of a genus 2 curve::
sage: X = HodgeDiamond.from_matrix([[1, 2], [2, 1]])
sage: print(X)
1
2 2
1
Compute the Euler characteristic of the product of `X` with itself::
sage: print((X*X).euler())
4
Pretty print the Hodge diamond of the Hilbert square of a K3 surface::
sage: S = HodgeDiamond.from_matrix([[1, 0, 1], [0, 20, 0], [1, 0, 1]])
sage: print(hilbn(S, 2))
1
0 0
1 21 1
0 0 0 0
1 21 232 21 1
0 0 0 0
1 21 1
0 0
1
There are many varieties built in, e.g. the previously defined K3 surface can
be compared to the built-in one::
sage: print(S == K3())
True
AUTHORS:
- Pieter Belmans (2019-01-27): initial version
- Pieter Belmans (2020-06-16): the version which got assigned a DOI
- Pieter Belmans (2021-08-04): various additions, added unit tests and proper documentation
"""
# ****************************************************************************
# Copyright (C) 2021 Pieter Belmans <pieterbelmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************
from sage.all import cartesian_product, matrix, prod
from sage.all import FunctionField, LaurentPolynomialRing, PolynomialRing, PowerSeriesRing
from sage.all import QQ, ZZ
class HodgeDiamond:
r"""
This class implements some methods to work with Hodge diamonds.
"""
#: polynomial ring used internally for the Hodge-Poincaré polynomial
#: and can be used externally to create new polynomials (and thus diamonds)
R = PolynomialRing(ZZ, ("x", "y"))
#: variables in the polynomial ring for Hodge-Poincaré polynomials
(x, y) = R.gens()
def __init__(self, m):
r"""
Constructor for a Hodge diamond if you know what you are doing
This just uses the given matrix. It is probably advised to use the
class methods
* :meth:`HodgeDiamond.from_matrix`
* :meth:`HodgeDiamond.from_polynomial`
in most cases though.
"""
# matrix representation of the Hodge diamond is used internally
self._m = m
@classmethod
def from_matrix(cls, m, from_variety=False):
r"""
Construct a Hodge diamond from a matrix
INPUT:
- ``m`` -- square integer matrix representing a Hodge diamond
- ``from_variety`` (default: False) -- whether a check should be
performed that it comes from a variety
EXAMPLES:
Hodge diamond of a K3 surface::
sage: load("diamond.py")
sage: S = HodgeDiamond.from_matrix([[1, 0, 1], [0, 20, 0], [1, 0, 1]])
sage: S == K3()
True
The following fails as the lack of symmetry prevents a geometric origin::
sage: HodgeDiamond.from_matrix([[1, 2], [0, 1]], from_variety=True)
Traceback (most recent call last):
...
AssertionError: The matrix does not
satisfy the conditions satisfied by the Hodge diamond of a
smooth projective variety.
"""
diamond = cls(matrix(m))
if from_variety:
assert diamond.arises_from_variety(), \
"""The matrix does not satisfy the conditions satisfied by the
Hodge diamond of a smooth projective variety."""
# get rid of trailing zeroes from the diamond
diamond.matrix = HodgeDiamond.__to_matrix(diamond.polynomial)
return diamond
@classmethod
def from_polynomial(cls, f, from_variety=False):
r"""
Construct a Hodge diamond from a Hodge--Poincaré polynomial
INPUT:
- ``f`` -- an integer polynomial in the ring ``HodgeDiamond.R``
representing the Hodge--Poincaré polynomial
- ``from_variety`` (default: False) -- whether a check should be
performed that it comes from a variety
EXAMPLES:
Hodge diamond of a K3 surface::
sage: load("diamond.py")
sage: (x, y) = (HodgeDiamond.x, HodgeDiamond.y)
sage: S = HodgeDiamond.from_polynomial(1 + x**2 + 20*x*y + y**2 + x**2 * y**2)
sage: S == K3()
True
The following fails as the lack of symmetry prevents a geometric origin::
sage: HodgeDiamond.from_polynomial(1 + x, from_variety=True)
Traceback (most recent call last):
...
AssertionError: The matrix does not
satisfy the conditions satisfied by the Hodge diamond of a
smooth projective variety.
"""
diamond = cls(cls.__to_matrix(f))
if from_variety:
assert diamond.arises_from_variety(), """The matrix does not
satisfy the conditions satisfied by the Hodge diamond of a
smooth projective variety."""
return diamond
@property
def polynomial(self):
r"""The Hodge--Poincaré polynomial describing the Hodge diamond
:getter: returns the Hodge--Poincaré polynomial
:setter: sets the Hodge diamond using a Hodge--Poincaré polynomial
:type: element of :attr:`HodgeDiamond.R`
EXAMPLES:
The Hodge--Poincaré polynomial of a K3 surface::
sage: load("diamond.py")
sage: print(K3().polynomial)
x^2*y^2 + x^2 + 20*x*y + y^2 + 1
Modifying the Hodge diamond of the projective plane::
sage: X = Pn(2)
sage: X.polynomial = X.polynomial + X.x * X.y
sage: print(X)
1
0 0
0 2 0
0 0
1
"""
return sum([self.matrix[i,j] * self.x**i * self.y**j for (i, j) in \
cartesian_product([range(self.matrix.nrows()), \
range(self.matrix.ncols())])])
@polynomial.setter
def polynomial(self, f):
r"""Setter for the Hodge--Poincaré polynomial"""
self.matrix = HodgeDiamond.__to_matrix(f)
@property
def matrix(self):
r"""The matrix describing the Hodge diamond
:getter: returns the matrix
:setter: sets the Hodge diamond using a matrix
:type: square matrix of integers
"""
return self._m
@matrix.setter
def matrix(self, m):
r"""Setter for the Hodge diamond as a matrix"""
m = matrix(m)
assert m.base_ring() == ZZ, "Entries need to be integers"
assert m.is_square()
self._m = matrix(m)
self.__normalise()
@staticmethod
def __to_matrix(f):
r"""Convert Hodge--Poincaré polynomial to matrix representation"""
assert f in HodgeDiamond.R
if f.is_zero():
m = matrix([[0]])
else:
# deal with the size of the diamond in this way because of the following example:
# X = complete_intersection(5, 3)
# X*X - hilbtwo(X)
d = max([max(e) for e in f.exponents()]) + 1
m = matrix(d)
for (i, j) in cartesian_product([range(d), range(d)]):
m[i, j] = f.monomial_coefficient(HodgeDiamond.x**i * HodgeDiamond.y**j)
return m
def __size(self):
r"""Internal method to determine the (relevant) size of the Hodge diamond"""
return self.matrix.ncols() - 1
def __normalise(self):
r"""Internal method to get rid of trailing zeros"""
self._m = HodgeDiamond.__to_matrix(self.polynomial)
def __eq__(self, other):
r"""Check whether two Hodge diamonds are equal
This compares the Hodge polynomials, not the possibly oversized
matrices describing the Hodge diamond.
EXAMPLES:
A quartic surface is a K3 surface::
sage: load("diamond.py")
sage: K3() == hypersurface(4, 2)
True
"""
return self.polynomial == other.polynomial
def __ne__(self, other):
r"""Check whether two Hodge diamonds are not equal
EXAMPLES:
The projective line is not a genus 2 curve::
sage: load("diamond.py")
sage: Pn(1) != curve(2)
True
The point is not the Lefschetz class::
sage: point() != lefschetz()
True
"""
return not self == other
def __add__(self, other):
r"""Add two Hodge diamonds together
This corresponds to taking the disjoint union of varieties, or the
direct sum of the Hodge structure.
EXAMPLES:
Hodge diamond of the projective line is the sum of that of a point
and the Lefschetz diamond::
sage: load("diamond.py")
sage: Pn(1) == point() + lefschetz()
True
Adding zero doesn't do anything::
sage: K3() + zero() == K3()
True
"""
return HodgeDiamond.from_polynomial(self.polynomial + other.polynomial)
def __radd__(self, other):
r"""Add two Hodge diamonds together
This is used when sum()'ing for instance."""
# to make sum() work as intended, which by default starts with 0
if other == 0: return self
return HodgeDiamond.from_polynomial(self.polynomial + other.polynomial)
def __sub__(self, other):
r"""Subtract two Hodge diamonds
EXAMPLES:
Hodge diamond of the projective line is the sum of that of a point
and the Lefschetz diamond, but now we check it the other way around::
sage: load("diamond.py")
sage: Pn(1) - point() == lefschetz()
True
"""
return HodgeDiamond.from_polynomial(self.polynomial - other.polynomial)
def __mul__(self, other):
r"""Multiply two Hodge diamonds
This corresponds to taking the product of two varieties.
EXAMPLES:
The quadric surface is the product of two projective lines::
sage: load("diamond.py")
sage: Pn(1) * Pn(1) == hypersurface(2, 2)
True
The product is commutative::
sage: K3() * curve(5) == curve(5) * K3()
True
The point is the unit::
sage: K3() * point() == point() * K3() == K3()
True
"""
if not isinstance(other, HodgeDiamond): # in the rare case someone does X*3 instead of 3*X
return other * self
return HodgeDiamond.from_polynomial(self.polynomial * other.polynomial)
def __rmul__(self, factor):
r"""Multiply a Hodge diamond with a factor
This corresponds to iterated addition.
INPUT:
- ``factor`` -- coefficient for the iterated addition
EXAMPLES:
The disjoint union of 2 K3 surfaces in two ways:
sage: load("diamond.py")
sage: 2*K3() == K3() + K3()
True
"""
return HodgeDiamond.from_polynomial(factor * self.polynomial)
def __pow__(self, power):
r"""Raise a Hodge diamond to a power
This corresponds to iterated multiplication.
INPUT:
- ``power`` -- exponent for the iterated multiplication
EXAMPLES:
The product of 2 K3 surfaces in two ways::
sage: load("diamond.py")
sage: K3()**2 == K3()*K3()
True
"""
return HodgeDiamond.from_polynomial(self.polynomial ** power)
def __call__(self, i, y=None):
r"""
The calling operator either does a Lefschetz twist, or an evaluation
If one parameter is present, then twist by a power of the Lefschetz
Hodge diamond. If two parameters are present, then evaluate the
Hodge-Poincaré polynomial
Negative values are allowed to untwist, up to the appropriate power.
INPUT:
- ``i`` -- integer denoting the power of the Lefschetz class, or
value for the first variable
- ``y`` -- value of the second variable (default: ``None``), if it is
non-zero then ``i`` is reinterpreted as the value of the first variable
EXAMPLES:
The Lefschetz class is by definition the twist of the point::
sage: load("diamond.py")
sage: lefschetz() == point()(1)
True
We can reconstruct projective space as a sum of twists of the point::
sage: Pn(10) == sum([point()(i) for i in range(11)])
True
If we supply two parameters we are evaluation the Hodge-Poincare
polynomial, e.g. to find the Euler characteristic::
sage: Pn(10)(1, 1) == 11
True
"""
if y == None:
assert i >= -self.lefschetz_power()
return HodgeDiamond.from_polynomial(self.R(self.polynomial * self.x**i * self.y**i))
else:
x = i
return self.polynomial(x, y)
def __getitem__(self, index):
r"""Get (p, q)th entry of Hodge diamond or the ith row of the Hodge diamond"""
# first try it as (p, q)
try:
(p, q) = index
if p < 0 or q < 0:
return 0
else:
try:
return self.matrix[p, q]
except IndexError:
return 0
# now we assume it's an integer
except TypeError:
# we could do something smarter, but this is it for now
return [self.matrix[p, index - p] for p in range(index + 1)]
def __repr__(self):
r"""Output diagnostic information
This is a one-line string giving some basic information about the Hodge
diamond. You'll see this when you just evaluate something which returns
a Hodge diamond. To see something more useful, you'll likely want to use
* :meth:`HodgeDiamond.__str__` via `print`
* :meth:`HodgeDiamond.pprint`
* :meth:`HodgeDiamond.polynomial`
EXAMPLES:
The projective line::
sage: load("diamond.py")
sage: Pn(1)
Hodge diamond of size 2 and dimension 1
"""
return "Hodge diamond of size {} and dimension {}".format(self.__size() + 1, self.dimension())
def __str__(self):
r"""Pretty print Hodge diamond
This gets called when you specifically print the object.
EXAMPLES:
The projective line::
sage: load("diamond.py")
sage: print(Pn(1))
1
0 0
1
"""
return str(self.pprint())
def __table(self):
r"""Generate a table object for the Hodge diamond"""
d = self.__size()
T = []
if self.is_zero():
T = [[0]]
else:
for i in range(2*d + 1):
row = [""]*(abs(d - i))
for j in range(max(0, i - d), min(i, d) + 1):
row.extend([self.matrix[j, i - j], ""])
T.append(row)
# padding all rows to full length
for i in range(len(T)):
T[i].extend([""]*(2*d - len(T[i]) + 1))
return table(T, align="center")
def pprint(self, format="table"):
r"""Pretty print the Hodge diamond
INPUT:
- ``format`` -- output format (default: `"table"`), if table it pretty prints
a Hodge diamond; all else defaults to the polynomial
EXAMPLES:
The projective line::
sage: load("diamond.py")
sage: Pn(1).pprint()
1
0 0
1
sage: Pn(1).pprint(format="polynomial")
x*y + 1
"""
if format == "table":
return self.__table()
else:
return self.polynomial
def __is_positive(self):
r"""Check whether all entries are positive integers"""
return all([hpq >= 0 for hpq in self.matrix.coefficients()])
def is_hodge_symmetric(self):
r"""Check whether the Hodge diamond satisfies Hodge symmetry
This checks the equality
.. MATH::
\mathrm{h}^{p,q}(X)=\mathrm{h}^{q,p}(X)
for $p,q=0,\\ldots,\\dim X$.
Almost all of the constructions provided with the library satisfy Hodge
symmetry, because we (somewhat implicitly) work with things which are
(or behave like) smooth projective varieties over a field of
characteristic zero.
Over the complex numbers this can fail for non-Kähler manifolds, such
as the Hopf surface.
In positive characteristic this can fail too, with an example given by
classical and singular Enriques surfaces in characteristic 2, see [MR0491720]
and Proposition 1.4.2 in [MR0986969]
* [MR0491720] Bombieri--Mumford, Enriques' classification of surfaces in char. p. III.
* [MR0986969] Cossec--Dolgachev, Enriques surfaces I, Progress in Mathematics, 1989
EXAMPLES:
Constructions satisfy this property::
sage: load("diamond.py")
sage: Pn(5).is_hodge_symmetric()
True
The Hopf surface over the complex numbers::
sage: S = HodgeDiamond.from_matrix([[1, 0, 0], [1, 0, 1], [0, 0, 1]])
sage: print(S)
1
0 1
0 0 0
1 0
1
sage: S.is_hodge_symmetric()
False
Classical and singular Enriques surfaces in characteristic 2
(which are smooth, despite their name) also have a Hodge diamond
violating Hodge symmetry::
sage: enriques(two="classical").is_hodge_symmetric()
False
sage: enriques(two="singular").is_hodge_symmetric()
False
sage: enriques(two="supersingular").is_hodge_symmetric()
True
"""
return self.matrix.is_symmetric()
def is_serre_symmetric(self):
r"""Check whether the Hodge diamond satisfies Serre symmetry
This checks the equality
.. MATH::
\mathrm{h}^{p,q}(X)=\mathrm{h}^{\dim X-p,\dim X-q}(X)
for $p,q=0,\\ldots,\\dim X$.
Because Serre duality holds for all smooth projective varieties,
independent of the characteristic, and also for non-Kähler varieties
there are no examples where this condition fails. It can of course fail
for motivic pieces, for silly reasons.
EXAMPLES:
The Hilbert scheme of 4 points on a K3 surface satisfies the symmetry::
sage: load("diamond.py")
sage: hilbn(K3(), 4).is_serre_symmetric()
True
The Lefschetz diamond fails it for silly reasons::
sage: lefschetz().is_serre_symmetric()
False
"""
d = self.__size()
return all([self.matrix[p, q] == self.matrix[d - p, d - q] for (p, q) in cartesian_product([range(d + 1), range(d + 1)])])
def betti(self):
r"""Betti numbers of the Hodge diamond
This gives an integer vector.
EXAMPLES:
Betti numbers of a K3 surface::
sage: load("diamond.py")
sage: K3().betti()
[1, 0, 22, 0, 1]
The second Betti number of the Hilbert scheme of points on a K3 surface
is 23, not 22::
sage: [hilbn(K3(), n).betti()[2] for n in range(2, 5)]
[23, 23, 23]
"""
d = self.__size()
return [sum([self.matrix[j, i - j] for j in range(max(0, i - d), min(i, d) + 1)]) for i in range(2*d + 1)]
def middle(self):
r"""Middle cohomology of the Hodge diamond
For smooth projective varieties the middle cohomology sits in degree
equal to the dimension.
EXAMPLES:
There is an interesting link between K3 surfaces and cubic fourfolds
which can be seen on the level of middle cohomology::
sage: load("diamond.py")
sage: (hypersurface(3, 4) - lefschetz()**2).middle()
[0, 1, 20, 1, 0]
sage: K3().middle()
[1, 20, 1]
"""
d = self.__size()
return [self.matrix[i, d - i] for i in range(d + 1)]
def euler(self):
r"""The topological Euler characteristic of the Hodge diamond
This is the alternating sum of the Betti numbers, so that
.. MATH::
\chi_{\mathrm{top}}=\sum_{p,q=0}^{\dim X}(-1)^{p+q}\mathrm{h}^{p,q}
EXAMPLES:
The Euler characteristic of projective space grows linearly::
sage: load("diamond.py")
sage: [Pn(n).euler() for n in range(10)]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
For Hilbert schemes of points of K3 surfaces these are the
coefficients of the series expansion of the Dedekind eta-function,
see A006922 in the OEIS::
sage: [hilbn(K3(), n).euler() for n in range(5)]
[1, 24, 324, 3200, 25650]
"""
return sum([(-1)**i * bi for i, bi in enumerate(self.betti())])
def holomorphic_euler(self):
r"""Holomorphic Euler characteristic
This is the Euler characteristic of the structure sheaf, so
.. MATH::
\chi(X)=\sum_{i=0}^{\dim X}(-1)^i\mathrm{h}^{0,i}(X)
EXAMPLES:
For projective space it is 1::
sage: load("diamond.py")
sage: all([Pn(n).holomorphic_euler() == 1 for n in range(10)])
True
For a hyperkähler variety of dimension $2n$ this number is $n+1$::
sage: all([K3n(n).holomorphic_euler() == n+1 for n in range(5)])
True
"""
return sum([(-1)**i * self.matrix[i, 0] for i in range(self.matrix.nrows())])
def hirzebruch(self):
r"""Hirzebruch's \chi_y genus
For a smooth projective variety $X$ Hirzebruch's $\\chi_y$-genus is
defined as
.. MATH::
\chi_y(X)=\sum_{p,q=0}^{\dim X}(-1)^{p+q}\mathrm{h}^{p,q}(X)y^p
which shows it is the specialisation of the Hodge-Poincaré polynomial
for $x=-1$. A further specialisation to $y=-1$ gives the Euler characteristic.
EXAMPLES:
For a K3 surface we have::
sage: load("diamond.py")
sage: K3().hirzebruch()
2*y^2 - 20*y + 2
sage: K3().hirzebruch().subs(y=-1) == K3().euler()
True
For the Hilbert square of a K3 surface we get::
sage: hilbn(K3(), 2).hirzebruch()
3*y^4 - 42*y^3 + 234*y^2 - 42*y + 3
sage: hilbn(K3(), 2).hirzebruch().subs(y=-1) == hilbn(K3(), 2).euler()
True
"""
return self.polynomial.subs(x=-1)
def homological_unit(self):
r"""Dimensions of $\\mathrm{H}^\bullet(X,O_X)$
A notion intorduced by Abuaf.
"""
return self.matrix.row(0)
def hochschild(self):
r"""Dimensions of the Hochschild homology
Columns of the Hodge diamond are Hochschild homology, by the Hochschild-
Kostant-Rosenberg theorem.
"""
d = self.__size()
return HochschildHomology([sum([self.matrix[d - i + j, j] for j in range(max(0, i - d), min(i, d) + 1)]) for i in range(2*d + 1)])
def hh(self):
r"""Shorthand for :meth:`HodgeDiamond.hochschild`"""
return self.hochschild()
def arises_from_variety(self):
r"""Check whether the Hodge diamond can arise from a smooth projective variety
The constraints are:
- satisfy Hodge symmetry
- satisfy Serre symmetry
- there is no Lefschetz twist
"""
return self.is_hodge_symmetric() and self.is_serre_symmetric() and self.lefschetz_power() == 0
def is_zero(self):
r"""Check whether the Hodge diamond is identically zero"""
return self.matrix.is_zero()
def lefschetz_power(self):
r"""Return the twist by the Lefschetz motive that is present
In other words, we see how divisible the Hodge--Poincaré polynomial is
with respect to the monomial $x^iy^i$"""
if self.is_zero(): return 0
i = 0
while (self.x**i * self.y**i).divides(self.polynomial):
i = i + 1
return i - 1
def dimension(self):
r"""Dimension of the Hodge diamond
This takes twists by the Lefschetz class into account: we untwist by
the maximal power and ony then determine how big the diamond is.
EXAMPLES:
A point is 0-dimensional::
sage: load("diamond.py")
sage: point().dimension()
0
The Lefschetz diamond is also 0-dimensional::
sage: print(lefschetz())
0
0 0
1
sage: lefschetz().dimension()
0
"""
assert self.is_hodge_symmetric()
if self.is_zero():
return -1
else:
return max([i for i in range(self.matrix.ncols()) if not self.matrix.column(i).is_zero()]) - self.lefschetz_power()
def level(self):
r"""Compute the level (or complexity) of the Hodge diamond
This is a measure of the width of the non-zero part of the Hodge diamond.
EXAMPLES:
The simplest case is projective space, with level zero::
sage: load("diamond.py")
sage: all([Pn(n).level() == 0 for n in range(10)])
True
For intersections of 2 quadrics it alternates between zero and one::
sage: all([complete_intersection([2,2], 2*n).level() == 0 for n in range(5)])
True
sage: all([complete_intersection([2,2], 2*n+1).level() == 1 for n in range(5)])
True
A Calabi-Yau variety (e.g. a hypersurface of degree $n+1$ in $\\mathbb{P}^n$) has maximal level::
sage: all([hypersurface(n+2, n).level() == n for n in range(10)])
True
"""
return max([abs(p - q) for (p, q) in [m.degrees() for m in self.polynomial.monomials()]])
def blowup(self, other, codim=None):
r"""Compute Hodge diamond of blowup
No consistency checks are performed, this just naively applies the blowup
formula from Hodge theory.
INPUT:
- ``other`` -- Hodge diamond of the center of the blowup