Skip to content
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

Primary decomposition rerouting #3091

Merged

Conversation

HechtiDerLachs
Copy link
Collaborator

A prototype for what @afkafkafk13 suggested and @wdecker requested in #3083 .

@thofma
Copy link
Collaborator

thofma commented Dec 8, 2023

Why do you reroute nf_elem? Doesn't Singular automatically do something useful if you have a simple extension over Q or k?

@thofma
Copy link
Collaborator

thofma commented Dec 8, 2023

I am not a big fan of the name _flatten_ring, because we already have flatten. Maybe we can find a more descriptive name.

@afkafkafk13
Copy link
Collaborator

Why do you reroute nf_elem? Doesn't Singular automatically do something useful if you have a simple extension over Q or k?

Yes and no. In general (in particular in the groebner bases context), it does.
But in the primary decomposition context, it is more desirable to go down all the way to QQ or k for internal reasons.

Copy link

codecov bot commented Dec 8, 2023

Codecov Report

Merging #3091 (39f8c4c) into master (503d48c) will increase coverage by 0.04%.
Report is 4 commits behind head on master.
The diff coverage is 91.88%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3091      +/-   ##
==========================================
+ Coverage   80.51%   80.55%   +0.04%     
==========================================
  Files         524      525       +1     
  Lines       70408    70635     +227     
==========================================
+ Hits        56689    56901     +212     
- Misses      13719    13734      +15     
Files Coverage Δ
...erimental/Schemes/MorphismFromRationalFunctions.jl 40.87% <ø> (+0.09%) ⬆️
src/Rings/MPolyMap/MPolyAnyMap.jl 94.28% <100.00%> (+0.28%) ⬆️
src/Rings/mpoly-ideals.jl 94.43% <100.00%> (+1.41%) ⬆️
src/Rings/mpolyquo-localizations.jl 74.59% <81.81%> (+<0.01%) ⬆️
src/Rings/primary_decomposition_helpers.jl 87.31% <87.31%> (ø)

... and 3 files with indirect coverage changes

@HechtiDerLachs
Copy link
Collaborator Author

@ederc : There seems to be some hickup with algebraic solving in the tests here. I suppose it does not have to do with my changes. Do you agree?

@HechtiDerLachs
Copy link
Collaborator Author

I am not a big fan of the name _flatten_ring, because we already have flatten. Maybe we can find a more descriptive name.

Agreed. We will figure it out next week.

@thofma
Copy link
Collaborator

thofma commented Dec 9, 2023

Since you will have to touch the code anyway, maybe you could also add some documentation in form of a comment (just the general idea, maybe at the top of src/Rings/primary_decomposition_helpers.jl).

@ederc
Copy link
Member

ederc commented Dec 9, 2023

I tested locally with Julia 1.6 and I cannot recreate the failing test. Also in PR #3090 the test does not fail which is strange.

@HechtiDerLachs
Copy link
Collaborator Author

If tests pass, this should be ready to go.

Copy link
Collaborator

@thofma thofma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still get incomprehensible errors for

julia> K, a = number_field([x - 1, x - 2]);

julia> Kt, t = K["t"];

julia> L, b = number_field(t - 1, "b");

julia> M, = number_field(t - 1, "b");

julia> Mx, = polynomial_ring(M, 2);

julia> primary_decomposition(ideal(Mx, [gen(Mx, 1)]))
ERROR: MethodError: no method matching _expand_coefficient_field(::MPolyQuoRing{AbstractAlgebra.Generic.MPoly{NfAbsNSElem}}; rec_depth::Int64)

This is a regression, since it is working fine on current master:

julia> Qx, x = QQ["x"]
(Univariate polynomial ring in x over QQ, x)

julia> K, a = number_field([x - 1, x - 2]);

julia> Kt, t = K["t"];

julia> L, b = number_field(t - 1, "b");

julia> M, = number_field(t - 1, "b");

julia> Mx, = polynomial_ring(M, 2);

julia> primary_decomposition(ideal(Mx, [gen(Mx, 1)]))
1-element Vector{Tuple{MPolyIdeal{AbstractAlgebra.Generic.MPoly{Hecke.NfRelElem{NfAbsNSElem}}}, MPolyIdeal{AbstractAlgebra.Generic.MPoly{Hecke.NfRelElem{NfAbsNSElem}}}}}:
 (ideal(x1), ideal(x1))

Catching this cannot be handled using the signature, so you need to use something like

_is_a_tower_we_can_handle(K::QQField) = true

_is_a_tower_we_can_handle(K::NumField) = (K isa AnticNumberField || K isa Oscar.Hecke.NfRel) && _is_a_tower_we_can_handle(base_field(K))

And then check inside the function and call the ordinary primary decomposition in case it returns false.

Alternatively, methods need to be added for conversion of the other field types.

@HechtiDerLachs
Copy link
Collaborator Author

What now? Can this be merged?

@thofma
Copy link
Collaborator

thofma commented Dec 14, 2023

As I said on slack, I will review it today.

@thofma
Copy link
Collaborator

thofma commented Dec 14, 2023

It's a shame we (I) did not implement hom(K::NumField, R::Ring) for arbitrary rings. It would have turned those x -> evaluate(x.data, theta) into neat hom(K, R_exp, theta).

@thofma thofma merged commit 4b266a8 into oscar-system:master Dec 14, 2023
18 of 22 checks passed
@HechtiDerLachs
Copy link
Collaborator Author

Yes, that's what I would have needed. Let me know, should that change one day.

@HechtiDerLachs HechtiDerLachs deleted the primary_decomposition_rerouting branch December 14, 2023 20:02
@thofma
Copy link
Collaborator

thofma commented Dec 15, 2023

I will adjust it once thofma/Hecke.jl#1324 is merged.

@HechtiDerLachs
Copy link
Collaborator Author

Very good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants