Skip to content

Introduce FanoToricVariety_field as a Common Base Class for Gorenstein Fano Toric Varieties #40416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wrap up the work introducing the superclass of general fano toric
  • Loading branch information
local-ring committed Jul 15, 2025
commit f03bdda72de19d8d08414a5cfe39254643b9abcd
88 changes: 65 additions & 23 deletions src/sage/schemes/toric/fano_variety.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
AL: add base class of (Gorenstein) Fano varieties, which serve as the superclass for both CPR-Fano and smooth Fano varieties.
"""

def FanoToricVariety(Delta=None,

Check failure on line 154 in src/sage/schemes/toric/fano_variety.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (E302)

src/sage/schemes/toric/fano_variety.py:154:1: E302 Expected 2 blank lines, found 1
Delta_polar=None,
coordinate_names=None,
names=None,
Expand Down Expand Up @@ -252,7 +252,7 @@
Delta_polar = Delta.polar()
if check and not Delta_polar.is_reflexive():
raise ValueError("Delta_polar must be reflexive")

Check failure on line 255 in src/sage/schemes/toric/fano_variety.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (W293)

src/sage/schemes/toric/fano_variety.py:255:1: W293 Blank line contains whitespace
# AL: construct the fan fromt the original polytope without worrying about the refinement
fan = FaceFan(Delta_polar)

Expand Down Expand Up @@ -324,15 +324,15 @@
sage: P1xP1 = FanoToricVariety(
....: Delta_polar=lattice_polytope.cross_polytope(2))
sage: P1xP1
2-d CPR-Fano toric variety covered by 4 affine patches
2-d Fano toric variety covered by 4 affine patches
"""
self._Delta_polar = Delta_polar
# AL: we want to use the anticanonical surface and nef complete intersection functions for general Fano toric varieties
self._coordinate_points = tuple(range(fan.rays()))
self._coordinate_points = tuple(range(len(fan.rays())))
self._point_to_ray = {i: i for i in self._coordinate_points}
super().__init__(fan, coordinate_names,
coordinate_name_indices, base_field)

Check failure on line 335 in src/sage/schemes/toric/fano_variety.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (W293)

src/sage/schemes/toric/fano_variety.py:335:1: W293 Blank line contains whitespace
def _latex_(self):
r"""
Return a LaTeX representation of ``self``.
Expand All @@ -355,7 +355,8 @@

TESTS::

sage: P1xP1 = toric_varieties.P1xP1()
sage: P1xP1 = FanoToricVariety(
....: Delta_polar=lattice_polytope.cross_polytope(2))
sage: print(P1xP1._repr_())
2-d Fano toric variety covered by 4 affine patches
"""
Expand Down Expand Up @@ -428,7 +429,7 @@
a0*z0^3 + a9*z0^2*z1 + a7*z0*z1^2 + a1*z1^3 + a8*z0^2*z2 + a6*z0*z1*z2
+ a4*z1^2*z2 + a5*z0*z2^2 + a3*z1*z2^2 + a2*z2^3
"""
# AL: we include this function because the construction only rely on the Delta and cox variables

Check failure on line 432 in src/sage/schemes/toric/fano_variety.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (W291)

src/sage/schemes/toric/fano_variety.py:432:106: W291 Trailing whitespace
# and the anticanonical hypersurface is important for Fano varieties
return AnticanonicalHypersurface(self, **kwds)

Expand Down Expand Up @@ -480,7 +481,42 @@
else:
return FanoToricVariety_field(self._Delta_polar, self._fan,
self.variable_names(), None, F)

Check failure on line 484 in src/sage/schemes/toric/fano_variety.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (W293)

src/sage/schemes/toric/fano_variety.py:484:1: W293 Blank line contains whitespace
def coordinate_point_to_coordinate(self, point):
r"""
Return the coordinate of the point in the coordinate ring of ``self``.

INPUT:

- ``point`` -- integer, index of a coordinate point of ``self``
(see :meth:`coordinate_points`)

OUTPUT: :class:`sage.rings.polynomial.polynomial_element.Polynomial_generic`

EXAMPLES::

sage: P1xP1 = FanoToricVariety(Delta_polar=lattice_polytope.cross_polytope(2))
sage: P1xP1.coordinate_point_to_coordinate(0)
z0
sage: P1xP1.coordinate_point_to_coordinate(3)
z3
"""
return self.gen(self._point_to_ray[point])

Check failure on line 505 in src/sage/schemes/toric/fano_variety.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (W293)

src/sage/schemes/toric/fano_variety.py:505:1: W293 Blank line contains whitespace
def coordinate_points(self):
r"""
Return the list of indices of coordinate points of ``self``.

OUTPUT: list of integers

EXAMPLES::

sage: P1xP1 = FanoToricVariety(Delta_polar=lattice_polytope.cross_polytope(2))
sage: P1xP1.coordinate_points()
(0, 1, 2, 3)
"""
return self._coordinate_points

Check failure on line 519 in src/sage/schemes/toric/fano_variety.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (W293)

src/sage/schemes/toric/fano_variety.py:519:1: W293 Blank line contains whitespace
def Delta(self):
r"""
Return the reflexive polytope associated to ``self``.
Expand Down Expand Up @@ -589,9 +625,9 @@
``self`` (with the extended base field, if necessary).
"""
return NefCompleteIntersection(self, nef_partition, **kwds)

Check failure on line 628 in src/sage/schemes/toric/fano_variety.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (W293)

src/sage/schemes/toric/fano_variety.py:628:1: W293 Blank line contains whitespace

def cartesian_product(self, other,

Check failure on line 630 in src/sage/schemes/toric/fano_variety.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (E303)

src/sage/schemes/toric/fano_variety.py:630:5: E303 Too many blank lines (2)
coordinate_names=None, coordinate_indices=None):
r"""
Return the Cartesian product of ``self`` with ``other``.
Expand All @@ -618,16 +654,21 @@

EXAMPLES::

sage: P1 = toric_varieties.P1()
sage: P2 = toric_varieties.P2()
sage: P1_poly = lattice_polytope.cross_polytope(1)
sage: P2_simplex = LatticePolytope([(1,0), (0,1), (-1,-1)])
sage: P1 = FanoToricVariety(Delta=P1_poly)
sage: P2 = FanoToricVariety(Delta_polar=P2_simplex)
sage: P1xP2 = P1.cartesian_product(P2); P1xP2
3-d Fano toric variety covered by 6 affine patches
sage: P1xP2.fan().rays()
N+N( 1, 0, 0), N+N(-1, 0, 0), N+N( 0, 1, 0),
N+N( 0, 0, 1), N+N( 0, -1, -1)
in 3-d lattice N+N
N+M(-1, 0, 0),
N+M( 1, 0, 0),
N+M( 0, 1, 0),
N+M( 0, 0, 1),
N+M( 0, -1, -1)
in 3-d lattice N+M
sage: P1xP2.Delta_polar()
3-d reflexive polytope in 3-d lattice N+N
3-d reflexive polytope in 3-d lattice N+M
"""
if isinstance(other, FanoToricVariety_field) and not isinstance(other, CPRFanoToricVariety_field):
# and not isinstance(other, SmoothFanoToricVariety_field): we will include this in the future if necessary
Expand All @@ -640,7 +681,7 @@



def is_CPRFanoToricVariety(x):

Check failure on line 684 in src/sage/schemes/toric/fano_variety.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (E303)

src/sage/schemes/toric/fano_variety.py:684:1: E303 Too many blank lines (3)
r"""
Check if ``x`` is a CPR-Fano toric variety.

Expand Down Expand Up @@ -1149,13 +1190,14 @@
2-d CPR-Fano toric variety covered by 4 affine patches
"""
self._Delta_polar = Delta_polar
self._coordinate_points = tuple(coordinate_points)
self._point_to_ray = point_to_ray
# Check/normalize coordinate_indices
if coordinate_name_indices is None:
coordinate_name_indices = coordinate_points
super().__init__(Delta_polar, fan, coordinate_names,
coordinate_name_indices, base_field)
# AL: we add the trivial attributes for the general case, so we need to update after super().__init__
self._coordinate_points = tuple(coordinate_points)
self._point_to_ray = point_to_ray

def _latex_(self):
r"""
Expand Down Expand Up @@ -1767,12 +1809,13 @@

EXAMPLES::

sage: P1xP1 = toric_varieties.P1xP1()
sage: diamond = lattice_polytope.cross_polytope(2)
sage: P1xP1 = FanoToricVariety(Delta_polar=diamond)
sage: import sage.schemes.toric.fano_variety as ftv
sage: ftv.AnticanonicalHypersurface(P1xP1)
Closed subscheme of 2-d Fano toric variety
covered by 4 affine patches defined by:
a0*s^2*x^2 + a3*t^2*x^2 + a6*s*t*x*y + a1*s^2*y^2 + a2*t^2*y^2
Closed subscheme of 2-d Fano toric variety covered by 4 affine patches defined by:
a0*z0^2*z1^2 + a3*z1^2*z2^2 + a6*z0*z1*z2*z3 + a1*z0^2*z3^2 + a2*z2^2*z3^2


See :meth:`~FanoToricVariety_field.anticanonical_hypersurface()` for a
more elaborate example.
Expand All @@ -1785,23 +1828,22 @@

TESTS::

sage: P1xP1 = toric_varieties.P1xP1()
sage: diamond = lattice_polytope.cross_polytope(2)
sage: P1xP1 = FanoToricVariety(Delta_polar=diamond)
sage: import sage.schemes.toric.fano_variety as ftv
sage: ftv.AnticanonicalHypersurface(P1xP1)
Closed subscheme of 2-d Fano toric variety
covered by 4 affine patches defined by:
a0*s^2*x^2 + a3*t^2*x^2 + a6*s*t*x*y + a1*s^2*y^2 + a2*t^2*y^2
Closed subscheme of 2-d Fano toric variety covered by 4 affine patches defined by:
a0*z0^2*z1^2 + a3*z1^2*z2^2 + a6*z0*z1*z2*z3 + a1*z0^2*z3^2 + a2*z2^2*z3^2

Check that finite fields are handled correctly :issue:`14899`::

sage: F = GF(5^2, "a") # needs sage.rings.finite_rings
sage: X = P1xP1.change_ring(F) # needs sage.rings.finite_rings
sage: X.anticanonical_hypersurface(monomial_points='all', # needs sage.rings.finite_rings
....: coefficients=[1]*X.Delta().npoints())
Closed subscheme of 2-d Fano toric variety
covered by 4 affine patches defined by:
s^2*x^2 + s*t*x^2 + t^2*x^2 + s^2*x*y + s*t*x*y
+ t^2*x*y + s^2*y^2 + s*t*y^2 + t^2*y^2
Closed subscheme of 2-d Fano toric variety covered by 4 affine patches defined by:
z0^2*z1^2 + z0*z1^2*z2 + z1^2*z2^2 + z0^2*z1*z3 + z0*z1*z2*z3 + z1*z2^2*z3 + z0^2*z3^2 + z0*z2*z3^2 + z2^2*z3^2

"""
if not isinstance(P_Delta, FanoToricVariety_field):
raise TypeError("anticanonical hypersurfaces can only be "
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy