oscar-system / Oscar.jl

A comprehensive open source computer algebra system for computations in algebra, geometry, and number theory.
https://www.oscar-system.org
Other
344 stars 126 forks source link

Localisation issue for computation of `covered_scheme_morphism` #2538

Open StevellM opened 1 year ago

StevellM commented 1 year ago

Describe the bug While trying to obtain the covered scheme morphism of the identity map of a projective scheme, I got a "localization at 0 error"

julia> covered_scheme_morphism(f)
ERROR: can not localize at the zero element
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] MPolyPowersOfElement(R::QQMPolyRing, a::Vector{QQMPolyRingElem})
    @ Oscar ~/.julia/dev/Oscar/src/Rings/mpoly-localizations.jl:65
  [3] hypersurface_complement(X::Spec{QQField, MPolyQuoRing{QQMPolyRingElem}}, f::Vector{MPolyQuoRingElem{QQMPolyRingElem}})
    @ Oscar ~/.julia/dev/Oscar/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Constructors.jl:451
  [4] PrincipalOpenSubset(X::Spec{QQField, MPolyQuoRing{QQMPolyRingElem}}, f::MPolyQuoRingElem{QQMPolyRingElem})
    @ Oscar ~/.julia/dev/Oscar/src/AlgebraicGeometry/Schemes/PrincipalOpenSubset/Objects/Types.jl:13
  [5] __compute_covered_scheme_morphism__(f::ProjectiveSchemeMor{ProjectiveVariety{QQField, MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}}, ProjectiveVariety{QQField, MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}}, Oscar.MPolyAnyMap{MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}, MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}, Nothing, MPolyQuoRingElem{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}}, Nothing})
    @ Oscar ~/.julia/dev/Oscar/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Morphisms/Methods.jl:44
  [6] #3424
    @ ~/.julia/packages/AbstractAlgebra/YkCOC/src/Attributes.jl:357 [inlined]
  [7] get!(default::Oscar.var"#3424#3427"{ProjectiveSchemeMor{ProjectiveVariety{QQField, MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}}, ProjectiveVariety{QQField, MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}}, Oscar.MPolyAnyMap{MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}, MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}, Nothing, MPolyQuoRingElem{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}}, Nothing}}, h::Dict{Symbol, Any}, key::Symbol)
    @ Base ./dict.jl:464
  [8] get_attribute!
    @ ~/.julia/packages/AbstractAlgebra/YkCOC/src/Attributes.jl:230 [inlined]
  [9] covered_scheme_morphism(f::ProjectiveSchemeMor{ProjectiveVariety{QQField, MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}}, ProjectiveVariety{QQField, MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}}, Oscar.MPolyAnyMap{MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}, MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}, Nothing, MPolyQuoRingElem{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}}, Nothing})
    @ Oscar ~/.julia/dev/Oscar/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Morphisms/Methods.jl:25
 [10] top-level scope
    @ REPL[122]:1

To Reproduce Steps to reproduce the behavior, please provide a code snippet that triggers the bug.

using Oscar
P, x = polynomial_ring(QQ,3);
S, y = grade(P);
Y = variety(ideal(y[1:2]));
f = identity_map(Y);
covered_scheme_morphism(f)

Expected behavior It should not return an error, at least I would expect the algorithm to describe the map on some affine patches.

System (please complete the following information):

julia> Oscar.versioninfo(full=true)
OSCAR version 0.13.0-DEV
  combining:
    AbstractAlgebra.jl   v0.30.9
    GAP.jl               v0.9.7
    Hecke.jl             v0.18.16
    Nemo.jl              v0.34.7
    Polymake.jl          v0.10.0
    Singular.jl          v0.18.8
  building on:
    Antic_jll               v0.201.500+0
    Arb_jll                 v200.2300.0+0
    Calcium_jll             v0.401.100+0
    FLINT_jll               v200.900.6+0
    GAP_jll                 v400.1200.200+5
    Singular_jll            v403.203.202+0
    libpolymake_julia_jll   v0.10.2+0
    libsingular_julia_jll   v0.35.0+0
    polymake_jll            v400.1000.1+0
See `]st -m` for a full list of dependencies.

Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Official https://julialang.org/ release
afkafkafk13 commented 1 year ago

@HechtiDerLachs
At first glance, I would suspect that covered_scheme_morphism lacks a guard against charts being the empty set.

HechtiDerLachs commented 1 year ago

I have to admit: I became aware of this problem by the end of last week already and made a first attempt to fix it. It turned out to be a rather lengthy, tedious undertaking. But now there is no way around it, really.

Indeed, we need to allow for recognition and discarding empty charts.

fingolfin commented 1 year ago

We just discussed this; @HechtiDerLachs knows what the problem is, it is just nasty to fix, and right now there are other priorities (The BOOK (tm))