From 0c375f56a1ff75002e86a1ff70fe617ecab5a0d5 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sun, 1 Dec 2024 18:25:34 +0530 Subject: [PATCH 01/42] Created file for Kahler Algebras category --- src/sage/categories/kahler_algebras.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/sage/categories/kahler_algebras.py diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py new file mode 100644 index 00000000000..b0a4802101d --- /dev/null +++ b/src/sage/categories/kahler_algebras.py @@ -0,0 +1,14 @@ +r""" +Category of Kahler Algebras. + +AUTHORS: + +- Shriya M +""" + +from sage.categories.category_types import Category_over_base_ring +class KahlerAlgebras(Category_over_base_ring): + def super_categories(self): + pass + + \ No newline at end of file From 6287bb8d80557cf42e2f14eed4e9e54249867e0a Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Tue, 3 Dec 2024 17:57:27 +0530 Subject: [PATCH 02/42] Added poincare_pairing() method --- src/sage/categories/kahler_algebras.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index b0a4802101d..639d334e089 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -7,8 +7,20 @@ """ from sage.categories.category_types import Category_over_base_ring +from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis + class KahlerAlgebras(Category_over_base_ring): - def super_categories(self): - pass + class ParentMethods: + def super_categories(self): + return GradedAlgebrasWithBasis + def poincare_pairing(self, a, b, r): + if (a.homogeneous_degree() <= (r/2)) & (b.homogeneous_degree() == (r - a.homogeneous_degree())): + el = a*b + return el.degree() + + + + + \ No newline at end of file From 880e6ef20b16bf00831422cd9823692ed610aee6 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Mon, 9 Dec 2024 21:29:26 +0530 Subject: [PATCH 03/42] Added methods in kahler algebras category --- src/sage/categories/kahler_algebras.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 639d334e089..b42f55e52ae 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -8,6 +8,7 @@ from sage.categories.category_types import Category_over_base_ring from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis +from abc import abstractmethod class KahlerAlgebras(Category_over_base_ring): class ParentMethods: @@ -17,7 +18,20 @@ def poincare_pairing(self, a, b, r): if (a.homogeneous_degree() <= (r/2)) & (b.homogeneous_degree() == (r - a.homogeneous_degree())): el = a*b return el.degree() - + @abstractmethod + def lefschetz_element(self): + pass + + def lefschetz_element(self, el, a, r): + if a.homogeneous_degree() < r/2: + return a*el + + def hodge_riemann_relations(self, el, a, r): + if a.homogeneous_degree() <= r/2: + element = a*(el**(r-(2*a.homogeneous_degree())))*a + return element.degree() + + From ea541dc50c44978f9ff2c4b294f5d28dabba6431 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Tue, 10 Dec 2024 12:31:29 +0530 Subject: [PATCH 04/42] Modified super_categories() method --- src/sage/categories/kahler_algebras.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index b42f55e52ae..20d61965107 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -8,24 +8,26 @@ from sage.categories.category_types import Category_over_base_ring from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis -from abc import abstractmethod +from sage.misc.abstract_method import abstract_method class KahlerAlgebras(Category_over_base_ring): class ParentMethods: def super_categories(self): - return GradedAlgebrasWithBasis + return [GradedAlgebrasWithBasis(self.base_ring())] + def poincare_pairing(self, a, b, r): if (a.homogeneous_degree() <= (r/2)) & (b.homogeneous_degree() == (r - a.homogeneous_degree())): el = a*b return el.degree() - @abstractmethod - def lefschetz_element(self): + + @abstract_method + def lefschetz_element(): pass - def lefschetz_element(self, el, a, r): + def lefschetz_element_injection(self, el, a, r): if a.homogeneous_degree() < r/2: return a*el - + def hodge_riemann_relations(self, el, a, r): if a.homogeneous_degree() <= r/2: element = a*(el**(r-(2*a.homogeneous_degree())))*a From 42cf2db5a69343e779ec3342a9100c0e3e3d4bd6 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 12 Dec 2024 10:11:48 +0530 Subject: [PATCH 05/42] Changed chow_ring() category and modified poincare_pairing() method --- src/sage/categories/kahler_algebras.py | 52 ++++++++++++++++++-------- src/sage/matroids/chow_ring.py | 4 +- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 20d61965107..a7bd1a5a3a4 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -9,29 +9,51 @@ from sage.categories.category_types import Category_over_base_ring from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis from sage.misc.abstract_method import abstract_method +from sage.quadratic_forms.quadratic_form import QuadraticForm class KahlerAlgebras(Category_over_base_ring): - class ParentMethods: - def super_categories(self): + r""" + The category of graded algebras satisfying the Kähler package. + + EXAMPLES:: + + sage: C = KahlerAlgebras(QQ); C + Category of kahler algebras over Rational Field + sage: sorted(C.super_categories(), key=str) + [Category of graded algebras with basis over Rational Field] + + TESTS:: + + sage: C = KahlerAlgebras(QQ) + sage: TestSuite(C).run() + """ + def super_categories(self): return [GradedAlgebrasWithBasis(self.base_ring())] - def poincare_pairing(self, a, b, r): - if (a.homogeneous_degree() <= (r/2)) & (b.homogeneous_degree() == (r - a.homogeneous_degree())): - el = a*b - return el.degree() + class ParentMethods: + def poincare_pairing(self, el1, el2, r): + hom_components1 = el1.lift().homogeneous_components() + hom_components2 = el2.lift().homogeneous_components() + new_el = self.base_ring().zero() + for i in hom_components1: + for j in hom_components2: + if i == r - j: + new_el += hom_components1[i] * hom_components2[j] + # the 'else' case is new_el += self.base_ring().zero() + return new_el.degree() @abstract_method def lefschetz_element(): pass - - def lefschetz_element_injection(self, el, a, r): - if a.homogeneous_degree() < r/2: - return a*el - - def hodge_riemann_relations(self, el, a, r): - if a.homogeneous_degree() <= r/2: - element = a*(el**(r-(2*a.homogeneous_degree())))*a - return element.degree() + + def hodge_riemann_relations(self, k, lefschetz_el, r): + basis_k = self.basis(d=k) + coeff = [] + for el, i in enumerate(basis_k): + for j in range(i+1, len(basis_k)): + coeff.append((el*(lefschetz_el**(r-(2*k))*basis_k[j])).degree()) + return QuadraticForm(self.base_ring(), len(basis_k), coeff) + diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index 173c8db7f84..a5916991bf2 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -8,7 +8,7 @@ from sage.matroids.chow_ring_ideal import ChowRingIdeal_nonaug, AugmentedChowRingIdeal_fy, AugmentedChowRingIdeal_atom_free from sage.rings.quotient_ring import QuotientRing_generic -from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis +from sage.categories.kahler_algebras import KahlerAlgebras from sage.categories.commutative_rings import CommutativeRings class ChowRing(QuotientRing_generic): @@ -95,7 +95,7 @@ def __init__(self, R, M, augmented, presentation=None): self._ideal = AugmentedChowRingIdeal_atom_free(M, R) else: self._ideal = ChowRingIdeal_nonaug(M, R) - C = CommutativeRings().Quotients() & GradedAlgebrasWithBasis(R).FiniteDimensional() + C = CommutativeRings().Quotients() & KahlerAlgebras(R).FiniteDimensional() QuotientRing_generic.__init__(self, R=self._ideal.ring(), I=self._ideal, names=self._ideal.ring().variable_names(), From ebc32bab6ee812731820d62bf363e4e124e6089e Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 12 Dec 2024 10:17:15 +0530 Subject: [PATCH 06/42] Formatted kahler_algebras.py document --- src/sage/categories/kahler_algebras.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index a7bd1a5a3a4..640693e0fd6 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -52,13 +52,4 @@ def hodge_riemann_relations(self, k, lefschetz_el, r): for el, i in enumerate(basis_k): for j in range(i+1, len(basis_k)): coeff.append((el*(lefschetz_el**(r-(2*k))*basis_k[j])).degree()) - return QuadraticForm(self.base_ring(), len(basis_k), coeff) - - - - - - - - - \ No newline at end of file + return QuadraticForm(self.base_ring(), len(basis_k), coeff) \ No newline at end of file From 27445df3b9a11da2a1c8078dd465455d80aa0235 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 12:51:53 +0530 Subject: [PATCH 07/42] Added doctests to methods in KahlerAlgebras category --- src/sage/categories/kahler_algebras.py | 90 +++++++++++++++++++++++--- 1 file changed, 82 insertions(+), 8 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 640693e0fd6..0ec85c4fbdb 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -1,5 +1,5 @@ r""" -Category of Kahler Algebras. +Category of Kähler Algebras. AUTHORS: @@ -17,6 +17,8 @@ class KahlerAlgebras(Category_over_base_ring): EXAMPLES:: + sage: from sage.categories.kahler_algebras import KahlerAlgebras + sage: C = KahlerAlgebras(QQ); C Category of kahler algebras over Rational Field sage: sorted(C.super_categories(), key=str) @@ -32,6 +34,21 @@ def super_categories(self): class ParentMethods: def poincare_pairing(self, el1, el2, r): + r""" + Return the Poincaré pairing of any two elements of the + Kähler algebra. + + EXAMPLES:: + + sage: ch = matroids.Wheel(3).chow_ring(QQ, True, 'atom-free') + sage: A0, A1, A2, A3, A4, A5, A013, A025, A04, A124, A15, A23, A345, A012345 = ch.gens() + sage: u = ch(-1/6*A2*A012345 + 41/48*A012345^2); u + -1/6*A2*A012345 + 41/48*A012345^2 + sage: v = ch(-A345^2 - 1/4*A345); v + -A345^2 - 1/4*A345 + sage: ch.poincare_pairing(v, u, ch.matroid().rank()) + 3 + """ hom_components1 = el1.lift().homogeneous_components() hom_components2 = el2.lift().homogeneous_components() new_el = self.base_ring().zero() @@ -46,10 +63,67 @@ def poincare_pairing(self, el1, el2, r): def lefschetz_element(): pass - def hodge_riemann_relations(self, k, lefschetz_el, r): - basis_k = self.basis(d=k) - coeff = [] - for el, i in enumerate(basis_k): - for j in range(i+1, len(basis_k)): - coeff.append((el*(lefschetz_el**(r-(2*k))*basis_k[j])).degree()) - return QuadraticForm(self.base_ring(), len(basis_k), coeff) \ No newline at end of file + def hodge_riemann_relations(self, k, r): + r""" + Return the quadratic form for the corresponding k (< r/2) for the + Kähler algebra. + + EXAMPLES:: + + sage: ch = matroids.Uniform(4,6).chow_ring(QQ, False) + sage: ch.hodge_riemann_relations(1, ch.matroid().rank() - 1) + Quadratic form in 36 variables over Rational Field with coefficients: + [ 3 -1 -1 3 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 3 ] + [ * 3 -1 3 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 3 ] + [ * * 3 3 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 3 ] + [ * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * 3 -1 3 -1 3 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 3 ] + [ * * * * * 3 3 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 3 ] + [ * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * 3 3 3 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 ] + [ * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * 3 -1 3 -1 -1 3 -1 -1 3 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 ] + [ * * * * * * * * * * * 3 3 -1 3 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 ] + [ * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * 3 3 3 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 3 ] + [ * * * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * 3 3 3 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 3 ] + [ * * * * * * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * * * 3 -1 3 -1 3 -1 -1 -1 -1 3 -1 -1 -1 3 -1 3 ] + [ * * * * * * * * * * * * * * * * * * * * * 3 3 -1 -1 3 -1 -1 3 -1 -1 -1 3 -1 -1 3 ] + [ * * * * * * * * * * * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * * * * * * 3 3 3 -1 3 -1 -1 -1 3 -1 -1 -1 3 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * * * 3 3 3 3 -1 -1 -1 -1 3 3 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 -1 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 3 3 3 3 3 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 -1 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 ] + [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 ] + sage: ch.hodge_riemann_relations(3, ch.matroid().rank() - 1) + Traceback (most recent call last): + ... + ValueError: k must be less than r < 2 + """ + if k < (r/2): + basis_k = [] + lefschetz_el = self.lefschetz_element() + for b in self.basis(): + if b.homogeneous_degree() == k: + basis_k.append(b) + coeff = [] + for i,el in enumerate(basis_k): + for j in range(i, len(basis_k)): + coeff.append((el*(lefschetz_el**(r-(2*k))*basis_k[j])).degree()) + return QuadraticForm(self.base_ring(), len(basis_k), coeff) + else: + raise ValueError("k must be less than r < 2") \ No newline at end of file From 66b26498ef3a1e41afa484d247bd15180904c1b5 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 12:54:52 +0530 Subject: [PATCH 08/42] Added and formatted lefschetz_element() for ChowRing class --- src/sage/matroids/chow_ring.py | 143 +++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index a5916991bf2..9dac3f1ef66 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -196,6 +196,149 @@ def basis(self): monomial_basis = self._ideal.normal_basis() return Family([self.element_class(self, mon, reduce=False) for mon in monomial_basis]) + def flats_generator(self): + r""" + Return the corresponding generators of flats of the Chow ring. + + EXAMPLES:: + + sage: ch = matroids.catalog.NonFano().chow_ring(ZZ, True, 'atom-free') + sage: ch.flats_generator() + {frozenset({'a'}): Aa, + frozenset({'b'}): Ab, + frozenset({'c'}): Ac, + frozenset({'d'}): Ad, + frozenset({'e'}): Ae, + frozenset({'f'}): Af, + frozenset({'g'}): Ag, + frozenset({'a', 'b', 'f'}): Aabf, + frozenset({'a', 'c', 'e'}): Aace, + frozenset({'a', 'd', 'g'}): Aadg, + frozenset({'b', 'c', 'd'}): Abcd, + frozenset({'b', 'e', 'g'}): Abeg, + frozenset({'c', 'f', 'g'}): Acfg, + frozenset({'d', 'e'}): Ade, + frozenset({'d', 'f'}): Adf, + frozenset({'e', 'f'}): Aef, + frozenset({'a', 'b', 'c', 'd', 'e', 'f', 'g'}): Aabcdefg} + """ + flats = [X for i in range(1, self._matroid.rank() + 1) + for X in self._matroid.flats(i)] + gens = self.gens() + if self._augmented & (self._presentation == 'fy'): + flats_gen = {} + E = list(self.matroid().groundset()) + for i,F in enumerate(flats): + flats_gen[F] = gens[len(E) + i] + return flats_gen + else: + return dict(zip(flats, gens)) + + def lefschetz_element(self): + r""" + Return one Lefschetz element of the given Chow ring. + + EXAMPLES:: + + sage: ch = matroids.catalog.P8pp().chow_ring(QQ, False) + sage: ch.lefschetz_element() + -2*Aab - 2*Aac - 2*Aad - 2*Aae - 2*Aaf - 2*Aag - 2*Aah - 2*Abc + - 2*Abd - 2*Abe - 2*Abf - 2*Abg - 2*Abh - 2*Acd - 2*Ace - 2*Acf + - 2*Acg - 2*Ach - 2*Ade - 2*Adf - 2*Adg - 2*Adh - 2*Aef - 2*Aeg + - 2*Aeh - 2*Afg - 2*Afh - 2*Agh - 6*Aabc - 6*Aabd - 6*Aabe + - 12*Aabfh - 6*Aabg - 6*Aacd - 12*Aacef - 12*Aacgh - 12*Aadeg + - 6*Aadf - 6*Aadh - 6*Aaeh - 6*Aafg - 6*Abcd - 12*Abceg + - 6*Abcf - 6*Abch - 12*Abdeh - 12*Abdfg - 6*Abef - 6*Abgh + - 6*Acde - 12*Acdfh - 6*Acdg - 6*Aceh - 6*Acfg - 6*Adef + - 6*Adgh - 6*Aefg - 6*Aefh - 6*Aegh - 6*Afgh - 56*Aabcdefgh + + The following example finds the Lefschetz element of the Chow ring + of the uniform matroid of rank 4 on 5 elements (non-augmented). + It is then multiplied with the elements of FY-monomial bases of + different degrees:: + + sage: ch = matroids.Uniform(4,5).chow_ring(QQ, False) + sage: basis_deg = {} + sage: for b in ch.basis(): + ....: deg = b.homogeneous_degree() + ....: if deg not in basis_deg: + ....: basis_deg[deg] = [] + ....: basis_deg[deg].append(b) + ....: + sage: basis_deg + {0: [1], 1: [A02, A12, A01, A012, A03, A13, A013, A23, A023, + A123, A04, A14, A014, A24, A024, A124, A34, A034, A134, A234, + A01234], 2: [A02*A01234, A12*A01234, A01*A01234, A012^2, + A03*A01234, A13*A01234, A013^2, A23*A01234, A023^2, A123^2, + A04*A01234, A14*A01234, A014^2, A24*A01234, A024^2, A124^2, + A34*A01234, A034^2, A134^2, A234^2, A01234^2], 3: [A01234^3]} + sage: g_eq_maps = {} + sage: lefschetz_el = ch.lefschetz_element(); lefschetz_el + -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A12 - 2*A13 - 2*A14 - 2*A23 + - 2*A24 - 2*A34 - 6*A012 - 6*A013 - 6*A014 - 6*A023 - 6*A024 + - 6*A034 - 6*A123 - 6*A124 - 6*A134 - 6*A234 - 20*A01234 + sage: for deg in basis_deg: + ....: if deg not in g_eq_maps: + ....: g_eq_maps[deg] = [] + ....: g_eq_maps[deg].extend([i*lefschetz_el for i in basis_deg[deg]]) + ....: + sage: g_eq_maps + {0: [-2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A12 - 2*A13 - 2*A14 + - 2*A23 - 2*A24 - 2*A34 - 6*A012 - 6*A013 - 6*A014 - 6*A023 + - 6*A024 - 6*A034 - 6*A123 - 6*A124 - 6*A134 - 6*A234 + - 20*A01234], 1: [2*A012^2 + 2*A023^2 + 2*A024^2 + - 10*A02*A01234 + 2*A01234^2, 2*A012^2 + 2*A123^2 + 2*A124^2 + - 10*A12*A01234 + 2*A01234^2, 2*A012^2 + 2*A013^2 + 2*A014^2 + - 10*A01*A01234 + 2*A01234^2, -6*A012^2 + 2*A01*A01234 + + 2*A02*A01234 + 2*A12*A01234, 2*A013^2 + 2*A023^2 + 2*A034^2 + - 10*A03*A01234 + 2*A01234^2, 2*A013^2 + 2*A123^2 + 2*A134^2 + - 10*A13*A01234 + 2*A01234^2, -6*A013^2 + 2*A01*A01234 + + 2*A03*A01234 + 2*A13*A01234, 2*A023^2 + 2*A123^2 + 2*A234^2 + - 10*A23*A01234 + 2*A01234^2, -6*A023^2 + 2*A02*A01234 + + 2*A03*A01234 + 2*A23*A01234, -6*A123^2 + 2*A12*A01234 + + 2*A13*A01234 + 2*A23*A01234, 2*A014^2 + 2*A024^2 + 2*A034^2 + - 10*A04*A01234 + 2*A01234^2, 2*A014^2 + 2*A124^2 + 2*A134^2 + - 10*A14*A01234 + 2*A01234^2, -6*A014^2 + 2*A01*A01234 + + 2*A04*A01234 + 2*A14*A01234, 2*A024^2 + 2*A124^2 + 2*A234^2 + - 10*A24*A01234 + 2*A01234^2, -6*A024^2 + 2*A02*A01234 + + 2*A04*A01234 + 2*A24*A01234, -6*A124^2 + 2*A12*A01234 + + 2*A14*A01234 + 2*A24*A01234, 2*A034^2 + 2*A134^2 + 2*A234^2 + - 10*A34*A01234 + 2*A01234^2, -6*A034^2 + 2*A03*A01234 + + 2*A04*A01234 + 2*A34*A01234, -6*A134^2 + 2*A13*A01234 + + 2*A14*A01234 + 2*A34*A01234, -6*A234^2 + 2*A23*A01234 + + 2*A24*A01234 + 2*A34*A01234, -2*A01*A01234 - 2*A02*A01234 + - 2*A03*A01234 - 2*A04*A01234 - 2*A12*A01234 - 2*A13*A01234 + - 2*A14*A01234 - 2*A23*A01234 - 2*A24*A01234 - 2*A34*A01234 + - 20*A01234^2], 2: [2*A01234^3, 2*A01234^3, 2*A01234^3, + 6*A01234^3, 2*A01234^3, 2*A01234^3, 6*A01234^3, 2*A01234^3, + 6*A01234^3, 6*A01234^3, 2*A01234^3, 2*A01234^3, 6*A01234^3, + 2*A01234^3, 6*A01234^3, 6*A01234^3, 2*A01234^3, 6*A01234^3, + 6*A01234^3, 6*A01234^3, -20*A01234^3], 3: [0]} + + TESTS:: + + sage: U46 = matroids.Uniform(4,6) + sage: C = U46.chow_ring(QQ, False) + sage: w = C.lefschetz_element(); w + -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A05 - 2*A12 - 2*A13 - 2*A14 - 2*A15 - 2*A23 - 2*A24 - 2*A25 - 2*A34 - 2*A35 - 2*A45 - 6*A012 - 6*A013 - 6*A014 - 6*A015 - 6*A023 - 6*A024 - 6*A025 - 6*A034 - 6*A035 - 6*A045 - 6*A123 - 6*A124 - 6*A125 - 6*A134 - 6*A135 - 6*A145 - 6*A234 - 6*A235 - 6*A245 - 6*A345 - 30*A012345 + sage: basis_deg = {} + sage: for b in C.basis(): + ....: deg = b.homogeneous_degree() + ....: if deg not in basis_deg: + ....: basis_deg[deg] = [] + ....: basis_deg[deg].append(b) + sage: m = max(basis_deg); m + 3 + sage: len(basis_deg[1]) == len(basis_deg[2]) + True + sage: matrix([(w*b).to_vector() for b in basis_deg[1]]).rank() + 36 + sage: len(basis_deg[2]) + 36 + """ + w = sum(len(F) * (len(self.matroid().groundset()) - len(F)) * gen for F, gen in self.flats_generator().items()) + return w + class Element(QuotientRing_generic.Element): def to_vector(self, order=None): r""" From 38ebe742175828b55a975d98f25ab20437d85d23 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 12:59:00 +0530 Subject: [PATCH 09/42] Formatted kahler_algebras.py --- src/sage/categories/kahler_algebras.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 0ec85c4fbdb..543a1a9c1b2 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -30,7 +30,7 @@ class KahlerAlgebras(Category_over_base_ring): sage: TestSuite(C).run() """ def super_categories(self): - return [GradedAlgebrasWithBasis(self.base_ring())] + return [GradedAlgebrasWithBasis(self.base_ring())] class ParentMethods: def poincare_pairing(self, el1, el2, r): @@ -69,10 +69,10 @@ def hodge_riemann_relations(self, k, r): Kähler algebra. EXAMPLES:: - + sage: ch = matroids.Uniform(4,6).chow_ring(QQ, False) sage: ch.hodge_riemann_relations(1, ch.matroid().rank() - 1) - Quadratic form in 36 variables over Rational Field with coefficients: + Quadratic form in 36 variables over Rational Field with coefficients: [ 3 -1 -1 3 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 3 ] [ * 3 -1 3 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 3 ] [ * * 3 3 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 3 ] @@ -123,7 +123,7 @@ def hodge_riemann_relations(self, k, r): coeff = [] for i,el in enumerate(basis_k): for j in range(i, len(basis_k)): - coeff.append((el*(lefschetz_el**(r-(2*k))*basis_k[j])).degree()) + coeff.append((el * (lefschetz_el ** (r-(2*k)) * basis_k[j])).degree()) return QuadraticForm(self.base_ring(), len(basis_k), coeff) else: raise ValueError("k must be less than r < 2") \ No newline at end of file From d36957b7d7a9aac82cf7b5ad8d57f6148ff53576 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 13:16:42 +0530 Subject: [PATCH 10/42] Formatted kahler_algebras.py --- src/sage/categories/kahler_algebras.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 543a1a9c1b2..2bbbc0919f4 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -11,6 +11,7 @@ from sage.misc.abstract_method import abstract_method from sage.quadratic_forms.quadratic_form import QuadraticForm + class KahlerAlgebras(Category_over_base_ring): r""" The category of graded algebras satisfying the Kähler package. From ce47f30050bccd79bf7848bc6f76d5ac8c44bccb Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 15:22:44 +0530 Subject: [PATCH 11/42] Modified index.rst for categories and corrected doctest --- src/doc/en/reference/categories/index.rst | 1 + src/sage/categories/kahler_algebras.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/en/reference/categories/index.rst b/src/doc/en/reference/categories/index.rst index a40cca76e0f..2f6c4ec65d9 100644 --- a/src/doc/en/reference/categories/index.rst +++ b/src/doc/en/reference/categories/index.rst @@ -137,6 +137,7 @@ Individual Categories sage/categories/integral_domains sage/categories/j_trivial_semigroups sage/categories/kac_moody_algebras + sage/categories/kahler_algebras sage/categories/lambda_bracket_algebras sage/categories/lambda_bracket_algebras_with_basis sage/categories/lattice_posets diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 2bbbc0919f4..b0927de41c3 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -111,7 +111,7 @@ def hodge_riemann_relations(self, k, r): [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 ] [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 ] sage: ch.hodge_riemann_relations(3, ch.matroid().rank() - 1) - Traceback (most recent call last): + Traceback (most recent call last): ... ValueError: k must be less than r < 2 """ From b75cffede026463e78831632fbaa5de8294dd649 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 16:33:44 +0530 Subject: [PATCH 12/42] Edited title --- src/sage/categories/kahler_algebras.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index b0927de41c3..385a6a747b2 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -1,5 +1,5 @@ r""" -Category of Kähler Algebras. +Kähler Algebras. AUTHORS: From 15c532379b5f44444a1297595e505ea441c80fd6 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 16:38:23 +0530 Subject: [PATCH 13/42] Formatted title --- src/sage/categories/kahler_algebras.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 385a6a747b2..39cf7264088 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -1,5 +1,5 @@ r""" -Kähler Algebras. +Kähler Algebras AUTHORS: From 7a1a449444001e8b331b1bf01b60188e1d2f456e Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 18:57:15 +0530 Subject: [PATCH 14/42] Added GPL license --- src/sage/categories/kahler_algebras.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 39cf7264088..d1f125b44d7 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -11,7 +11,15 @@ from sage.misc.abstract_method import abstract_method from sage.quadratic_forms.quadratic_form import QuadraticForm - +# **************************************************************************** +# Copyright (C) 2024 Shriya M <25shriya at 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/ +# **************************************************************************** class KahlerAlgebras(Category_over_base_ring): r""" The category of graded algebras satisfying the Kähler package. From 27c70edbfe648761f9415baa1c9782894061f9d6 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 19:08:03 +0530 Subject: [PATCH 15/42] Implemented poincare_pairing() in Chow rings and made it abstact in the category --- src/sage/categories/kahler_algebras.py | 28 +-- src/sage/matroids/chow_ring.py | 258 ++++++++++++++----------- 2 files changed, 145 insertions(+), 141 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index d1f125b44d7..546725ffcba 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -42,31 +42,9 @@ def super_categories(self): return [GradedAlgebrasWithBasis(self.base_ring())] class ParentMethods: - def poincare_pairing(self, el1, el2, r): - r""" - Return the Poincaré pairing of any two elements of the - Kähler algebra. - - EXAMPLES:: - - sage: ch = matroids.Wheel(3).chow_ring(QQ, True, 'atom-free') - sage: A0, A1, A2, A3, A4, A5, A013, A025, A04, A124, A15, A23, A345, A012345 = ch.gens() - sage: u = ch(-1/6*A2*A012345 + 41/48*A012345^2); u - -1/6*A2*A012345 + 41/48*A012345^2 - sage: v = ch(-A345^2 - 1/4*A345); v - -A345^2 - 1/4*A345 - sage: ch.poincare_pairing(v, u, ch.matroid().rank()) - 3 - """ - hom_components1 = el1.lift().homogeneous_components() - hom_components2 = el2.lift().homogeneous_components() - new_el = self.base_ring().zero() - for i in hom_components1: - for j in hom_components2: - if i == r - j: - new_el += hom_components1[i] * hom_components2[j] - # the 'else' case is new_el += self.base_ring().zero() - return new_el.degree() + @abstract_method + def poincare_pairing(): + pass @abstract_method def lefschetz_element(): diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index 45d91a6a4f2..cf1a3c26840 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -199,29 +199,29 @@ def basis(self): def flats_generator(self): r""" - Return the corresponding generators of flats of the Chow ring. + Return the corresponding generators of flats of the Chow ring. - EXAMPLES:: + EXAMPLES:: - sage: ch = matroids.catalog.NonFano().chow_ring(ZZ, True, 'atom-free') - sage: ch.flats_generator() - {frozenset({'a'}): Aa, - frozenset({'b'}): Ab, - frozenset({'c'}): Ac, - frozenset({'d'}): Ad, - frozenset({'e'}): Ae, - frozenset({'f'}): Af, - frozenset({'g'}): Ag, - frozenset({'a', 'b', 'f'}): Aabf, - frozenset({'a', 'c', 'e'}): Aace, - frozenset({'a', 'd', 'g'}): Aadg, - frozenset({'b', 'c', 'd'}): Abcd, - frozenset({'b', 'e', 'g'}): Abeg, - frozenset({'c', 'f', 'g'}): Acfg, - frozenset({'d', 'e'}): Ade, - frozenset({'d', 'f'}): Adf, - frozenset({'e', 'f'}): Aef, - frozenset({'a', 'b', 'c', 'd', 'e', 'f', 'g'}): Aabcdefg} + sage: ch = matroids.catalog.NonFano().chow_ring(ZZ, True, 'atom-free') + sage: ch.flats_generator() + {frozenset({'a'}): Aa, + frozenset({'b'}): Ab, + frozenset({'c'}): Ac, + frozenset({'d'}): Ad, + frozenset({'e'}): Ae, + frozenset({'f'}): Af, + frozenset({'g'}): Ag, + frozenset({'a', 'b', 'f'}): Aabf, + frozenset({'a', 'c', 'e'}): Aace, + frozenset({'a', 'd', 'g'}): Aadg, + frozenset({'b', 'c', 'd'}): Abcd, + frozenset({'b', 'e', 'g'}): Abeg, + frozenset({'c', 'f', 'g'}): Acfg, + frozenset({'d', 'e'}): Ade, + frozenset({'d', 'f'}): Adf, + frozenset({'e', 'f'}): Aef, + frozenset({'a', 'b', 'c', 'd', 'e', 'f', 'g'}): Aabcdefg} """ flats = [X for i in range(1, self._matroid.rank() + 1) for X in self._matroid.flats(i)] @@ -237,109 +237,135 @@ def flats_generator(self): def lefschetz_element(self): r""" - Return one Lefschetz element of the given Chow ring. + Return one Lefschetz element of the given Chow ring. - EXAMPLES:: + EXAMPLES:: - sage: ch = matroids.catalog.P8pp().chow_ring(QQ, False) - sage: ch.lefschetz_element() - -2*Aab - 2*Aac - 2*Aad - 2*Aae - 2*Aaf - 2*Aag - 2*Aah - 2*Abc - - 2*Abd - 2*Abe - 2*Abf - 2*Abg - 2*Abh - 2*Acd - 2*Ace - 2*Acf - - 2*Acg - 2*Ach - 2*Ade - 2*Adf - 2*Adg - 2*Adh - 2*Aef - 2*Aeg - - 2*Aeh - 2*Afg - 2*Afh - 2*Agh - 6*Aabc - 6*Aabd - 6*Aabe - - 12*Aabfh - 6*Aabg - 6*Aacd - 12*Aacef - 12*Aacgh - 12*Aadeg - - 6*Aadf - 6*Aadh - 6*Aaeh - 6*Aafg - 6*Abcd - 12*Abceg - - 6*Abcf - 6*Abch - 12*Abdeh - 12*Abdfg - 6*Abef - 6*Abgh - - 6*Acde - 12*Acdfh - 6*Acdg - 6*Aceh - 6*Acfg - 6*Adef - - 6*Adgh - 6*Aefg - 6*Aefh - 6*Aegh - 6*Afgh - 56*Aabcdefgh - - The following example finds the Lefschetz element of the Chow ring - of the uniform matroid of rank 4 on 5 elements (non-augmented). - It is then multiplied with the elements of FY-monomial bases of - different degrees:: - - sage: ch = matroids.Uniform(4,5).chow_ring(QQ, False) - sage: basis_deg = {} - sage: for b in ch.basis(): - ....: deg = b.homogeneous_degree() - ....: if deg not in basis_deg: - ....: basis_deg[deg] = [] - ....: basis_deg[deg].append(b) - ....: - sage: basis_deg - {0: [1], 1: [A02, A12, A01, A012, A03, A13, A013, A23, A023, - A123, A04, A14, A014, A24, A024, A124, A34, A034, A134, A234, - A01234], 2: [A02*A01234, A12*A01234, A01*A01234, A012^2, - A03*A01234, A13*A01234, A013^2, A23*A01234, A023^2, A123^2, - A04*A01234, A14*A01234, A014^2, A24*A01234, A024^2, A124^2, - A34*A01234, A034^2, A134^2, A234^2, A01234^2], 3: [A01234^3]} - sage: g_eq_maps = {} - sage: lefschetz_el = ch.lefschetz_element(); lefschetz_el - -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A12 - 2*A13 - 2*A14 - 2*A23 - - 2*A24 - 2*A34 - 6*A012 - 6*A013 - 6*A014 - 6*A023 - 6*A024 - - 6*A034 - 6*A123 - 6*A124 - 6*A134 - 6*A234 - 20*A01234 - sage: for deg in basis_deg: - ....: if deg not in g_eq_maps: - ....: g_eq_maps[deg] = [] - ....: g_eq_maps[deg].extend([i*lefschetz_el for i in basis_deg[deg]]) - ....: - sage: g_eq_maps - {0: [-2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A12 - 2*A13 - 2*A14 - - 2*A23 - 2*A24 - 2*A34 - 6*A012 - 6*A013 - 6*A014 - 6*A023 - - 6*A024 - 6*A034 - 6*A123 - 6*A124 - 6*A134 - 6*A234 - - 20*A01234], 1: [2*A012^2 + 2*A023^2 + 2*A024^2 - - 10*A02*A01234 + 2*A01234^2, 2*A012^2 + 2*A123^2 + 2*A124^2 - - 10*A12*A01234 + 2*A01234^2, 2*A012^2 + 2*A013^2 + 2*A014^2 - - 10*A01*A01234 + 2*A01234^2, -6*A012^2 + 2*A01*A01234 - + 2*A02*A01234 + 2*A12*A01234, 2*A013^2 + 2*A023^2 + 2*A034^2 - - 10*A03*A01234 + 2*A01234^2, 2*A013^2 + 2*A123^2 + 2*A134^2 - - 10*A13*A01234 + 2*A01234^2, -6*A013^2 + 2*A01*A01234 - + 2*A03*A01234 + 2*A13*A01234, 2*A023^2 + 2*A123^2 + 2*A234^2 - - 10*A23*A01234 + 2*A01234^2, -6*A023^2 + 2*A02*A01234 - + 2*A03*A01234 + 2*A23*A01234, -6*A123^2 + 2*A12*A01234 - + 2*A13*A01234 + 2*A23*A01234, 2*A014^2 + 2*A024^2 + 2*A034^2 - - 10*A04*A01234 + 2*A01234^2, 2*A014^2 + 2*A124^2 + 2*A134^2 - - 10*A14*A01234 + 2*A01234^2, -6*A014^2 + 2*A01*A01234 - + 2*A04*A01234 + 2*A14*A01234, 2*A024^2 + 2*A124^2 + 2*A234^2 - - 10*A24*A01234 + 2*A01234^2, -6*A024^2 + 2*A02*A01234 - + 2*A04*A01234 + 2*A24*A01234, -6*A124^2 + 2*A12*A01234 - + 2*A14*A01234 + 2*A24*A01234, 2*A034^2 + 2*A134^2 + 2*A234^2 - - 10*A34*A01234 + 2*A01234^2, -6*A034^2 + 2*A03*A01234 - + 2*A04*A01234 + 2*A34*A01234, -6*A134^2 + 2*A13*A01234 - + 2*A14*A01234 + 2*A34*A01234, -6*A234^2 + 2*A23*A01234 - + 2*A24*A01234 + 2*A34*A01234, -2*A01*A01234 - 2*A02*A01234 - - 2*A03*A01234 - 2*A04*A01234 - 2*A12*A01234 - 2*A13*A01234 - - 2*A14*A01234 - 2*A23*A01234 - 2*A24*A01234 - 2*A34*A01234 - - 20*A01234^2], 2: [2*A01234^3, 2*A01234^3, 2*A01234^3, - 6*A01234^3, 2*A01234^3, 2*A01234^3, 6*A01234^3, 2*A01234^3, - 6*A01234^3, 6*A01234^3, 2*A01234^3, 2*A01234^3, 6*A01234^3, - 2*A01234^3, 6*A01234^3, 6*A01234^3, 2*A01234^3, 6*A01234^3, - 6*A01234^3, 6*A01234^3, -20*A01234^3], 3: [0]} + sage: ch = matroids.catalog.P8pp().chow_ring(QQ, False) + sage: ch.lefschetz_element() + -2*Aab - 2*Aac - 2*Aad - 2*Aae - 2*Aaf - 2*Aag - 2*Aah - 2*Abc + - 2*Abd - 2*Abe - 2*Abf - 2*Abg - 2*Abh - 2*Acd - 2*Ace - 2*Acf + - 2*Acg - 2*Ach - 2*Ade - 2*Adf - 2*Adg - 2*Adh - 2*Aef - 2*Aeg + - 2*Aeh - 2*Afg - 2*Afh - 2*Agh - 6*Aabc - 6*Aabd - 6*Aabe + - 12*Aabfh - 6*Aabg - 6*Aacd - 12*Aacef - 12*Aacgh - 12*Aadeg + - 6*Aadf - 6*Aadh - 6*Aaeh - 6*Aafg - 6*Abcd - 12*Abceg + - 6*Abcf - 6*Abch - 12*Abdeh - 12*Abdfg - 6*Abef - 6*Abgh + - 6*Acde - 12*Acdfh - 6*Acdg - 6*Aceh - 6*Acfg - 6*Adef + - 6*Adgh - 6*Aefg - 6*Aefh - 6*Aegh - 6*Afgh - 56*Aabcdefgh + + The following example finds the Lefschetz element of the Chow ring + of the uniform matroid of rank 4 on 5 elements (non-augmented). + It is then multiplied with the elements of FY-monomial bases of + different degrees:: + + sage: ch = matroids.Uniform(4,5).chow_ring(QQ, False) + sage: basis_deg = {} + sage: for b in ch.basis(): + ....: deg = b.homogeneous_degree() + ....: if deg not in basis_deg: + ....: basis_deg[deg] = [] + ....: basis_deg[deg].append(b) + ....: + sage: basis_deg + {0: [1], 1: [A02, A12, A01, A012, A03, A13, A013, A23, A023, + A123, A04, A14, A014, A24, A024, A124, A34, A034, A134, A234, + A01234], 2: [A02*A01234, A12*A01234, A01*A01234, A012^2, + A03*A01234, A13*A01234, A013^2, A23*A01234, A023^2, A123^2, + A04*A01234, A14*A01234, A014^2, A24*A01234, A024^2, A124^2, + A34*A01234, A034^2, A134^2, A234^2, A01234^2], 3: [A01234^3]} + sage: g_eq_maps = {} + sage: lefschetz_el = ch.lefschetz_element(); lefschetz_el + -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A12 - 2*A13 - 2*A14 - 2*A23 + - 2*A24 - 2*A34 - 6*A012 - 6*A013 - 6*A014 - 6*A023 - 6*A024 + - 6*A034 - 6*A123 - 6*A124 - 6*A134 - 6*A234 - 20*A01234 + sage: for deg in basis_deg: + ....: if deg not in g_eq_maps: + ....: g_eq_maps[deg] = [] + ....: g_eq_maps[deg].extend([i*lefschetz_el for i in basis_deg[deg]]) + ....: + sage: g_eq_maps + {0: [-2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A12 - 2*A13 - 2*A14 + - 2*A23 - 2*A24 - 2*A34 - 6*A012 - 6*A013 - 6*A014 - 6*A023 + - 6*A024 - 6*A034 - 6*A123 - 6*A124 - 6*A134 - 6*A234 + - 20*A01234], 1: [2*A012^2 + 2*A023^2 + 2*A024^2 + - 10*A02*A01234 + 2*A01234^2, 2*A012^2 + 2*A123^2 + 2*A124^2 + - 10*A12*A01234 + 2*A01234^2, 2*A012^2 + 2*A013^2 + 2*A014^2 + - 10*A01*A01234 + 2*A01234^2, -6*A012^2 + 2*A01*A01234 + + 2*A02*A01234 + 2*A12*A01234, 2*A013^2 + 2*A023^2 + 2*A034^2 + - 10*A03*A01234 + 2*A01234^2, 2*A013^2 + 2*A123^2 + 2*A134^2 + - 10*A13*A01234 + 2*A01234^2, -6*A013^2 + 2*A01*A01234 + + 2*A03*A01234 + 2*A13*A01234, 2*A023^2 + 2*A123^2 + 2*A234^2 + - 10*A23*A01234 + 2*A01234^2, -6*A023^2 + 2*A02*A01234 + + 2*A03*A01234 + 2*A23*A01234, -6*A123^2 + 2*A12*A01234 + + 2*A13*A01234 + 2*A23*A01234, 2*A014^2 + 2*A024^2 + 2*A034^2 + - 10*A04*A01234 + 2*A01234^2, 2*A014^2 + 2*A124^2 + 2*A134^2 + - 10*A14*A01234 + 2*A01234^2, -6*A014^2 + 2*A01*A01234 + + 2*A04*A01234 + 2*A14*A01234, 2*A024^2 + 2*A124^2 + 2*A234^2 + - 10*A24*A01234 + 2*A01234^2, -6*A024^2 + 2*A02*A01234 + + 2*A04*A01234 + 2*A24*A01234, -6*A124^2 + 2*A12*A01234 + + 2*A14*A01234 + 2*A24*A01234, 2*A034^2 + 2*A134^2 + 2*A234^2 + - 10*A34*A01234 + 2*A01234^2, -6*A034^2 + 2*A03*A01234 + + 2*A04*A01234 + 2*A34*A01234, -6*A134^2 + 2*A13*A01234 + + 2*A14*A01234 + 2*A34*A01234, -6*A234^2 + 2*A23*A01234 + + 2*A24*A01234 + 2*A34*A01234, -2*A01*A01234 - 2*A02*A01234 + - 2*A03*A01234 - 2*A04*A01234 - 2*A12*A01234 - 2*A13*A01234 + - 2*A14*A01234 - 2*A23*A01234 - 2*A24*A01234 - 2*A34*A01234 + - 20*A01234^2], 2: [2*A01234^3, 2*A01234^3, 2*A01234^3, + 6*A01234^3, 2*A01234^3, 2*A01234^3, 6*A01234^3, 2*A01234^3, + 6*A01234^3, 6*A01234^3, 2*A01234^3, 2*A01234^3, 6*A01234^3, + 2*A01234^3, 6*A01234^3, 6*A01234^3, 2*A01234^3, 6*A01234^3, + 6*A01234^3, 6*A01234^3, -20*A01234^3], 3: [0]} - TESTS:: + TESTS:: - sage: U46 = matroids.Uniform(4,6) - sage: C = U46.chow_ring(QQ, False) - sage: w = C.lefschetz_element(); w - -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A05 - 2*A12 - 2*A13 - 2*A14 - 2*A15 - 2*A23 - 2*A24 - 2*A25 - 2*A34 - 2*A35 - 2*A45 - 6*A012 - 6*A013 - 6*A014 - 6*A015 - 6*A023 - 6*A024 - 6*A025 - 6*A034 - 6*A035 - 6*A045 - 6*A123 - 6*A124 - 6*A125 - 6*A134 - 6*A135 - 6*A145 - 6*A234 - 6*A235 - 6*A245 - 6*A345 - 30*A012345 - sage: basis_deg = {} - sage: for b in C.basis(): - ....: deg = b.homogeneous_degree() - ....: if deg not in basis_deg: - ....: basis_deg[deg] = [] - ....: basis_deg[deg].append(b) - sage: m = max(basis_deg); m - 3 - sage: len(basis_deg[1]) == len(basis_deg[2]) - True - sage: matrix([(w*b).to_vector() for b in basis_deg[1]]).rank() - 36 - sage: len(basis_deg[2]) - 36 + sage: U46 = matroids.Uniform(4,6) + sage: C = U46.chow_ring(QQ, False) + sage: w = C.lefschetz_element(); w + -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A05 - 2*A12 - 2*A13 - 2*A14 - 2*A15 - 2*A23 - 2*A24 - 2*A25 - 2*A34 - 2*A35 - 2*A45 - 6*A012 - 6*A013 - 6*A014 - 6*A015 - 6*A023 - 6*A024 - 6*A025 - 6*A034 - 6*A035 - 6*A045 - 6*A123 - 6*A124 - 6*A125 - 6*A134 - 6*A135 - 6*A145 - 6*A234 - 6*A235 - 6*A245 - 6*A345 - 30*A012345 + sage: basis_deg = {} + sage: for b in C.basis(): + ....: deg = b.homogeneous_degree() + ....: if deg not in basis_deg: + ....: basis_deg[deg] = [] + ....: basis_deg[deg].append(b) + sage: m = max(basis_deg); m + 3 + sage: len(basis_deg[1]) == len(basis_deg[2]) + True + sage: matrix([(w*b).to_vector() for b in basis_deg[1]]).rank() + 36 + sage: len(basis_deg[2]) + 36 """ w = sum(len(F) * (len(self.matroid().groundset()) - len(F)) * gen for F, gen in self.flats_generator().items()) return w + def poincare_pairing(self, el1, el2, r): + r""" + Return the Poincaré pairing of any two elements of the + Kähler algebra. + + EXAMPLES:: + + sage: ch = matroids.Wheel(3).chow_ring(QQ, True, 'atom-free') + sage: A0, A1, A2, A3, A4, A5, A013, A025, A04, A124, A15, A23, A345, A012345 = ch.gens() + sage: u = ch(-1/6*A2*A012345 + 41/48*A012345^2); u + -1/6*A2*A012345 + 41/48*A012345^2 + sage: v = ch(-A345^2 - 1/4*A345); v + -A345^2 - 1/4*A345 + sage: ch.poincare_pairing(v, u, ch.matroid().rank()) + 3 + """ + hom_components1 = el1.lift().homogeneous_components() + hom_components2 = el2.lift().homogeneous_components() + new_el = self.base_ring().zero() + for i in hom_components1: + for j in hom_components2: + if i == r - j: + new_el += hom_components1[i] * hom_components2[j] + # the 'else' case is new_el += self.base_ring().zero() + return new_el.degree() + class Element(QuotientRing_generic.Element): def to_vector(self, order=None): r""" From c2720cb643261ea528e20968a84053c1acd2aaa8 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 19:12:25 +0530 Subject: [PATCH 16/42] Modified poincare_pairing() method --- src/sage/matroids/chow_ring.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index cf1a3c26840..57e701252b5 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -343,7 +343,7 @@ def lefschetz_element(self): def poincare_pairing(self, el1, el2, r): r""" Return the Poincaré pairing of any two elements of the - Kähler algebra. + Chow ring. EXAMPLES:: @@ -361,9 +361,9 @@ def poincare_pairing(self, el1, el2, r): new_el = self.base_ring().zero() for i in hom_components1: for j in hom_components2: - if i == r - j: - new_el += hom_components1[i] * hom_components2[j] - # the 'else' case is new_el += self.base_ring().zero() + if r - i not in hom_components2: + continue + new_el += hom_components1[i] * hom_components2[j] return new_el.degree() class Element(QuotientRing_generic.Element): From 9423bd82ff7553a17838d98cc01566544d413028 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 19:21:08 +0530 Subject: [PATCH 17/42] Modified flats_generator for ChowRing --- src/sage/matroids/chow_ring.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index 57e701252b5..2042e53dbba 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -226,14 +226,13 @@ def flats_generator(self): flats = [X for i in range(1, self._matroid.rank() + 1) for X in self._matroid.flats(i)] gens = self.gens() - if self._augmented & (self._presentation == 'fy'): - flats_gen = {} - E = list(self.matroid().groundset()) - for i,F in enumerate(flats): - flats_gen[F] = gens[len(E) + i] - return flats_gen - else: + if not (self._augmented and self._presentation == 'fy'): return dict(zip(flats, gens)) + flats_gen = {} + E = list(self.matroid().groundset()) + for i,F in enumerate(flats): + flats_gen[F] = gens[len(E) + i] + return flats_gen def lefschetz_element(self): r""" From 85bc761fb9943569a5414acc5b5e90b9f7dc7e9d Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 19:22:48 +0530 Subject: [PATCH 18/42] Modified hodge_riemann_relations() --- src/sage/categories/kahler_algebras.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 546725ffcba..293775841d5 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -101,16 +101,15 @@ def hodge_riemann_relations(self, k, r): ... ValueError: k must be less than r < 2 """ - if k < (r/2): - basis_k = [] - lefschetz_el = self.lefschetz_element() - for b in self.basis(): - if b.homogeneous_degree() == k: - basis_k.append(b) - coeff = [] - for i,el in enumerate(basis_k): - for j in range(i, len(basis_k)): - coeff.append((el * (lefschetz_el ** (r-(2*k)) * basis_k[j])).degree()) - return QuadraticForm(self.base_ring(), len(basis_k), coeff) - else: - raise ValueError("k must be less than r < 2") \ No newline at end of file + if k >= (r/2): + raise ValueError("k must be less than r < 2") + basis_k = [] + lefschetz_el = self.lefschetz_element() + for b in self.basis(): + if b.homogeneous_degree() == k: + basis_k.append(b) + coeff = [] + for i,el in enumerate(basis_k): + for j in range(i, len(basis_k)): + coeff.append((el * (lefschetz_el ** (r-(2*k)) * basis_k[j])).degree()) + return QuadraticForm(self.base_ring(), len(basis_k), coeff) \ No newline at end of file From e772478cdd6fd6b0392ffa87908323c4890c5f98 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 19 Dec 2024 19:42:05 +0530 Subject: [PATCH 19/42] Fixed linting errors --- src/sage/categories/kahler_algebras.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 293775841d5..19d0a798ab2 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -11,6 +11,7 @@ from sage.misc.abstract_method import abstract_method from sage.quadratic_forms.quadratic_form import QuadraticForm + # **************************************************************************** # Copyright (C) 2024 Shriya M <25shriya at gmail.com> # @@ -112,4 +113,4 @@ def hodge_riemann_relations(self, k, r): for i,el in enumerate(basis_k): for j in range(i, len(basis_k)): coeff.append((el * (lefschetz_el ** (r-(2*k)) * basis_k[j])).degree()) - return QuadraticForm(self.base_ring(), len(basis_k), coeff) \ No newline at end of file + return QuadraticForm(self.base_ring(), len(basis_k), coeff) \ No newline at end of file From 2e6c9680e00b3cdbe62ebee84513cbc9f850803c Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sun, 29 Dec 2024 09:00:58 +0530 Subject: [PATCH 20/42] Added _top_degree() method --- src/sage/categories/kahler_algebras.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 19d0a798ab2..4a71f943f42 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -10,6 +10,7 @@ from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis from sage.misc.abstract_method import abstract_method from sage.quadratic_forms.quadratic_form import QuadraticForm +from sage.misc.cachefunc import cached_method # **************************************************************************** @@ -47,6 +48,26 @@ class ParentMethods: def poincare_pairing(): pass + @cached_method + def _top_degree(self): + r""" + Return the top degree of the Kähler algebra. + + EXAMPLES:: + + sage: ch = matroids.Uniform(4,6).chow_ring(QQ, False) + sage: ch._top_degree() + 3 + sage: ch = matroids.Wheel(3).chow_ring(QQ, 'atom-free') + sage: ch._top_degree() + 2 + """ + return max([b.degree() for b in self.basis()]) + + # check all methods with matroids with loops/parallel elements + # add properties and Kahler algebra def. Be as detailed as possible + # issue with category + @abstract_method def lefschetz_element(): pass @@ -102,7 +123,7 @@ def hodge_riemann_relations(self, k, r): ... ValueError: k must be less than r < 2 """ - if k >= (r/2): + if k > (r/2): raise ValueError("k must be less than r < 2") basis_k = [] lefschetz_el = self.lefschetz_element() From c24db6bb15cd620dd1ff004a98bf903307d372ce Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sun, 29 Dec 2024 09:03:04 +0530 Subject: [PATCH 21/42] Added _top_degree() method in other methods --- src/sage/categories/kahler_algebras.py | 3 ++- src/sage/matroids/chow_ring.py | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 4a71f943f42..83bd3b3e7b3 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -72,7 +72,7 @@ def _top_degree(self): def lefschetz_element(): pass - def hodge_riemann_relations(self, k, r): + def hodge_riemann_relations(self, k): r""" Return the quadratic form for the corresponding k (< r/2) for the Kähler algebra. @@ -123,6 +123,7 @@ def hodge_riemann_relations(self, k, r): ... ValueError: k must be less than r < 2 """ + r = self._top_degree() if k > (r/2): raise ValueError("k must be less than r < 2") basis_k = [] diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index 2042e53dbba..2b49e7b5e9f 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -320,7 +320,11 @@ def lefschetz_element(self): sage: U46 = matroids.Uniform(4,6) sage: C = U46.chow_ring(QQ, False) sage: w = C.lefschetz_element(); w - -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A05 - 2*A12 - 2*A13 - 2*A14 - 2*A15 - 2*A23 - 2*A24 - 2*A25 - 2*A34 - 2*A35 - 2*A45 - 6*A012 - 6*A013 - 6*A014 - 6*A015 - 6*A023 - 6*A024 - 6*A025 - 6*A034 - 6*A035 - 6*A045 - 6*A123 - 6*A124 - 6*A125 - 6*A134 - 6*A135 - 6*A145 - 6*A234 - 6*A235 - 6*A245 - 6*A345 - 30*A012345 + -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A05 - 2*A12 - 2*A13 - 2*A14 + - 2*A15 - 2*A23 - 2*A24 - 2*A25 - 2*A34 - 2*A35 - 2*A45 - 6*A012 + - 6*A013 - 6*A014 - 6*A015 - 6*A023 - 6*A024 - 6*A025 - 6*A034 + - 6*A035 - 6*A045 - 6*A123 - 6*A124 - 6*A125 - 6*A134 - 6*A135 + - 6*A145 - 6*A234 - 6*A235 - 6*A245 - 6*A345 - 30*A012345 sage: basis_deg = {} sage: for b in C.basis(): ....: deg = b.homogeneous_degree() @@ -339,7 +343,7 @@ def lefschetz_element(self): w = sum(len(F) * (len(self.matroid().groundset()) - len(F)) * gen for F, gen in self.flats_generator().items()) return w - def poincare_pairing(self, el1, el2, r): + def poincare_pairing(self, el1, el2): r""" Return the Poincaré pairing of any two elements of the Chow ring. @@ -355,6 +359,7 @@ def poincare_pairing(self, el1, el2, r): sage: ch.poincare_pairing(v, u, ch.matroid().rank()) 3 """ + r = self._top_degree() hom_components1 = el1.lift().homogeneous_components() hom_components2 = el2.lift().homogeneous_components() new_el = self.base_ring().zero() From 1e2a17da52082b610967f9a4737a7e19de130df5 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 2 Jan 2025 15:51:47 +0530 Subject: [PATCH 22/42] Added definitions of properties of Kahler Algebras --- src/sage/categories/kahler_algebras.py | 38 +++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 83bd3b3e7b3..091661b82a3 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -25,6 +25,40 @@ class KahlerAlgebras(Category_over_base_ring): r""" The category of graded algebras satisfying the Kähler package. + A finite-dimensional graded algebra `\bigoplus_{k=1}^{r}A^k` satisfies + the *Kähler package* if the following properties hold: + + - Poincaré duality: There exists a perfect `\mathbb{Z}`-bilinear pairing + given by + + .. MATH:: + + A^k \times A^{r-k} \longrightarrow \mathbb{Z} \\ + (a,b) \mapsto \text{deg}(a \cdot b) + + - Hard-Lefschetz Theorem: The graded algebra contains *Lefschetz elements* + `\omega \in A^{1}_{\mathbb{R}}` such that multiplication by `\omega` is + an injection from `A^k_{\mathbb{R}} \longrightarrow A^{k+1}_{\mathbb{R}}` + for all `k < \frac{r}{2}`. + + - Hodge-Riemann-Minikowski Relations: Every Lefchetz element `\omega`, + define quadratic forms on `A^{k}_{\mathbb{R}}` given by + + .. MATH:: + + a \mapsto (-1)^k \text{deg}(a \cdot \omega^{r-2k} \cdot a) + + This quadratic form becomes positive definite upon restriction to the + kernel of the following map + + .. MATH:: + + A^k_\mathbb{R} \longrightarrow A^{r-k+1}_\mathbb{R} \\ + a \mapsto a \cdot \omega^{r-2k+1} + + REFERENCES: + + - [ANR2023]_ EXAMPLES:: @@ -64,10 +98,6 @@ def _top_degree(self): """ return max([b.degree() for b in self.basis()]) - # check all methods with matroids with loops/parallel elements - # add properties and Kahler algebra def. Be as detailed as possible - # issue with category - @abstract_method def lefschetz_element(): pass From ac745917933529b36a7b75241d3ee4867ab206e6 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 2 Jan 2025 15:55:41 +0530 Subject: [PATCH 23/42] Fixed typo --- src/sage/categories/kahler_algebras.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 091661b82a3..0c61a48cf21 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -92,7 +92,7 @@ def _top_degree(self): sage: ch = matroids.Uniform(4,6).chow_ring(QQ, False) sage: ch._top_degree() 3 - sage: ch = matroids.Wheel(3).chow_ring(QQ, 'atom-free') + sage: ch = matroids.Wheel(3).chow_ring(QQ, True, 'atom-free') sage: ch._top_degree() 2 """ From 65ac6cac70078287cbb2e13bffed26c157fb61cb Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Fri, 3 Jan 2025 11:04:01 +0530 Subject: [PATCH 24/42] Corrected super_categories(), documentation and doctests --- src/sage/categories/kahler_algebras.py | 6 +++--- src/sage/matroids/chow_ring.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 0c61a48cf21..bc43d42961a 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -34,7 +34,7 @@ class KahlerAlgebras(Category_over_base_ring): .. MATH:: A^k \times A^{r-k} \longrightarrow \mathbb{Z} \\ - (a,b) \mapsto \text{deg}(a \cdot b) + (a,b) \mapsto \text{deg}(a \cdot b). - Hard-Lefschetz Theorem: The graded algebra contains *Lefschetz elements* `\omega \in A^{1}_{\mathbb{R}}` such that multiplication by `\omega` is @@ -54,7 +54,7 @@ class KahlerAlgebras(Category_over_base_ring): .. MATH:: A^k_\mathbb{R} \longrightarrow A^{r-k+1}_\mathbb{R} \\ - a \mapsto a \cdot \omega^{r-2k+1} + a \mapsto a \cdot \omega^{r-2k+1}. REFERENCES: @@ -75,7 +75,7 @@ class KahlerAlgebras(Category_over_base_ring): sage: TestSuite(C).run() """ def super_categories(self): - return [GradedAlgebrasWithBasis(self.base_ring())] + return [GradedAlgebrasWithBasis(self.base_ring()).FiniteDimensional()] class ParentMethods: @abstract_method diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index 2b49e7b5e9f..6153a1691d3 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -356,7 +356,7 @@ def poincare_pairing(self, el1, el2): -1/6*A2*A012345 + 41/48*A012345^2 sage: v = ch(-A345^2 - 1/4*A345); v -A345^2 - 1/4*A345 - sage: ch.poincare_pairing(v, u, ch.matroid().rank()) + sage: ch.poincare_pairing(v, u) 3 """ r = self._top_degree() From 3b8c699651e38c5ad55195270452fa6ba3e0abf9 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Fri, 3 Jan 2025 12:35:00 +0530 Subject: [PATCH 25/42] Corrected TestSuite() doctest --- src/sage/categories/category_types.py | 5 +++-- src/sage/categories/graded_algebras_with_basis.py | 4 ++++ src/sage/categories/kahler_algebras.py | 11 +++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/sage/categories/category_types.py b/src/sage/categories/category_types.py index 01455011c40..567e2b7d195 100644 --- a/src/sage/categories/category_types.py +++ b/src/sage/categories/category_types.py @@ -202,12 +202,13 @@ def _test_category_over_bases(self, **options): """ tester = self._tester(**options) from sage.categories.category_singleton import Category_singleton - + from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring from .bimodules import Bimodules from .schemes import Schemes for cat in self.super_categories(): tester.assertTrue(isinstance(cat, (Category_singleton, Category_over_base, - Bimodules, Schemes)), + CategoryWithAxiom_over_base_ring, + Bimodules, Schemes)), "The super categories of a category over base should" " be a category over base (or the related Bimodules)" " or a singleton category") diff --git a/src/sage/categories/graded_algebras_with_basis.py b/src/sage/categories/graded_algebras_with_basis.py index 793e19c848b..c87a90af893 100644 --- a/src/sage/categories/graded_algebras_with_basis.py +++ b/src/sage/categories/graded_algebras_with_basis.py @@ -13,6 +13,7 @@ from sage.categories.graded_modules import GradedModulesCategory from sage.categories.signed_tensor import SignedTensorProductsCategory, tensor_signed from sage.misc.cachefunc import cached_method +from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring class GradedAlgebrasWithBasis(GradedModulesCategory): @@ -154,6 +155,9 @@ def formal_series_ring(self): class ElementMethods: pass + class FiniteDimensional(CategoryWithAxiom_over_base_ring): + pass + class SignedTensorProducts(SignedTensorProductsCategory): """ The category of algebras with basis constructed by signed tensor diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index bc43d42961a..d176abb72fc 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -8,6 +8,8 @@ from sage.categories.category_types import Category_over_base_ring from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis +from sage.categories.finite_dimensional_algebras_with_basis import FiniteDimensionalAlgebrasWithBasis +from sage.categories.filtered_modules_with_basis import FilteredModulesWithBasis from sage.misc.abstract_method import abstract_method from sage.quadratic_forms.quadratic_form import QuadraticForm from sage.misc.cachefunc import cached_method @@ -67,7 +69,8 @@ class KahlerAlgebras(Category_over_base_ring): sage: C = KahlerAlgebras(QQ); C Category of kahler algebras over Rational Field sage: sorted(C.super_categories(), key=str) - [Category of graded algebras with basis over Rational Field] + [Category of finite dimensional algebras with basis over Rational + Field, Category of graded algebras with basis over Rational Field] TESTS:: @@ -94,7 +97,7 @@ def _top_degree(self): 3 sage: ch = matroids.Wheel(3).chow_ring(QQ, True, 'atom-free') sage: ch._top_degree() - 2 + 3 """ return max([b.degree() for b in self.basis()]) @@ -110,7 +113,7 @@ def hodge_riemann_relations(self, k): EXAMPLES:: sage: ch = matroids.Uniform(4,6).chow_ring(QQ, False) - sage: ch.hodge_riemann_relations(1, ch.matroid().rank() - 1) + sage: ch.hodge_riemann_relations(1) Quadratic form in 36 variables over Rational Field with coefficients: [ 3 -1 -1 3 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 3 ] [ * 3 -1 3 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 3 ] @@ -148,7 +151,7 @@ def hodge_riemann_relations(self, k): [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 -1 ] [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 -1 ] [ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3 ] - sage: ch.hodge_riemann_relations(3, ch.matroid().rank() - 1) + sage: ch.hodge_riemann_relations(3) Traceback (most recent call last): ... ValueError: k must be less than r < 2 From 8f2e1a56e5ca432516800276324fcc905bc1e961 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Fri, 3 Jan 2025 12:38:04 +0530 Subject: [PATCH 26/42] Changed top_degree() location --- .../categories/graded_algebras_with_basis.py | 16 +++++++++++++++- src/sage/categories/kahler_algebras.py | 16 ---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/sage/categories/graded_algebras_with_basis.py b/src/sage/categories/graded_algebras_with_basis.py index c87a90af893..61ba58021c7 100644 --- a/src/sage/categories/graded_algebras_with_basis.py +++ b/src/sage/categories/graded_algebras_with_basis.py @@ -156,7 +156,21 @@ class ElementMethods: pass class FiniteDimensional(CategoryWithAxiom_over_base_ring): - pass + @cached_method + def top_degree(self): + r""" + Return the top degree of the finite dimensional graded algebra. + + EXAMPLES:: + + sage: ch = matroids.Uniform(4,6).chow_ring(QQ, False) + sage: ch.top_degree() + 3 + sage: ch = matroids.Wheel(3).chow_ring(QQ, True, 'atom-free') + sage: ch.top_degree() + 3 + """ + return max([b.degree() for b in self.basis()]) class SignedTensorProducts(SignedTensorProductsCategory): """ diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index d176abb72fc..c699c080653 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -85,22 +85,6 @@ class ParentMethods: def poincare_pairing(): pass - @cached_method - def _top_degree(self): - r""" - Return the top degree of the Kähler algebra. - - EXAMPLES:: - - sage: ch = matroids.Uniform(4,6).chow_ring(QQ, False) - sage: ch._top_degree() - 3 - sage: ch = matroids.Wheel(3).chow_ring(QQ, True, 'atom-free') - sage: ch._top_degree() - 3 - """ - return max([b.degree() for b in self.basis()]) - @abstract_method def lefschetz_element(): pass From 430e5a9c819221784468fa25658f9c40db7a8551 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sat, 4 Jan 2025 10:37:27 +0530 Subject: [PATCH 27/42] Edited flats_to_generator_dict() method and kahler_algebras file --- src/sage/categories/kahler_algebras.py | 4 +- src/sage/matroids/chow_ring.py | 55 +++++--------------------- src/sage/matroids/chow_ring_ideal.py | 35 +++++++++++++++- 3 files changed, 46 insertions(+), 48 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index c699c080653..73ad0c761b1 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -82,7 +82,7 @@ def super_categories(self): class ParentMethods: @abstract_method - def poincare_pairing(): + def poincare_pairing(a,b): pass @abstract_method @@ -140,7 +140,7 @@ def hodge_riemann_relations(self, k): ... ValueError: k must be less than r < 2 """ - r = self._top_degree() + r = self.top_degree() if k > (r/2): raise ValueError("k must be less than r < 2") basis_k = [] diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index 6153a1691d3..6fce4f9a2c3 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -10,6 +10,7 @@ from sage.rings.quotient_ring import QuotientRing_generic from sage.categories.kahler_algebras import KahlerAlgebras from sage.categories.commutative_rings import CommutativeRings +from sage.misc.cachefunc import cached_method class ChowRing(QuotientRing_generic): @@ -96,7 +97,7 @@ def __init__(self, R, M, augmented, presentation=None): self._ideal = AugmentedChowRingIdeal_atom_free(M, R) else: self._ideal = ChowRingIdeal_nonaug(M, R) - C = CommutativeRings().Quotients() & KahlerAlgebras(R).FiniteDimensional() + C = CommutativeRings().Quotients() & KahlerAlgebras(R) QuotientRing_generic.__init__(self, R=self._ideal.ring(), I=self._ideal, names=self._ideal.ring().variable_names(), @@ -197,43 +198,7 @@ def basis(self): monomial_basis = self._ideal.normal_basis() return Family([self.element_class(self, mon, reduce=False) for mon in monomial_basis]) - def flats_generator(self): - r""" - Return the corresponding generators of flats of the Chow ring. - - EXAMPLES:: - - sage: ch = matroids.catalog.NonFano().chow_ring(ZZ, True, 'atom-free') - sage: ch.flats_generator() - {frozenset({'a'}): Aa, - frozenset({'b'}): Ab, - frozenset({'c'}): Ac, - frozenset({'d'}): Ad, - frozenset({'e'}): Ae, - frozenset({'f'}): Af, - frozenset({'g'}): Ag, - frozenset({'a', 'b', 'f'}): Aabf, - frozenset({'a', 'c', 'e'}): Aace, - frozenset({'a', 'd', 'g'}): Aadg, - frozenset({'b', 'c', 'd'}): Abcd, - frozenset({'b', 'e', 'g'}): Abeg, - frozenset({'c', 'f', 'g'}): Acfg, - frozenset({'d', 'e'}): Ade, - frozenset({'d', 'f'}): Adf, - frozenset({'e', 'f'}): Aef, - frozenset({'a', 'b', 'c', 'd', 'e', 'f', 'g'}): Aabcdefg} - """ - flats = [X for i in range(1, self._matroid.rank() + 1) - for X in self._matroid.flats(i)] - gens = self.gens() - if not (self._augmented and self._presentation == 'fy'): - return dict(zip(flats, gens)) - flats_gen = {} - E = list(self.matroid().groundset()) - for i,F in enumerate(flats): - flats_gen[F] = gens[len(E) + i] - return flats_gen - + @cached_method def lefschetz_element(self): r""" Return one Lefschetz element of the given Chow ring. @@ -340,8 +305,9 @@ def lefschetz_element(self): sage: len(basis_deg[2]) 36 """ - w = sum(len(F) * (len(self.matroid().groundset()) - len(F)) * gen for F, gen in self.flats_generator().items()) - return w + w = sum(len(F) * (len(self.matroid().groundset()) - len(F)) * gen + for F, gen in self.defining_ideal().flat_to_generator_dict().items()) + return self.ElementClass(self,w) def poincare_pairing(self, el1, el2): r""" @@ -359,15 +325,14 @@ def poincare_pairing(self, el1, el2): sage: ch.poincare_pairing(v, u) 3 """ - r = self._top_degree() + r = self.top_degree() hom_components1 = el1.lift().homogeneous_components() hom_components2 = el2.lift().homogeneous_components() new_el = self.base_ring().zero() for i in hom_components1: - for j in hom_components2: - if r - i not in hom_components2: - continue - new_el += hom_components1[i] * hom_components2[j] + if r - i not in hom_components2: + continue + new_el += hom_components1[i] * hom_components2[r - i] return new_el.degree() class Element(QuotientRing_generic.Element): diff --git a/src/sage/matroids/chow_ring_ideal.py b/src/sage/matroids/chow_ring_ideal.py index f2a6c6cf477..906e6d59803 100644 --- a/src/sage/matroids/chow_ring_ideal.py +++ b/src/sage/matroids/chow_ring_ideal.py @@ -56,6 +56,39 @@ def _lattice_flats(self): chains = lattice_flats.chains() #Only chains return (ranks, chains) + def flats_to_generator_dict(self): + r""" + Return the corresponding generators of flats/groundset elements of + Chow ring ideal. + + EXAMPLES:: + + sage: ch = matroids.Uniform(4,6).chow_ring(QQ, True, 'atom-free') + sage: ch.defining_ideal().flats_to_generator_dict() + {frozenset({0}): A0, frozenset({1}): A1, frozenset({2}): A2, + frozenset({3}): A3, frozenset({4}): A4, frozenset({5}): A5, + frozenset({0, 1}): A01, frozenset({0, 2}): A02, + frozenset({0, 3}): A03, frozenset({0, 4}): A04, + frozenset({0, 5}): A05, frozenset({1, 2}): A12, + frozenset({1, 3}): A13, frozenset({1, 4}): A14, + frozenset({1, 5}): A15, frozenset({2, 3}): A23, + frozenset({2, 4}): A24, frozenset({2, 5}): A25, + frozenset({3, 4}): A34, frozenset({3, 5}): A35, + frozenset({4, 5}): A45, frozenset({0, 1, 2}): A012, + frozenset({0, 1, 3}): A013, frozenset({0, 1, 4}): A014, + frozenset({0, 1, 5}): A015, frozenset({0, 2, 3}): A023, + frozenset({0, 2, 4}): A024, frozenset({0, 2, 5}): A025, + frozenset({0, 3, 4}): A034, frozenset({0, 3, 5}): A035, + frozenset({0, 4, 5}): A045, frozenset({1, 2, 3}): A123, + frozenset({1, 2, 4}): A124, frozenset({1, 2, 5}): A125, + frozenset({1, 3, 4}): A134, frozenset({1, 3, 5}): A135, + frozenset({1, 4, 5}): A145, frozenset({2, 3, 4}): A234, + frozenset({2, 3, 5}): A235, frozenset({2, 4, 5}): A245, + frozenset({3, 4, 5}): A345, + frozenset({0, 1, 2, 3, 4, 5}): A012345} + """ + flats_gen = self._flats_generator + return flats_gen class ChowRingIdeal_nonaug(ChowRingIdeal): r""" @@ -118,7 +151,7 @@ def __init__(self, M, R): for X in self._matroid.flats(i)] names = ['A{}'.format(''.join(str(x) for x in sorted(F, key=cmp_elements_key))) for F in flats] try: - poly_ring = PolynomialRing(R, names) #self.ring + poly_ring = PolynomialRing(R, names) # self.ring except ValueError: # variables are not proper names poly_ring = PolynomialRing(R, 'A', len(flats)) gens = poly_ring.gens() From 2c3cf57157b99a2933a3bd79aecd2fe52b74c954 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sat, 4 Jan 2025 12:01:11 +0530 Subject: [PATCH 28/42] Changed top_degree() location --- .../categories/graded_algebras_with_basis.py | 27 ++++++++++--------- src/sage/categories/kahler_algebras.py | 14 ++++++++++ src/sage/matroids/chow_ring.py | 1 + 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/sage/categories/graded_algebras_with_basis.py b/src/sage/categories/graded_algebras_with_basis.py index 61ba58021c7..180760d1f32 100644 --- a/src/sage/categories/graded_algebras_with_basis.py +++ b/src/sage/categories/graded_algebras_with_basis.py @@ -156,21 +156,22 @@ class ElementMethods: pass class FiniteDimensional(CategoryWithAxiom_over_base_ring): - @cached_method - def top_degree(self): - r""" - Return the top degree of the finite dimensional graded algebra. + class ParentMethods: + @cached_method + def top_degree(self): + r""" + Return the top degree of the finite dimensional graded algebra. - EXAMPLES:: + EXAMPLES:: - sage: ch = matroids.Uniform(4,6).chow_ring(QQ, False) - sage: ch.top_degree() - 3 - sage: ch = matroids.Wheel(3).chow_ring(QQ, True, 'atom-free') - sage: ch.top_degree() - 3 - """ - return max([b.degree() for b in self.basis()]) + sage: ch = matroids.Uniform(4,6).chow_ring(QQ, False) + sage: ch.top_degree() + 3 + sage: ch = matroids.Wheel(3).chow_ring(QQ, True, 'atom-free') + sage: ch.top_degree() + 3 + """ + return max([b.degree() for b in self.basis()]) class SignedTensorProducts(SignedTensorProductsCategory): """ diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 73ad0c761b1..3aa00cfaee6 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -83,6 +83,20 @@ def super_categories(self): class ParentMethods: @abstract_method def poincare_pairing(a,b): + r""" + Return the Poincaré pairing of two elements of the Kähler algebra. + + EXAMPLES:: + + sage: ch = matroids.catalog.Fano().chow_ring(QQ, True, 'fy') + sage: Ba, Bb, Bc, Bd, Be, Bf, Bg, Babf, Bace, Badg, Bbcd, Bbeg, Bcfg, Bdef, Babcdefg = ch.gens()[8:] + sage: u = ch(-Babf^2 + Bcfg^2 - 8/7*Bc*Babcdefg + 1/2*Bd*Babcdefg - Bf*Babcdefg - Bg*Babcdefg); u + -Babf^2 + Bcfg^2 - 8/7*Bc*Babcdefg + 1/2*Bd*Babcdefg - Bf*Babcdefg - Bg*Babcdefg + sage: v = ch(Bg - 2/37*Babf + Badg + Bbeg + Bcfg + Babcdefg); v + Bg - 2/37*Babf + Badg + Bbeg + Bcfg + Babcdefg + sage: ch.poincare_pairing(v, u) + 3 + """ pass @abstract_method diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index 6fce4f9a2c3..4a148c9ec62 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -309,6 +309,7 @@ def lefschetz_element(self): for F, gen in self.defining_ideal().flat_to_generator_dict().items()) return self.ElementClass(self,w) + @cached_method def poincare_pairing(self, el1, el2): r""" Return the Poincaré pairing of any two elements of the From 89416b90f75fb9924a059a787926b8717b183234 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sat, 4 Jan 2025 12:03:50 +0530 Subject: [PATCH 29/42] Edited chow_ring_ideal.py --- src/sage/matroids/chow_ring_ideal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/matroids/chow_ring_ideal.py b/src/sage/matroids/chow_ring_ideal.py index 906e6d59803..3e72edacfc0 100644 --- a/src/sage/matroids/chow_ring_ideal.py +++ b/src/sage/matroids/chow_ring_ideal.py @@ -53,7 +53,7 @@ def _lattice_flats(self): flats = list(lattice_flats) flats.sort(key=lambda X: (len(X), sorted(X))) ranks = {F: self._matroid.rank(F) for F in flats} - chains = lattice_flats.chains() #Only chains + chains = lattice_flats.chains() # Only chains return (ranks, chains) def flats_to_generator_dict(self): @@ -151,7 +151,7 @@ def __init__(self, M, R): for X in self._matroid.flats(i)] names = ['A{}'.format(''.join(str(x) for x in sorted(F, key=cmp_elements_key))) for F in flats] try: - poly_ring = PolynomialRing(R, names) # self.ring + poly_ring = PolynomialRing(R, names) # self.ring except ValueError: # variables are not proper names poly_ring = PolynomialRing(R, 'A', len(flats)) gens = poly_ring.gens() From f3152d335a91e2a5dec9da6a9aa324b561fceec5 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sat, 4 Jan 2025 12:07:16 +0530 Subject: [PATCH 30/42] Edited chow_ring_ideal.py --- src/sage/matroids/chow_ring_ideal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/matroids/chow_ring_ideal.py b/src/sage/matroids/chow_ring_ideal.py index 3e72edacfc0..58efa2a9bf3 100644 --- a/src/sage/matroids/chow_ring_ideal.py +++ b/src/sage/matroids/chow_ring_ideal.py @@ -151,7 +151,7 @@ def __init__(self, M, R): for X in self._matroid.flats(i)] names = ['A{}'.format(''.join(str(x) for x in sorted(F, key=cmp_elements_key))) for F in flats] try: - poly_ring = PolynomialRing(R, names) # self.ring + poly_ring = PolynomialRing(R, names) # self.ring except ValueError: # variables are not proper names poly_ring = PolynomialRing(R, 'A', len(flats)) gens = poly_ring.gens() From e9efa6e5571d21b62db58a1a2660aa64d024ff9f Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sat, 4 Jan 2025 12:07:58 +0530 Subject: [PATCH 31/42] Edited chow_ring_ideal.py --- src/sage/matroids/chow_ring_ideal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/matroids/chow_ring_ideal.py b/src/sage/matroids/chow_ring_ideal.py index 58efa2a9bf3..88747e7673a 100644 --- a/src/sage/matroids/chow_ring_ideal.py +++ b/src/sage/matroids/chow_ring_ideal.py @@ -152,7 +152,7 @@ def __init__(self, M, R): names = ['A{}'.format(''.join(str(x) for x in sorted(F, key=cmp_elements_key))) for F in flats] try: poly_ring = PolynomialRing(R, names) # self.ring - except ValueError: # variables are not proper names + except ValueError: # variables are not proper names poly_ring = PolynomialRing(R, 'A', len(flats)) gens = poly_ring.gens() self._flats_generator = dict(zip(flats, gens)) From df942f65a0bb7a35e96d5ed32091543a7c3904ce Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sat, 4 Jan 2025 12:25:09 +0530 Subject: [PATCH 32/42] Corrected linting errors, doctests and added warning note --- src/sage/categories/category_types.py | 2 +- src/sage/matroids/chow_ring.py | 7 +++++-- src/sage/matroids/chow_ring_ideal.py | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/sage/categories/category_types.py b/src/sage/categories/category_types.py index 567e2b7d195..7f0d44c0f32 100644 --- a/src/sage/categories/category_types.py +++ b/src/sage/categories/category_types.py @@ -207,7 +207,7 @@ def _test_category_over_bases(self, **options): from .schemes import Schemes for cat in self.super_categories(): tester.assertTrue(isinstance(cat, (Category_singleton, Category_over_base, - CategoryWithAxiom_over_base_ring, + CategoryWithAxiom_over_base_ring, Bimodules, Schemes)), "The super categories of a category over base should" " be a category over base (or the related Bimodules)" diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index 4a148c9ec62..2d00b04f312 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -53,6 +53,9 @@ class ChowRing(QuotientRing_generic): :mod:`sage.matroids.chow_ring_ideal` + An important note to be taken is that different presentations of Chow rings + of non-simple matroids may not be isomorphic to one another. + INPUT: - ``M`` -- matroid @@ -305,8 +308,8 @@ def lefschetz_element(self): sage: len(basis_deg[2]) 36 """ - w = sum(len(F) * (len(self.matroid().groundset()) - len(F)) * gen - for F, gen in self.defining_ideal().flat_to_generator_dict().items()) + w = sum(len(F) * (len(self.matroid().groundset()) - len(F)) * gen + for F, gen in self.defining_ideal().flats_to_generator_dict().items()) return self.ElementClass(self,w) @cached_method diff --git a/src/sage/matroids/chow_ring_ideal.py b/src/sage/matroids/chow_ring_ideal.py index 88747e7673a..5f80d6de42f 100644 --- a/src/sage/matroids/chow_ring_ideal.py +++ b/src/sage/matroids/chow_ring_ideal.py @@ -68,7 +68,7 @@ def flats_to_generator_dict(self): {frozenset({0}): A0, frozenset({1}): A1, frozenset({2}): A2, frozenset({3}): A3, frozenset({4}): A4, frozenset({5}): A5, frozenset({0, 1}): A01, frozenset({0, 2}): A02, - frozenset({0, 3}): A03, frozenset({0, 4}): A04, + frozenset({0, 3}): A03, frozenset({0, 4}): A04, frozenset({0, 5}): A05, frozenset({1, 2}): A12, frozenset({1, 3}): A13, frozenset({1, 4}): A14, frozenset({1, 5}): A15, frozenset({2, 3}): A23, @@ -90,6 +90,7 @@ def flats_to_generator_dict(self): flats_gen = self._flats_generator return flats_gen + class ChowRingIdeal_nonaug(ChowRingIdeal): r""" The Chow ring ideal of a matroid `M`. From e1039a9bd384b127947765d67ad4f8a4ca1b60cc Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sat, 4 Jan 2025 12:55:06 +0530 Subject: [PATCH 33/42] Debugged lefschetz_element() --- src/sage/matroids/chow_ring.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index 2d00b04f312..7dca223bb40 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -310,7 +310,7 @@ def lefschetz_element(self): """ w = sum(len(F) * (len(self.matroid().groundset()) - len(F)) * gen for F, gen in self.defining_ideal().flats_to_generator_dict().items()) - return self.ElementClass(self,w) + return self.element_class(self, w) @cached_method def poincare_pairing(self, el1, el2): From 43f897364b38f26296980329febad783b2e25269 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sat, 4 Jan 2025 22:28:41 +0530 Subject: [PATCH 34/42] Edited doctests --- src/sage/categories/kahler_algebras.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 3aa00cfaee6..6ef68a62f33 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -70,7 +70,7 @@ class KahlerAlgebras(Category_over_base_ring): Category of kahler algebras over Rational Field sage: sorted(C.super_categories(), key=str) [Category of finite dimensional algebras with basis over Rational - Field, Category of graded algebras with basis over Rational Field] + Field] TESTS:: From 93dd61689bab82266e718bcfc27c7d98cf5d0b41 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sun, 5 Jan 2025 17:40:43 +0530 Subject: [PATCH 35/42] Corrected doctests --- src/sage/categories/kahler_algebras.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 6ef68a62f33..17eeddaf142 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -69,8 +69,7 @@ class KahlerAlgebras(Category_over_base_ring): sage: C = KahlerAlgebras(QQ); C Category of kahler algebras over Rational Field sage: sorted(C.super_categories(), key=str) - [Category of finite dimensional algebras with basis over Rational - Field] + [Category of finite dimensional algebras with basis over Rational Field] TESTS:: From 44d0d2da94f578e0c1144744d56d5bc86be839b3 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Sun, 5 Jan 2025 21:37:00 +0530 Subject: [PATCH 36/42] Edited doctests --- src/sage/categories/kahler_algebras.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 17eeddaf142..02a679c4c4c 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -69,7 +69,8 @@ class KahlerAlgebras(Category_over_base_ring): sage: C = KahlerAlgebras(QQ); C Category of kahler algebras over Rational Field sage: sorted(C.super_categories(), key=str) - [Category of finite dimensional algebras with basis over Rational Field] + [Category of finite dimensional graded algebras with basis over + Rational Field] TESTS:: From 0448df5aa25f22ea60535751a9e47cac1b1ca218 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Mon, 6 Jan 2025 22:59:10 +0530 Subject: [PATCH 37/42] Added doctest for lefschetz_element() --- src/sage/categories/kahler_algebras.py | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 02a679c4c4c..8186191f2ad 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -101,6 +101,34 @@ def poincare_pairing(a,b): @abstract_method def lefschetz_element(): + r""" + Return one Lefschetz element of the given Kähler algebra. + + EXAMPLES:: + + sage: U46 = matroids.Uniform(4,6) + sage: C = U46.chow_ring(QQ, False) + sage: w = C.lefschetz_element(); w + -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A05 - 2*A12 - 2*A13 - 2*A14 + - 2*A15 - 2*A23 - 2*A24 - 2*A25 - 2*A34 - 2*A35 - 2*A45 - 6*A012 + - 6*A013 - 6*A014 - 6*A015 - 6*A023 - 6*A024 - 6*A025 - 6*A034 + - 6*A035 - 6*A045 - 6*A123 - 6*A124 - 6*A125 - 6*A134 - 6*A135 + - 6*A145 - 6*A234 - 6*A235 - 6*A245 - 6*A345 - 30*A012345 + sage: basis_deg = {} + sage: for b in C.basis(): + ....: deg = b.homogeneous_degree() + ....: if deg not in basis_deg: + ....: basis_deg[deg] = [] + ....: basis_deg[deg].append(b) + sage: m = max(basis_deg); m + 3 + sage: len(basis_deg[1]) == len(basis_deg[2]) + True + sage: matrix([(w*b).to_vector() for b in basis_deg[1]]).rank() + 36 + sage: len(basis_deg[2]) + 36 + """ pass def hodge_riemann_relations(self, k): From 7a2ae3f9209c6bd583b606985100254ac71ca652 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 9 Jan 2025 09:36:14 +0530 Subject: [PATCH 38/42] Edited documentation --- src/sage/categories/kahler_algebras.py | 41 +++++++++++++------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index 8186191f2ad..a08ab008b92 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -30,39 +30,48 @@ class KahlerAlgebras(Category_over_base_ring): A finite-dimensional graded algebra `\bigoplus_{k=1}^{r}A^k` satisfies the *Kähler package* if the following properties hold: - - Poincaré duality: There exists a perfect `\mathbb{Z}`-bilinear pairing + - Poincaré duality: There exists a perfect `\ZZ`-bilinear pairing given by .. MATH:: - A^k \times A^{r-k} \longrightarrow \mathbb{Z} \\ - (a,b) \mapsto \text{deg}(a \cdot b). + A^k \times A^{r-k} \longrightarrow \ZZ \\ + (a,b) \mapsto \deg(a \cdot b). - Hard-Lefschetz Theorem: The graded algebra contains *Lefschetz elements* - `\omega \in A^{1}_{\mathbb{R}}` such that multiplication by `\omega` is - an injection from `A^k_{\mathbb{R}} \longrightarrow A^{k+1}_{\mathbb{R}}` + `\omega \in A^{1}_{\RR}` such that multiplication by `\omega` is + an injection from `A^k_{\RR} \longrightarrow A^{k+1}_{\RR}` for all `k < \frac{r}{2}`. - Hodge-Riemann-Minikowski Relations: Every Lefchetz element `\omega`, - define quadratic forms on `A^{k}_{\mathbb{R}}` given by + define quadratic forms on `A^{k}_{\RR}` given by .. MATH:: - a \mapsto (-1)^k \text{deg}(a \cdot \omega^{r-2k} \cdot a) + a \mapsto (-1)^k \deg(a \cdot \omega^{r-2k} \cdot a) This quadratic form becomes positive definite upon restriction to the kernel of the following map .. MATH:: - A^k_\mathbb{R} \longrightarrow A^{r-k+1}_\mathbb{R} \\ + A^k_\RR \longrightarrow A^{r-k+1}_\RR \\ a \mapsto a \cdot \omega^{r-2k+1}. REFERENCES: - [ANR2023]_ - EXAMPLES:: + TESTS:: + + sage: C = KahlerAlgebras(QQ) + sage: TestSuite(C).run() + """ + def super_categories(self): + r""" + Return the super categories of ``self``. + + EXAMPLES:: sage: from sage.categories.kahler_algebras import KahlerAlgebras @@ -71,18 +80,12 @@ class KahlerAlgebras(Category_over_base_ring): sage: sorted(C.super_categories(), key=str) [Category of finite dimensional graded algebras with basis over Rational Field] - - TESTS:: - - sage: C = KahlerAlgebras(QQ) - sage: TestSuite(C).run() - """ - def super_categories(self): + """ return [GradedAlgebrasWithBasis(self.base_ring()).FiniteDimensional()] class ParentMethods: @abstract_method - def poincare_pairing(a,b): + def poincare_pairing(self, a,b): r""" Return the Poincaré pairing of two elements of the Kähler algebra. @@ -97,10 +100,9 @@ def poincare_pairing(a,b): sage: ch.poincare_pairing(v, u) 3 """ - pass @abstract_method - def lefschetz_element(): + def lefschetz_element(self): r""" Return one Lefschetz element of the given Kähler algebra. @@ -129,7 +131,6 @@ def lefschetz_element(): sage: len(basis_deg[2]) 36 """ - pass def hodge_riemann_relations(self, k): r""" From cccf43304e4b02eeb40500311ba9d29d00731483 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 9 Jan 2025 09:46:05 +0530 Subject: [PATCH 39/42] Edited documentation --- src/sage/categories/kahler_algebras.py | 44 +++++++++++++------------- src/sage/matroids/chow_ring.py | 14 ++++---- src/sage/matroids/chow_ring_ideal.py | 13 ++++---- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index a08ab008b92..d43b6267d72 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -73,32 +73,32 @@ def super_categories(self): EXAMPLES:: - sage: from sage.categories.kahler_algebras import KahlerAlgebras + sage: from sage.categories.kahler_algebras import KahlerAlgebras - sage: C = KahlerAlgebras(QQ); C - Category of kahler algebras over Rational Field - sage: sorted(C.super_categories(), key=str) - [Category of finite dimensional graded algebras with basis over - Rational Field] + sage: C = KahlerAlgebras(QQ); C + Category of kahler algebras over Rational Field + sage: sorted(C.super_categories(), key=str) + [Category of finite dimensional graded algebras with basis over + Rational Field] """ return [GradedAlgebrasWithBasis(self.base_ring()).FiniteDimensional()] class ParentMethods: @abstract_method - def poincare_pairing(self, a,b): + def poincare_pairing(self, a, b): r""" Return the Poincaré pairing of two elements of the Kähler algebra. - EXAMPLES:: + EXAMPLES:: - sage: ch = matroids.catalog.Fano().chow_ring(QQ, True, 'fy') - sage: Ba, Bb, Bc, Bd, Be, Bf, Bg, Babf, Bace, Badg, Bbcd, Bbeg, Bcfg, Bdef, Babcdefg = ch.gens()[8:] - sage: u = ch(-Babf^2 + Bcfg^2 - 8/7*Bc*Babcdefg + 1/2*Bd*Babcdefg - Bf*Babcdefg - Bg*Babcdefg); u - -Babf^2 + Bcfg^2 - 8/7*Bc*Babcdefg + 1/2*Bd*Babcdefg - Bf*Babcdefg - Bg*Babcdefg - sage: v = ch(Bg - 2/37*Babf + Badg + Bbeg + Bcfg + Babcdefg); v - Bg - 2/37*Babf + Badg + Bbeg + Bcfg + Babcdefg - sage: ch.poincare_pairing(v, u) - 3 + sage: ch = matroids.catalog.Fano().chow_ring(QQ, True, 'fy') + sage: Ba, Bb, Bc, Bd, Be, Bf, Bg, Babf, Bace, Badg, Bbcd, Bbeg, Bcfg, Bdef, Babcdefg = ch.gens()[8:] + sage: u = ch(-Babf^2 + Bcfg^2 - 8/7*Bc*Babcdefg + 1/2*Bd*Babcdefg - Bf*Babcdefg - Bg*Babcdefg); u + -Babf^2 + Bcfg^2 - 8/7*Bc*Babcdefg + 1/2*Bd*Babcdefg - Bf*Babcdefg - Bg*Babcdefg + sage: v = ch(Bg - 2/37*Babf + Badg + Bbeg + Bcfg + Babcdefg); v + Bg - 2/37*Babf + Badg + Bbeg + Bcfg + Babcdefg + sage: ch.poincare_pairing(v, u) + 3 """ @abstract_method @@ -108,7 +108,7 @@ def lefschetz_element(self): EXAMPLES:: - sage: U46 = matroids.Uniform(4,6) + sage: U46 = matroids.Uniform(4, 6) sage: C = U46.chow_ring(QQ, False) sage: w = C.lefschetz_element(); w -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A05 - 2*A12 - 2*A13 - 2*A14 @@ -134,12 +134,12 @@ def lefschetz_element(self): def hodge_riemann_relations(self, k): r""" - Return the quadratic form for the corresponding k (< r/2) for the - Kähler algebra. + Return the quadratic form for the corresponding ``k`` + (`< \frac{r}{2}`) for the Kähler algebra, where `r` is the top degree. EXAMPLES:: - sage: ch = matroids.Uniform(4,6).chow_ring(QQ, False) + sage: ch = matroids.Uniform(4, 6).chow_ring(QQ, False) sage: ch.hodge_riemann_relations(1) Quadratic form in 36 variables over Rational Field with coefficients: [ 3 -1 -1 3 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 3 ] @@ -181,11 +181,11 @@ def hodge_riemann_relations(self, k): sage: ch.hodge_riemann_relations(3) Traceback (most recent call last): ... - ValueError: k must be less than r < 2 + ValueError: k must be less than r/2 < 2 """ r = self.top_degree() if k > (r/2): - raise ValueError("k must be less than r < 2") + raise ValueError("k must be less than r/2 < 2") basis_k = [] lefschetz_el = self.lefschetz_element() for b in self.basis(): diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index 7dca223bb40..e642e1bb475 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -53,8 +53,10 @@ class ChowRing(QuotientRing_generic): :mod:`sage.matroids.chow_ring_ideal` - An important note to be taken is that different presentations of Chow rings - of non-simple matroids may not be isomorphic to one another. + .. WARNING:: + + Different presentations of Chow rings of non-simple matroids may not be + isomorphic to one another. INPUT: @@ -131,7 +133,7 @@ def _latex_(self): EXAMPLES:: - sage: M1 = matroids.Uniform(2,5) + sage: M1 = matroids.Uniform(2, 5) sage: ch = M1.chow_ring(QQ, False) sage: ch._latex_() 'A(\\begin{array}{l}\n\\text{\\texttt{U(2,{ }5):{ }Matroid{ }of{ }rank{ }2{ }on{ }5{ }elements{ }with{ }circuit{-}closures}}\\\\\n\\text{\\texttt{{\\char`\\{}2:{ }{\\char`\\{}{\\char`\\{}0,{ }1,{ }2,{ }3,{ }4{\\char`\\}}{\\char`\\}}{\\char`\\}}}}\n\\end{array})_{\\Bold{Q}}' @@ -148,7 +150,7 @@ def matroid(self): EXAMPLES:: - sage: ch = matroids.Uniform(3,6).chow_ring(QQ, True, 'fy') + sage: ch = matroids.Uniform(3, 6).chow_ring(QQ, True, 'fy') sage: ch.matroid() U(3, 6): Matroid of rank 3 on 6 elements with circuit-closures {3: {{0, 1, 2, 3, 4, 5}}} @@ -225,7 +227,7 @@ def lefschetz_element(self): It is then multiplied with the elements of FY-monomial bases of different degrees:: - sage: ch = matroids.Uniform(4,5).chow_ring(QQ, False) + sage: ch = matroids.Uniform(4, 5).chow_ring(QQ, False) sage: basis_deg = {} sage: for b in ch.basis(): ....: deg = b.homogeneous_degree() @@ -285,7 +287,7 @@ def lefschetz_element(self): TESTS:: - sage: U46 = matroids.Uniform(4,6) + sage: U46 = matroids.Uniform(4, 6) sage: C = U46.chow_ring(QQ, False) sage: w = C.lefschetz_element(); w -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A05 - 2*A12 - 2*A13 - 2*A14 diff --git a/src/sage/matroids/chow_ring_ideal.py b/src/sage/matroids/chow_ring_ideal.py index db830ab0fc2..625bec8d7b9 100644 --- a/src/sage/matroids/chow_ring_ideal.py +++ b/src/sage/matroids/chow_ring_ideal.py @@ -21,7 +21,7 @@ def matroid(self): EXAMPLES:: - sage: ch = matroids.Uniform(3,6).chow_ring(QQ, False) + sage: ch = matroids.Uniform(3, 6).chow_ring(QQ, False) sage: ch.defining_ideal().matroid() U(3, 6): Matroid of rank 3 on 6 elements with circuit-closures {3: {{0, 1, 2, 3, 4, 5}}} @@ -63,7 +63,7 @@ def flats_to_generator_dict(self): EXAMPLES:: - sage: ch = matroids.Uniform(4,6).chow_ring(QQ, True, 'atom-free') + sage: ch = matroids.Uniform(4, 6).chow_ring(QQ, True, 'atom-free') sage: ch.defining_ideal().flats_to_generator_dict() {frozenset({0}): A0, frozenset({1}): A1, frozenset({2}): A2, frozenset({3}): A3, frozenset({4}): A4, frozenset({5}): A5, @@ -87,8 +87,7 @@ def flats_to_generator_dict(self): frozenset({3, 4, 5}): A345, frozenset({0, 1, 2, 3, 4, 5}): A012345} """ - flats_gen = self._flats_generator - return flats_gen + return dict(self._flats_generator) class ChowRingIdeal_nonaug(ChowRingIdeal): @@ -129,7 +128,7 @@ class ChowRingIdeal_nonaug(ChowRingIdeal): Chow ring ideal of uniform matroid of rank 3 on 6 elements:: - sage: ch = matroids.Uniform(3,6).chow_ring(QQ, False) + sage: ch = matroids.Uniform(3, 6).chow_ring(QQ, False) sage: ch.defining_ideal() Chow ring ideal of U(3, 6): Matroid of rank 3 on 6 elements with circuit-closures {3: {{0, 1, 2, 3, 4, 5}}} - non augmented @@ -576,7 +575,7 @@ def normal_basis(self, algorithm='', *args, **kwargs): EXAMPLES:: - sage: ch = matroids.Uniform(2,5).chow_ring(QQ, True, 'fy') + sage: ch = matroids.Uniform(2, 5).chow_ring(QQ, True, 'fy') sage: I = ch.defining_ideal() sage: I.normal_basis() [1, B0, B1, B2, B3, B4, B01234, B01234^2] @@ -753,7 +752,7 @@ def groebner_basis(self, algorithm='', *args, **kwargs): EXAMPLES:: - sage: M1 = matroids.Uniform(3,6) + sage: M1 = matroids.Uniform(3, 6) sage: ch = M1.chow_ring(QQ, True, 'atom-free') sage: ch.defining_ideal().groebner_basis(algorithm='') Polynomial Sequence with 253 Polynomials in 22 Variables From 693792597cf3a3e74cfa57192468340fedc8e14d Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 9 Jan 2025 09:46:25 +0530 Subject: [PATCH 40/42] Edited top_degree() methd --- src/sage/categories/graded_algebras_with_basis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/categories/graded_algebras_with_basis.py b/src/sage/categories/graded_algebras_with_basis.py index 180760d1f32..254020f09ff 100644 --- a/src/sage/categories/graded_algebras_with_basis.py +++ b/src/sage/categories/graded_algebras_with_basis.py @@ -171,7 +171,7 @@ def top_degree(self): sage: ch.top_degree() 3 """ - return max([b.degree() for b in self.basis()]) + return max(b.degree() for b in self.basis()) class SignedTensorProducts(SignedTensorProductsCategory): """ From 7a2352586b9f723fb2fe7ae60489a4320aa42f86 Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 9 Jan 2025 09:52:58 +0530 Subject: [PATCH 41/42] Formatted documentation --- src/sage/categories/kahler_algebras.py | 20 +++++++-------- src/sage/matroids/chow_ring.py | 34 +++++++------------------- src/sage/matroids/chow_ring_ideal.py | 9 +++++++ 3 files changed, 28 insertions(+), 35 deletions(-) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index d43b6267d72..cda0ce871a9 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -5,6 +5,15 @@ - Shriya M """ +# **************************************************************************** +# Copyright (C) 2024 Shriya M <25shriya at 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.categories.category_types import Category_over_base_ring from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis @@ -15,15 +24,6 @@ from sage.misc.cachefunc import cached_method -# **************************************************************************** -# Copyright (C) 2024 Shriya M <25shriya at 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/ -# **************************************************************************** class KahlerAlgebras(Category_over_base_ring): r""" The category of graded algebras satisfying the Kähler package. @@ -134,7 +134,7 @@ def lefschetz_element(self): def hodge_riemann_relations(self, k): r""" - Return the quadratic form for the corresponding ``k`` + Return the quadratic form for the corresponding ``k`` (`< \frac{r}{2}`) for the Kähler algebra, where `r` is the top degree. EXAMPLES:: diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index e642e1bb475..5fea543aeb3 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -5,6 +5,15 @@ - Shriya M """ +# **************************************************************************** +# Copyright (C) 2024 Shriya M <25shriya at 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.matroids.chow_ring_ideal import ChowRingIdeal_nonaug, AugmentedChowRingIdeal_fy, AugmentedChowRingIdeal_atom_free from sage.rings.quotient_ring import QuotientRing_generic @@ -284,31 +293,6 @@ def lefschetz_element(self): 6*A01234^3, 6*A01234^3, 2*A01234^3, 2*A01234^3, 6*A01234^3, 2*A01234^3, 6*A01234^3, 6*A01234^3, 2*A01234^3, 6*A01234^3, 6*A01234^3, 6*A01234^3, -20*A01234^3], 3: [0]} - - TESTS:: - - sage: U46 = matroids.Uniform(4, 6) - sage: C = U46.chow_ring(QQ, False) - sage: w = C.lefschetz_element(); w - -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A05 - 2*A12 - 2*A13 - 2*A14 - - 2*A15 - 2*A23 - 2*A24 - 2*A25 - 2*A34 - 2*A35 - 2*A45 - 6*A012 - - 6*A013 - 6*A014 - 6*A015 - 6*A023 - 6*A024 - 6*A025 - 6*A034 - - 6*A035 - 6*A045 - 6*A123 - 6*A124 - 6*A125 - 6*A134 - 6*A135 - - 6*A145 - 6*A234 - 6*A235 - 6*A245 - 6*A345 - 30*A012345 - sage: basis_deg = {} - sage: for b in C.basis(): - ....: deg = b.homogeneous_degree() - ....: if deg not in basis_deg: - ....: basis_deg[deg] = [] - ....: basis_deg[deg].append(b) - sage: m = max(basis_deg); m - 3 - sage: len(basis_deg[1]) == len(basis_deg[2]) - True - sage: matrix([(w*b).to_vector() for b in basis_deg[1]]).rank() - 36 - sage: len(basis_deg[2]) - 36 """ w = sum(len(F) * (len(self.matroid().groundset()) - len(F)) * gen for F, gen in self.defining_ideal().flats_to_generator_dict().items()) diff --git a/src/sage/matroids/chow_ring_ideal.py b/src/sage/matroids/chow_ring_ideal.py index 625bec8d7b9..00b5592ee42 100644 --- a/src/sage/matroids/chow_ring_ideal.py +++ b/src/sage/matroids/chow_ring_ideal.py @@ -5,6 +5,15 @@ - Shriya M """ +# **************************************************************************** +# Copyright (C) 2024 Shriya M <25shriya at 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.rings.polynomial.multi_polynomial_ideal import MPolynomialIdeal from sage.matroids.utilities import cmp_elements_key From cac23787c0300f82383c472b3dfb9b5f904d25cf Mon Sep 17 00:00:00 2001 From: Shriya M <25shriya@gmail.com> Date: Thu, 9 Jan 2025 11:21:58 +0530 Subject: [PATCH 42/42] Edited doctest --- src/sage/categories/kahler_algebras.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index cda0ce871a9..d8791ae78fb 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -64,6 +64,8 @@ class KahlerAlgebras(Category_over_base_ring): TESTS:: + sage: from sage.categories.kahler_algebras import KahlerAlgebras + sage: C = KahlerAlgebras(QQ) sage: TestSuite(C).run() """