-
Notifications
You must be signed in to change notification settings - Fork 120
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
[ToricVarieties] Enhance blow_up method #2741
[ToricVarieties] Enhance blow_up method #2741
Conversation
67d5621
to
304eecf
Compare
src/AlgebraicGeometry/ToricVarieties/ToricSchemes/attributes.jl
Outdated
Show resolved
Hide resolved
304eecf
to
b2529a8
Compare
b2529a8
to
e07e5e3
Compare
Working on it. |
44961e3
to
a3283af
Compare
a3283af
to
531fc5d
Compare
05e7b80
to
c6e0faf
Compare
@lkastner This is the next "round" of toric schemes and their applications in the FTheoryTools. In this PR, @HechtiDerLachs and I extend the existing Once the tests complete, this is - as I see it - ready for review. |
So far, it doesn't seem to be our fault, that the tests fail. One is due to singular conversion of finite fields and the other is due to some doctest in the GIT fans. @jankoboehm : Do you maybe see what's going on? |
c6e0faf
to
08e6c8b
Compare
At least one failure happened because of me - I wrote |
It seems that now all required tests pass but the doctest (cf. https://github.com/oscar-system/Oscar.jl/actions/runs/6027670947/job/16353354055?pr=2741). I am not sure (yet) why the latter failed... |
There is a whitespace difference in the output here: https://github.com/oscar-system/Oscar.jl/actions/runs/6027670947/job/16353354443?pr=2741#step:8:2020
Unfortunately that error block is now somewhat hard to find due to the extra output. I did not expect the doctests to continue running when encountering an error... |
08e6c8b
to
0a9bc7d
Compare
Thank you. Fixed and just updated the code. For my curiosity: How did you find this? I looked at the log from top to bottom but did not spot this. Did I just overlook it? |
I searched for failure in the box on the top right (with the corresponding log block expanded). |
Codecov Report
@@ Coverage Diff @@
## master #2741 +/- ##
==========================================
+ Coverage 73.33% 73.43% +0.09%
==========================================
Files 451 451
Lines 64167 64240 +73
==========================================
+ Hits 47058 47175 +117
+ Misses 17109 17065 -44 |
@HechtiDerLachs, based on our conversations in slack, I now take the liberty to mark this as ready for review. Please correct me if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is moving a bit too fast for me to keep up with. There is already a lot to unpack below the mathematical level. Try to add more tests for boundary cases.
experimental/Schemes/IdealSheaves.jl
Outdated
for (k, U) in enumerate(affine_charts(X)) | ||
|
||
# We first create the morphism Φₛ* from p. 224, l. 3. | ||
indices = [j for j in 1:nrays(X) if ray_indices(maximal_cones(X))[k,j]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is again an abuse of IncidenceMatrix
.
julia> nf = normal_fan(cube(2))
Polyhedral fan in ambient dimension 2
julia> IM = maximal_cones(IncidenceMatrix, nf)
4×4 IncidenceMatrix
[1, 3]
[2, 3]
[1, 4]
[2, 4]
julia> row(IM, 1)
Set{Int64} with 2 elements:
3
1
julia> 1 in row(IM, 1)
true
julia> 2 in row(IM, 1)
false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for this abuse. I of course read your example and adjusted the code a bit. But I am not sure if I did grasp the full scale of how this can be optimized with your proposal. Please have a look at 730c7e0 and let me know what you think.
experimental/Schemes/IdealSheaves.jl
Outdated
|
||
# Now we need to create the inverse of α*. | ||
imgs_alpha_star = elem_type(help_ring)[] | ||
for m in hilbert_basis(dual_cone(U)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there something called dual_cone
? It was agreed upon that the function taking cones to their (polar) dual is called polarize
. But this function cannot even be applied to cones, only to affine normal toric varieties. So it is even worse, it will confuse users who only want to dualize a polyhedral cone and users having an affine normal toric variety will not know that this might be the function they are looking for.
There are better names that one can choose, please have a look in CLS. In polymake we called this the WEIGHT_CONE
, but also something like semigroup_cone
or character_cone
could probably work. dual_cone
is definitely not ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My recollection is a bit vague - I believe this dates back probably half a year or even longer, when we first prototyped the toric schemes. The ideas did not really go very deep, but focused on organizing the code with some helper functions. Nothing more than that. This is I think why this exists in the first place.
Certainly, I am more than happy to rename it. Based on what you are saying, maybe it would be best to align it with the polymake name, i.e. weight_cone
. Let me prepare that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposal is here 0f159c6. What do you think?
experimental/Schemes/IdealSheaves.jl
Outdated
|
||
# Now we need to create the inverse of α*. | ||
imgs_alpha_star = elem_type(help_ring)[] | ||
for m in hilbert_basis(dual_cone(U)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if this cone has lineality?
julia> c = positive_hull([1 0; -1 0])
Polyhedral cone in ambient dimension 2
julia> hilbert_basis(c)
ERROR: ArgumentError: Cone not pointed
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/Hecke/xt25Z/src/Assertions.jl:564 [inlined]
[2] hilbert_basis(C::Cone{QQFieldElem})
@ Oscar ~/oscars/master/src/PolyhedralGeometry/Cone/properties.jl:529
[3] top-level scope
@ REPL[14]:1
I think you probably also want to require at least isfulldimensional
and maybe also ispointed
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the pointers. Proposal for resolution is here: 0cc754c
experimental/Schemes/IdealSheaves.jl
Outdated
function _generic_blow_up(v::Any, I::Any) | ||
error("Not yet supported") | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function _generic_blow_up(v::Any, I::Any) | |
error("Not yet supported") | |
end |
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code on ideal sheaves is still experimental, while the blow_up
function in the toric varieties is in src
.
I understand that there was a rule "src
must never call experimental
" or similar. I discussed this with @fingolfin yesterday, and he proposed this work-around. It ensure that even if you disabled all experimental
code, the toric varieties code would still run except for raising the error "Not yet supported" exactly where the call into experimental
would have happened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. If this wasn't here you would also get an error, right? Also this function is in experimental
, so it would be disabled too if experimental
is gone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also noticed this and adjusted it. Let me push the changes that I have by now. One sec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I did it correctly, then this function should now be in standard_constructions.jl
, right below the blow_up
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And yes, if this function was not there, we would also get an error ("something undefined" or alike). Maybe the "Not yet supported" error is better? Maybe not? Maybe the error message could be adjusted...
As per usual - I am happy to hear other/better alternatives. :)
experimental/Schemes/IdealSheaves.jl
Outdated
# We need to dehomogenize the ideal I ⊂ S = ℂ[xᵨ| ρ ∈ Σ(1)] to the local | ||
# charts Uₛ, s ⊂ Σ a cone. To this end we use Proposition 5.2.10 from | ||
# Cox-Little-Schenck, p. 223ff. Abstractly, the chart | ||
# Uₛ is isomorphic to ℂˢ⁽¹⁾ = Spec(ℂ[xᵨ | ρ ∈ s(1)]). But these are | ||
# not the coordinates we use for the affine charts here. They | ||
# correspond to the `hilbert_basis(dual_cone(U_s))`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.oscar-system.org/dev/DeveloperDocumentation/styleguide/
the use of Unicode should be kept to a minimum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me modify this... (cc @HechtiDerLachs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am rebasing to work in those changes and will push shortly. Please inspect again and let me know if this is better.
My understanding is that @HechtiDerLachs uses Unicode for the documentation and comments in the schemes code. Certainly, I have only touched the lines about the ideal sheaves added in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.oscar-system.org/dev/DeveloperDocumentation/styleguide/
the use of Unicode should be kept to a minimum.
I'm using the notation from the book and tried to stick as close to it as possible so people do not have to go through the hustle to write down a dictionary to translate the comment to the setup of CLS. I think this is a justified use of unicode.
experimental/Schemes/IdealSheaves.jl
Outdated
julia> IdealSheaf(P3, I) | ||
Sheaf of ideals | ||
on scheme over QQ covered with 4 patches | ||
1: [x_1_1, x_2_1, x_3_1] normal, affine toric variety | ||
2: [x_1_2, x_2_2, x_3_2] normal, affine toric variety | ||
3: [x_1_3, x_2_3, x_3_3] normal, affine toric variety | ||
4: [x_1_4, x_2_4, x_3_4] normal, affine toric variety | ||
with restrictions | ||
1: ideal(x_2_1, x_3_1) | ||
2: ideal(x_2_2, x_3_2) | ||
3: ideal(1, x_3_3) | ||
4: ideal(x_2_4, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this output is sustainable for larger examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let me simply suppressed the output for now:
julia> IdealSheaf(P3, I);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this output is sustainable for larger examples.
This has been thought through by @simonbrandhorst and thoroughly worked out by @StevellM . If you have doubts about this, we can contact them, but let's not open this discussion on this pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an object is complicated, it may take much space to print. If the output is too large, one can still use a semicolon to suppress it or ask for compact printing.
julia> b2P3 = blow_up(P3, I2) | ||
Blow up | ||
of scheme over QQ covered with 4 patches | ||
1b: [x_1_1, x_2_1, x_3_1] normal, affine toric variety | ||
2b: [x_1_2, x_2_2, x_3_2] normal, affine toric variety | ||
3b: [x_1_3, x_2_3, x_3_3] normal, affine toric variety | ||
4b: [x_1_4, x_2_4, x_3_4] normal, affine toric variety | ||
in sheaf of ideals with restrictions | ||
1b: ideal(x_2_1*x_3_1) | ||
2b: ideal(x_2_2*x_3_2) | ||
3b: ideal(x_3_3) | ||
4b: ideal(x_2_4) | ||
with domain | ||
scheme over QQ covered with 4 patches | ||
1a: [x_1_1, x_2_1, x_3_1] spec of quotient of multivariate polynomial ring | ||
2a: [x_1_2, x_2_2, x_3_2] spec of quotient of multivariate polynomial ring | ||
3a: [x_1_3, x_2_3, x_3_3] spec of quotient of multivariate polynomial ring | ||
4a: [x_1_4, x_2_4, x_3_4] spec of quotient of multivariate polynomial ring | ||
and exceptional divisor | ||
effective cartier divisor defined by | ||
sheaf of ideals with restrictions | ||
1a: ideal(x_2_1*x_3_1) | ||
2a: ideal(x_2_2*x_3_2) | ||
3a: ideal(x_3_3) | ||
4a: ideal(x_2_4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This escalated quickly...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the following is better?
julia> b2P3 = blow_up(P3, I2);
julia> codomain(b2P3) == P3
true
for U in affine_charts(X) | ||
for V in affine_charts(X) | ||
glue = default_covering(X)[U, V] | ||
new_glue = restrict(glue, inverse(iso_dict[U]), inverse(iso_dict[V]), check=true) | ||
add_glueing!(cov, new_glue) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the pointer. Adjusted to
for U in affine_charts(X), V in affine_charts(X)
...
end
I tried also
for U,V in affine_charts(X)
...
end
But this errored with "invalid iteration specification".
src/AlgebraicGeometry/ToricVarieties/NormalToricVarieties/standard_constructions.jl
Outdated
Show resolved
Hide resolved
f229bab
to
e08fe6f
Compare
…ic variety Co-authored-by: Martin Bies <MBies87@googlemail.com>
Co-authored-by: Benjamin Lorenz <benlorenz@users.noreply.github.com>
Co-authored-by: Lars Kastner <lkastner@users.noreply.github.com>
Co-authored-by: Lars Kastner <lkastner@users.noreply.github.com>
730c7e0
to
75bfdaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still wonder what the use case for the forget_*
function is. It is a very technical thing and I do not think that users should worry about such a thing. Furthermore I see it more as a constructor, in the same way one can call polyhedral_fan
on a toric variety, I would think the name covered_scheme(*)
or something similar would be better suited.
Thank you for the review @lkastner ! I understand that |
Thank you for the review @lkastner and approving this complicated PR. Regarding Long story short: No use case just yet. However, hopefully soon to be used as inspiration for further developments. Based on the approval, I assume we can live with this for now. However, should this becomes relevant on a larger scale (i.e. implementing forgetful functors throughout OSCAR), then we can discuss again, adjust the name etc. As per usual, I am happy to adjust the name etc. |
@HereAround : Can you take it from here?