Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
The package has been updated to work with version 8.7 of Sage.
Browse files Browse the repository at this point in the history
A DeprecationWarning: is_RingHomomorphism() has been fixed.
(see http://trac.sagemath.org/23204 for details) and the code
has been updated at severak other places (see diff for details).

Thanks to Frédéric Chapoton for his help on this commit!
  • Loading branch information
sorger-c committed May 4, 2020
1 parent 48d6a43 commit a58edec
Show file tree
Hide file tree
Showing 16 changed files with 144 additions and 204 deletions.
18 changes: 9 additions & 9 deletions src/sage/schemes/chow/all.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# code exports
from __future__ import absolute_import

from ring import ChowRing, is_chowRing, PointChowRing
from scheme import ChowScheme, is_chowScheme, PointChowScheme
from finite_ring_extension import FiniteRingExtension
from sheaf import SHom, SEnd, Sheaf, is_sheaf
from bundle import Bundle, TrivialBundle, is_bundle
from blowup import Blowup
from morphism import is_chowSchemeMorphism
from library.all import *

from .ring import ChowRing, is_chowRing, PointChowRing
from .scheme import ChowScheme, is_chowScheme, PointChowScheme
from .finite_ring_extension import FiniteRingExtension
from .sheaf import SHom, SEnd, Sheaf, is_sheaf
from .bundle import Bundle, TrivialBundle, is_bundle
from .blowup import Blowup
from .morphism import is_chowSchemeMorphism
from .library.all import *
24 changes: 12 additions & 12 deletions src/sage/schemes/chow/blowup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
sage: P5.<k> = Proj(5, 'k')
sage: f = P2.hom([2*h], P5)
sage: g = Blowup(f)
sage: TestSuite(g).run(skip=["_test_category","_test_pickling"])
AUTHORS:
Expand All @@ -98,8 +99,7 @@

from sage.all import QQ
from sage.rings.polynomial.term_order import TermOrder
# noinspection PyUnresolvedReferences
from sage.matrix.all import matrix
from sage.matrix.constructor import matrix
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.schemes.chow.finite_ring_extension import FiniteRingExtension
from sage.schemes.chow.library.proj import ProjBundle
Expand Down Expand Up @@ -136,7 +136,7 @@ class Blowup(ChowSchemeMorphism):
def __init__(self, f, var_name='e', proj_var_name='z', verbose=False,
domain_name=None, codomain_name=None,
latex_domain_name=None, latex_codomain_name=None):
"""
r"""
Construct the class `:class:Blowup`.
INPUT:
Expand Down Expand Up @@ -203,7 +203,7 @@ def __init__(self, f, var_name='e', proj_var_name='z', verbose=False,

# Get the finite ring extension associated to Hf: HY --> HX
if verbose:
print "Computing finite ring extension for Hf: HY --> HX..."
print("Computing finite ring extension for Hf: HY --> HX...")

A_f = FiniteRingExtension(Hf, var_name=var_name)

Expand All @@ -212,7 +212,7 @@ def __init__(self, f, var_name='e', proj_var_name='z', verbose=False,
#######################################################################

if verbose:
print "Computing Exceptional locus..."
print("Computing Exceptional locus...")
# Get the normal bundle N_{X/Y} from the exact sequence:
# 0 --> TX --> f^*(TY) --> N_{X/Y} --> 0
TX, TY = X.tangent_bundle(), Y.tangent_bundle()
Expand All @@ -232,7 +232,7 @@ def __init__(self, f, var_name='e', proj_var_name='z', verbose=False,
# viewed as HY-module under Hf.

if verbose:
print "Computing Blowup..."
print("Computing Blowup...")
vnms = A_f.nvs() + Y.variable_names() # Strings
mds1 = tuple(d + 1 for d in A_f.mds()) # Add 1 to the module degrees
degs = mds1 + Y.degs()
Expand All @@ -253,13 +253,13 @@ def __init__(self, f, var_name='e', proj_var_name='z', verbose=False,
rels = rels + R.ideal(new_rels)

# 3) Add module relations of HX as HY module (eg presentation matrix)
mod_matrix = T * A_f.prm().apply_map(lambda xx: R(xx))
mod_matrix = T * A_f.prm().apply_map(lambda t: R(t))
new_rels = mod_matrix.list()
rels = rels + R.ideal(new_rels)

# 4) Multiplicative relations from m_i * m_j
mm = [m * n for m in A_f.mgs() for n in A_f.mgs()]
pd = A_f.push_down(mm).apply_map(lambda xx: R(xx))
pd = A_f.push_down(mm).apply_map(lambda t: R(t))
mu = matrix(s, s, (T * pd).list())
new_rels = (T.transpose() * T - last_nv * mu).list()
rels = rels + R.ideal(new_rels)
Expand All @@ -269,7 +269,7 @@ def __init__(self, f, var_name='e', proj_var_name='z', verbose=False,
z = HXX.cover_ring()(proj_var_name)
u = (z ** codim).reduce(HXX.defining_ideal())
uc = [HX(str(u.coefficient({z: d}))) for d in range(codim)]
pd = A_f.push_down(uc).apply_map(lambda xx: R(xx))
pd = A_f.push_down(uc).apply_map(lambda t: R(t))
M = matrix(codim, 1, [(- last_nv) ** d for d in range(codim)])
new_rels = (mu * pd * M - T.transpose() * (- last_nv) ** codim).list()
rels = rels + R.ideal(new_rels)
Expand All @@ -286,9 +286,9 @@ def __init__(self, f, var_name='e', proj_var_name='z', verbose=False,
top = S.dual().chern_classes()[codim - 1].lift()
top = top.reduce(HXX.defining_ideal())
topc = [HX(str(top.coefficient({z: d}))) for d in range(codim)]
pd = A_f.push_down(topc).apply_map(lambda xx: R(xx))
pd = A_f.push_down(topc).apply_map(lambda t: R(t))
JX = matrix(s, 1, f.lowerstar(list(A_f.mgs()), verbose=verbose))
JX = JX.apply_map(lambda xx: R(xx))
JX = JX.apply_map(lambda t: R(t))
new_rels = (mu * pd * M - JX).list()
rels = rels + R.ideal(new_rels)

Expand All @@ -302,7 +302,7 @@ def __init__(self, f, var_name='e', proj_var_name='z', verbose=False,
name=codomain_name, latex_name=latex_codomain_name)

if verbose:
print "Computing tangent bundle of blowup..."
print("Computing tangent bundle of blowup...")

SY = YY.hom(Y.gens(), Y)
YY = YY.base_change(SY)
Expand Down
1 change: 1 addition & 0 deletions src/sage/schemes/chow/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,5 @@ def TrivialBundle(X, r):
"""
return Bundle(X, r, [1] + [0] * min(r, X.dimension()))


PointChowScheme.sheaves["tangent"] = Bundle(PointChowScheme, 0, [1])
73 changes: 9 additions & 64 deletions src/sage/schemes/chow/finite_ring_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,17 @@
# ****************************************************************************

from sage.all import QQ

from sage.matrix.constructor import matrix
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.quotient_ring import QuotientRing_generic
from sage.rings.polynomial.term_order import TermOrder
# noinspection PyUnresolvedReferences
from sage.rings.polynomial.multi_polynomial_ring_generic import is_MPolynomialRing
from sage.schemes.chow.ring import Kernel2
# noinspection PyUnresolvedReferences
from sage.libs.singular.function import singular_function, lib as singular_lib
# noinspection PyUnresolvedReferences
from sage.matrix.all import matrix
from sage.rings.polynomial.multi_polynomial_ring_generic import \
is_MPolynomialRing

from sage.schemes.chow.ring import Kernel2


# noinspection PyCallingNonCallable
class FiniteRingExtension(QuotientRing_generic):

def __init__(self, f, var_name='z'):
Expand Down Expand Up @@ -181,9 +178,9 @@ def __init__(self, f, var_name='z'):
ff = f # A priori A, B are MPolynomial.
# Check the ring A and get the rings AA and AI:
if is_MPolynomialRing(A):
AA, AI = A, A.ideal(0)
AA = A
elif isinstance(A, QuotientRing_generic):
AA, AI = A.cover_ring(), A.defining_ideal()
AA = A.cover_ring()
ff = f.morphism_from_cover()
else:
err = "Domain is not (quotient of) Multivariate Polynomial Ring."
Expand Down Expand Up @@ -335,61 +332,9 @@ def __init__(self, f, var_name='z'):
Q = matrix(R, IX.ngens(), 1, L[1])
M = matrix(R, 1, s)
M[0, s - 1] = 1
self._prm = (P + (Q * M)).transpose().apply_map(lambda xx: A(str(xx)), A)
self._prm = (P + (Q * M)).transpose().apply_map(lambda x: A(str(x)), A)
QuotientRing_generic.__init__(self, CC, CI, c_vars)

def __iter__(self):
r"""
Return an iterator through the elements of ``self``.
Not implemented in general.
EXAMPLES::
sage: A.<y> = ChowRing('y', 1, 'y^6') # P5
sage: B.<x> = ChowRing('x', 1, 'x^3') # P2
sage: f = A.hom([2*x], B)
sage: F = FiniteRingExtension(f)
sage: sage.schemes.chow.finite_ring_extension.FiniteRingExtension.__iter__(F)
Traceback (most recent call last):
...
NotImplementedError: FiniteRingExtension does not support iteration
"""
raise NotImplementedError("FiniteRingExtension does not support iteration")

def characteristic(self):
r"""
Return the characteristic of this ring, which is the same
as the characteristic of its base ring.
EXAMPLES::
sage: A.<y> = ChowRing('y', 1, 'y^6') # P5
sage: B.<x> = ChowRing('x', 1, 'x^3') # P2
sage: f = A.hom([2*x], B)
sage: F = FiniteRingExtension(f)
sage: F.characteristic()
0
"""
return self.base_ring().characteristic()

def krull_dimension(self):
"""
Return the Krull dimension of this commutative ring.
EXAMPLES::
sage: A.<y> = ChowRing('y', 1, 'y^6') # P5
sage: B.<x> = ChowRing('x', 1, 'x^3') # P2
sage: f = A.hom([2*x], B)
sage: F = FiniteRingExtension(f)
sage: F.krull_dimension()
Traceback (most recent call last):
...
NotImplementedError
"""
raise NotImplementedError

def ann(self):
r"""
Return the annihilator `Ann_A(B)` of `B` seen as an `A`-module via `f`.
Expand Down Expand Up @@ -611,7 +556,7 @@ def push_down(self, v):
M = matrix(self, 1, s)
M[0, s - 1] = 1

return ((P + (Q * M)).transpose()).apply_map(lambda xx: self(str(xx)))
return ((P + (Q * M)).transpose()).apply_map(lambda x: self(str(x)))

def psi(self):
r"""
Expand Down
3 changes: 1 addition & 2 deletions src/sage/schemes/chow/library/grass.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from sage.schemes.chow.scheme import PointChowScheme
from sage.schemes.chow.sheaf import SHom, Sheaf
from sage.schemes.chow.scheme import ChowScheme
# noinspection PyUnresolvedReferences
from sage.rings.integer import is_Integer


Expand Down Expand Up @@ -87,7 +86,7 @@ def GrassBundle(A, B, chern_class='c', names=None, name=None, latex_name=None):
#

EZ = Bundle(Z, n, [str(c) for c in E.chern_classes()]) # p^{*}E
QZ = Bundle(Z, r, [str(1)] + new_vars) # if s==k : c_{s+1} = ... = c_{r} = 0
QZ = Bundle(Z, r, [str(1)] + new_vars) # if s==k : c_{s+1} =...= c_{r} = 0
SZ = Bundle(Z, k, (EZ - QZ).chern_classes()[0: k + 1])
QZ = Bundle(Z, r, (EZ - SZ).chern_classes()[0: r + 1]) if s == k else QZ

Expand Down
11 changes: 5 additions & 6 deletions src/sage/schemes/chow/library/proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def Proj(n, hyperplane_class='h', names=None, name=None, latex_name=None):
- ``n`` -- An integer, the dimension of the projective space.
- ``hyperplane_class`` - An (optional) name for the hyperplane class
- ``name`` -- An optional string, the name of the ChowScheme
- ``latex_name``-- An optional string, the latex representation of the
ChowScheme
- ``latex_name``-- An optional string, the latex representation of the ChowScheme
OUTPUT:
Expand All @@ -52,17 +51,17 @@ def Proj(n, hyperplane_class='h', names=None, name=None, latex_name=None):
name=name, latex_name=latex_name)


def ProjBundle(E, hyperplane_class='h', names=None, name=None, latex_name=None):
"""
def ProjBundle(E, hyperplane_class='h',
names=None, name=None, latex_name=None):
r"""
Return the *Proj* of a bundle E.
INPUT:
- ``E`` -- A sheaf on a ChowScheme
- ``hyperplane_class`` - An (optional) name for the hyperplane class
- ``name`` -- An optional string, the name of the ProjBundle
- ``latex_name``-- An optional string, the latex representation of the
ProjBundle
- ``latex_name``-- An optional string, the latex representation of the ProjBundle
OUTPUT:
Expand Down
42 changes: 24 additions & 18 deletions src/sage/schemes/chow/library/twisted_cubics.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@
The incidence variety can be obtained in a two-step process
`I_W={\mathbb P}(K_1^*)\xrightarrow{v} {\mathbb P}(W)\xrightarrow{u} S`, where
`0\to K_1\to u^*W\to L_1\to 0` is the tautological sequence on `{\mathbb P}(W)`.
`0\to K_1\to u^*W\to L_1\to 0` is the tautological sequence on
`{\mathbb P}(W)`.
This is implemented in :meth:`incidence_variety`.
Also, let `0\to K_2\to v^*K_1^*\to L_2\to 0` be the tautological sequence on
`I_W`. Since the Chow ring of `H^*(X_W)` is generated by the Chern classes of
`E` and `F`, the embedding `f:I_W\to X_W` is determined as soon as one can
identify `f^*E` and `f^*F`. According to Ellingsrud and Strømme , these bundles are
identify `f^*E` and `f^*F`. According to Ellingsrud and Strømme,
these bundles are
`f^*E= K_1\otimes L_2^*` and `f^*F=K_2\otimes L_2^*\otimes \det(K_1)`.
Finally the morphism `f` is implemented in
Expand Down Expand Up @@ -198,20 +200,19 @@ def variety_of_nets_of_quadrics(W, name=None, latex_name=None):

A_f = FiniteRingExtension(Af)
ideal_list = A_f.push_down(J).list()
I = AY.ideal([str(l) for l in ideal_list])
IRel = AY.ideal([str(l) for l in ideal_list])

# I contains the relations. Cleaning up:
# IRel contains the relations. Cleaning up:

# a) Simplify::

# noinspection PyUnresolvedReferences
from sage.libs.singular.function import singular_function
simplify = singular_function('simplify')

to = TermOrder('wdegrevlex', tuple([1, 2, 3, 1, 2] + S_degs))
C = PolynomialRing(QQ, 5 + S.ngens(),
names=['e1', 'e2', 'e3', 'f1', 'f2'] + S_vars, order=to)
CI = C.ideal([str(x) for x in I.gens()])
CI = C.ideal([str(x) for x in IRel.gens()])
CI = simplify(CI, 15, ring=C)

# b) e1 = f1::
Expand Down Expand Up @@ -307,17 +308,17 @@ def incidence_variety(W, name=None, latex_name=None):
K1 = PW.sheaves["universal_sub"]
L1 = PW.sheaves["universal_quotient"]

I = ProjBundle(K1.dual(), 'x', name=name, latex_name=latex_name)
v = I.base_morphism()
I.sheaves["K1"] = v.upperstar(K1)
I.sheaves["L1"] = v.upperstar(L1)
IV = ProjBundle(K1.dual(), 'x', name=name, latex_name=latex_name)
v = IV.base_morphism()
IV.sheaves["K1"] = v.upperstar(K1)
IV.sheaves["L1"] = v.upperstar(L1)

w = u * v
I = I.base_change(w)
I.sheaves["K2"] = I.sheaves["universal_sub"]
I.sheaves["L2"] = I.sheaves["universal_quotient"]
IV = IV.base_change(w)
IV.sheaves["K2"] = IV.sheaves["universal_sub"]
IV.sheaves["L2"] = IV.sheaves["universal_quotient"]

return I
return IV


def map_incidence_to_nets_of_quadrics(W, domain_name=None, codomain_name=None,
Expand All @@ -334,14 +335,19 @@ def map_incidence_to_nets_of_quadrics(W, domain_name=None, codomain_name=None,
sage: f = map_incidence_to_nets_of_quadrics(W)
"""
S = W.chowscheme()
I = incidence_variety(W, name=domain_name, latex_name=latex_domain_name)
IE = I.sheaves["K1"] * I.sheaves["L2"].dual()
IF = I.sheaves["K2"] * I.sheaves["L2"].dual() * I.sheaves["K1"].determinant()

IV = incidence_variety(W, name=domain_name, latex_name=latex_domain_name)
IV_K1 = IV.sheaves["K1"]
IV_K2 = IV.sheaves["K2"]
IV_L2 = IV.sheaves["L2"]

IE = IV_K1 * IV_L2.dual()
IF = IV_K2 * IV_L2.dual() * IV_K1.determinant()
X = variety_of_nets_of_quadrics(W, name=codomain_name,
latex_name=latex_codomain_name)
ie1 = IE.chern_classes()[1]
ie2 = IE.chern_classes()[2]
ie3 = IE.chern_classes()[3]
if2 = IF.chern_classes()[2]
f = I.hom([ie1, ie2, ie3, if2] + list(S.gens()), X)
f = IV.hom([ie1, ie2, ie3, if2] + list(S.gens()), X)
return f
Loading

0 comments on commit a58edec

Please sign in to comment.