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

Saturation for modules #4249

Merged
merged 4 commits into from
Oct 29, 2024
Merged

Saturation for modules #4249

merged 4 commits into from
Oct 29, 2024

Conversation

wdecker
Copy link
Collaborator

@wdecker wdecker commented Oct 27, 2024

No description provided.

@wdecker
Copy link
Collaborator Author

wdecker commented Oct 27, 2024

The error which appears here in some tests stems from an example which is NOT NEW, but which I moved from a .jl to a .md file. The function called is in MPolyQuo.jl and reads a follows:

function intersect(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}...) where T
  for g in b
    @req base_ring(g) == base_ring(a) "base rings must match"
  end
  as = Singular.intersection(singular_generators(a.gens), [singular_generators(g.gens) for g in b]...)
  return MPolyQuoIdeal(base_ring(a), as)
end

The result is the ideal generated by x*y to which the Singular calculation NOW adds the generator x*y^2 which is not wrong but superfluous. @hannes14, @ederc: Is there a recent change in Singular(.jl) which causes this?

@@ -294,11 +294,38 @@ minimal_generating_set(I::MPolyQuoIdeal{<:MPolyDecRingElem})

#### Intersection of Ideals

```@docs
```@julia
Copy link
Member

Choose a reason for hiding this comment

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

is this change intended? why don't you want to include the docstring here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please see here:
https://docs.oscar-system.org/dev/CommutativeAlgebra/affine_algebras/#Ideals-in-Affine-Algebras
When I include the docstring, a whole Rattenschwanz of methods for intersection will be printed. These happens occasionally and so far, none of our gurus had a solution for this problem. Please note: I duplicated the example using jldoctest in the .md file, so the example will run anyway.

Copy link
Member

Choose a reason for hiding this comment

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

I think @thofma has some tool that might help in these cases. Maybe he could try it on this instance of the problem.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no docstring for the signature

intersect(V::Vector{MPolyQuoIdeal{T}}) where T

so it just includes all of them. I think simply removing this should fix everything.

Copy link
Collaborator

Choose a reason for hiding this comment

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

and keep the @docs

@@ -294,11 +294,38 @@ minimal_generating_set(I::MPolyQuoIdeal{<:MPolyDecRingElem})

#### Intersection of Ideals

```@docs
```@julia
intersect(a::MPolyQuoIdeal{T}, bs::MPolyQuoIdeal{T}...) where T
intersect(V::Vector{MPolyQuoIdeal{T}}) where T
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
intersect(V::Vector{MPolyQuoIdeal{T}}) where T

@thofma
Copy link
Collaborator

thofma commented Oct 27, 2024

@wdecker I wrote a little package to help with the docstrings (which is how I found out about the things mentioned earlier):

julia> using WhereIsMyDocstring, Oscar

julia> @docmatch intersect(V::Vector{MPolyQuoIdeal{T}}) where T
6-element Vector{WhereIsMyDocstring.DocStr}:
[...]

The @docmatch bla tells you which docstrings will be included, if you write this in a ```@docs section.

You can also do

julia> @docmatch intersect
25-element Vector{WhereIsMyDocstring.DocStr}:
[...]

to list all docstrings for a specific function. This also gives you instructions on how to include a specific one in the documentation (which works most of the time).

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 6 lines in your changes missing coverage. Please review.

Project coverage is 84.59%. Comparing base (16517cf) to head (6faf888).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/Modules/UngradedModules/SubquoModule.jl 86.66% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4249      +/-   ##
==========================================
- Coverage   84.59%   84.59%   -0.01%     
==========================================
  Files         631      631              
  Lines       85072    85109      +37     
==========================================
+ Hits        71970    72001      +31     
- Misses      13102    13108       +6     
Files with missing lines Coverage Δ
src/Modules/UngradedModules/SubquoModule.jl 78.72% <86.66%> (+1.19%) ⬆️

... and 1 file with indirect coverage changes

@fingolfin
Copy link
Member

Huh, it's indeed odd: the docstring for intersect(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}...) where T in src/Rings/MPolyQuo.jl:505 contains a jldoctest which does not seem to be executed for some reason?

It looks like this:

@doc raw"""
    intersect(a::MPolyQuoIdeal{T}, bs::MPolyQuoIdeal{T}...) where T
    intersect(V::Vector{MPolyQuoIdeal{T}}) where T

Return the intersection of two or more ideals.

# Examples
```jldoctest
julia> R, (x, y) = polynomial_ring(QQ, [:x, :y]);

julia> A, _ = quo(R, ideal(R, [x^2-y^3, x-y]));

julia> a = ideal(A, [y^2])
Ideal generated by
  y^2

julia> b = ideal(A, [x])
Ideal generated by
  x

julia> intersect(a,b)
Ideal generated by
  x*y

julia> intersect([a,b])
Ideal generated by
  x*y
```
"""
function intersect(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}...) where T
  for g in b
    @req base_ring(g) == base_ring(a) "base rings must match"
  end
  as = Singular.intersection(singular_generators(a.gens), [singular_generators(g.gens) for g in b]...)
  return MPolyQuoIdeal(base_ring(a), as)
end

And clearly CI tests pass. But if I run this test manually in the REPL, I get different output (just like @wdecker):

julia> R, (x, y) = polynomial_ring(QQ, [:x, :y]);

julia> A, _ = quo(R, ideal(R, [x^2-y^3, x-y]));

julia> a = ideal(A, [y^2])
Ideal generated by
  y^2

julia> b = ideal(A, [x])
Ideal generated by
  x

julia> intersect(a,b)
Ideal generated by
  x*y
  x*y^2

julia> intersect([a,b])
Ideal generated by
  x*y
  x*y^2

If I run

Oscar.doctest_fix("src/Rings/MPolyQuo.jl")

it modifies the docstring to the new output.

But CI does not complain. What's going on there?

@thofma
Copy link
Collaborator

thofma commented Oct 28, 2024

hannes14 added a commit to Singular/Singular that referenced this pull request Oct 29, 2024
@hannes14
Copy link
Member

The problem with additional element in intersect is fixed in Singular with
Singular/Singular@de8b882,
will be in Oscar with the next Singular(.jl) release

@wdecker
Copy link
Collaborator Author

wdecker commented Oct 29, 2024 via email

@fieker fieker merged commit b056c72 into master Oct 29, 2024
30 checks passed
@fieker fieker deleted the Wolfram branch October 29, 2024 12:50
HechtiDerLachs pushed a commit to HechtiDerLachs/Oscar.jl that referenced this pull request Oct 30, 2024
* Saturation for modules

* remove whitespace

* Correction

* reacting to the discussion
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.

6 participants