Skip to content

Add hint for eliminate using a proper subring#4683

Merged
thofma merged 1 commit intomasterfrom
th/elimi
Mar 4, 2025
Merged

Add hint for eliminate using a proper subring#4683
thofma merged 1 commit intomasterfrom
th/elimi

Conversation

@thofma
Copy link
Copy Markdown
Collaborator

@thofma thofma commented Mar 1, 2025

  • remove code duplication for detecting morphisms that map generators to generators
  • expand the note in the eliminate docstring to point to preimage
  • add an explicit example to the docstring

CC: @fieker

Probably closes #2590.

The docstring is expanded by adding the following example:

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

julia> I = ideal(R, [t-x, t^2-y, t^3-z])
Ideal generated by
  t - x
  t^2 - y
  t^3 - z

julia> TC = eliminate(I, A)
Ideal generated by
  -x*z + y^2
  x*y - z
  x^2 - y

julia> eliminate(I, lex(R), 2)
Ideal generated by
  y^3 - z^2

julia> base_ring(TC)
Multivariate polynomial ring in 4 variables t, x, y, z
  over rational field

# New stuff:
julia> S, (yy, zz) = QQ[:yy, :zz]; # Construct the elimination as an ideal of S

julia> f = hom(S, R, [y, z]);

julia> TCS = preimage(f, I)
Ideal generated by
  yy^3 - zz^2

julia> base_ring(TCS)
Multivariate polynomial ring in 2 variables yy, zz
  over rational field

@thofma thofma requested a review from HechtiDerLachs March 1, 2025 20:19
@thofma thofma force-pushed the th/elimi branch 2 times, most recently from 1c4106b to 8edf39e Compare March 2, 2025 08:50
- remove code duplication for detecting morphisms that map generators
  to generators
- expand the note in the `eliminate` docstring to point to `preimage`
- add an explicit example to the docstring
Copy link
Copy Markdown
Collaborator

@HechtiDerLachs HechtiDerLachs left a 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 cleanup!

This PR streamlines the use of _maps_variables_to_variables with the previous ad hoc implementations of the same functionality in the constructor of maps.

Comment on lines +36 to +38
if check_for_mapping_of_vars
result.variable_indices = __maps_variables_to_variables(img_gens,
codomain)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In the previous implementation this field being unassigned was the indicator that the map does not take variables into variables. Now it seems that the field is assigned by default. But I suppose you deliberately changed the overall concept here and took that into account, right?

Either way: I was just a bit puzzled that this field is assigned only if a specific kwarg is set to true.

Copy link
Copy Markdown
Collaborator Author

@thofma thofma Mar 2, 2025

Choose a reason for hiding this comment

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

  1. Yes, I changed the concept so that there is now only one way to ask whether variables map to variables. Before there were two: Either call _maps_variables_to_variables or check isdefined(f, ...).
  2. The part with always setting the field is on purpose. Repeatedly constructing Int[] is expensive. Now one should never query isdefined(f, :) directly, but just ask whether _maps_... is true.
  3. The special kwarg was added by you. I am happy to remove it, since it is never used and cannot be used legally using hom, see Speed up polynomial mappings #4124 (comment).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see. I think at the time I wanted to leave some backdoor open to avoid the check. That's why I introduced the kwarg, but did not yet forward it to the user-facing constructors. If it does not conflict with your implementation, then I would say: let's just keep it.

Not relying on isdefined anymore makes sense. This was a bit opaque, anyway.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

OK, let's keep keeping it. Thanks for the review.

Copy link
Copy Markdown
Contributor

@fieker fieker left a comment

Choose a reason for hiding this comment

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

if this helps, I'm happy. Avoiding GB is always good

@thofma thofma merged commit 2f12138 into master Mar 4, 2025
@thofma thofma deleted the th/elimi branch March 4, 2025 21:00
@thofma thofma changed the title feat: add hint for eliminate with proper subring Add hint for eliminate using a proper subring Mar 4, 2025
@thofma thofma added topic: commutative algebra release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes labels Mar 4, 2025
fieker pushed a commit that referenced this pull request Mar 17, 2025
- remove code duplication for detecting morphisms that map generators
  to generators
- expand the note in the `eliminate` docstring to point to `preimage`
- add an explicit example to the docstring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: commutative algebra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

elimination

3 participants