Fix preimage computation for field homomorphisms - #6535
Merged
Conversation
PreImagesElm for field homomorphisms compared IsInjective with 1, a GAP3 leftover: the injective branch was dead, so every nonzero element got the empty preimage, even under bijective maps such as Frobenius automorphisms. With that branch reachable, PreImagesElm needs PreImagesRepresentative, which had no applicable method for Frobenius automorphisms. Add one that delegates to ImagesRepresentative of the inverse; the inverse of a Frobenius automorphism is again one (or the identity), so this cannot recurse. Note for #6409 (renames these operations to NC variants): the fixed comparison then belongs in PreImagesElmNC, and the new method in fieldfin.gi should be installed on PreImagesRepresentativeNC. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6535 +/- ##
==========================================
- Coverage 79.02% 79.00% -0.03%
==========================================
Files 685 685
Lines 294329 294334 +5
Branches 8647 8670 +23
==========================================
- Hits 232601 232530 -71
- Misses 59922 59996 +74
- Partials 1806 1808 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ThomasBreuer
approved these changes
Aug 28, 2026
ThomasBreuer
left a comment
Contributor
There was a problem hiding this comment.
Good spot.
Apparently these field homomorphisms have never been used seriously.
(The automorphisms of abelian number fields have their own methods.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PreImagesElm for field homomorphisms compared IsInjective with 1, a GAP3 leftover: the injective branch was dead, so every nonzero element got the empty preimage, even under bijective maps such as Frobenius automorphisms.
With that branch reachable, PreImagesElm needs PreImagesRepresentative, which had no applicable method for Frobenius automorphisms. Add one that delegates to ImagesRepresentative of the inverse; the inverse of a Frobenius automorphism is again one (or the identity), so this cannot recurse.
Note for #6409 (renames these operations to NC variants): the fixed comparison then belongs in PreImagesElmNC, and the new method in fieldfin.gi should be installed on PreImagesRepresentativeNC.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Found while having Claude Fable 5 look into improving PR #6409 (CC @cdwensley); those updates will be pushed soon.