Skip to content

Fix RingGeneralMappingByImages for non-SCRing#6418

Open
fingolfin wants to merge 1 commit into
masterfrom
mh/fix-RingGeneralMappingByImages
Open

Fix RingGeneralMappingByImages for non-SCRing#6418
fingolfin wants to merge 1 commit into
masterfrom
mh/fix-RingGeneralMappingByImages

Conversation

@fingolfin
Copy link
Copy Markdown
Member

A filter was computed but not used. The filter that was used instead always implied IsSCRingGeneralMappingByImagesDefaultRep which is too broad. As a result, inappropriate methods were applied to some ring homomorphisms.

Also add an example for using RingByStructureConstants.


Motivated by a report by Stefan Witzel on the GAP Forum. He wanted to do this:

R := ZmodnZ(9);
S := ZmodnZ(3);
RingHomomorphismByImages(R,S,[One(R)],[One(S)]);

# or:
RingHomomorphismByImages(S,S,[One(S)],[One(S)]);

# or:
RingHomomorphismByImages(Integers,Integers,[1],[1]);

but in all cases got errors of the form

Error, Record Element: '<rec>.moduli' must have an assigned value

This PR does not include a test case, because the example still error, but now with a "no method found" error:

gap> RingHomomorphismByImages(Integers,Integers,[1],[1]);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `GeneratorsOfNearAdditiveGroup' on 1 arguments
*[1] GeneratorsOfAdditiveGroup( elms )
   @ /Users/mhorn/Projekte/GAP/gap/lib/mapphomo.gi:717
 [2] PreImagesSet( map, Range( map ) )
   @ /Users/mhorn/Projekte/GAP/gap/lib/mapping.gi:1154
 [3] PreImagesRange( map )
   @ /Users/mhorn/Projekte/GAP/gap/lib/mapping.gi:574
 [4] IsMapping( hom )
   @ /Users/mhorn/Projekte/GAP/gap/lib/ringhom.gi:86
<function "RingHomomorphismByImages">( <arguments> )
 called from read-eval loop at *stdin*:3
type 'quit;' to quit to outer loop
brk>

While one can solve that one by doing SetGeneratorsOfAdditiveGroup(Integers, [1]);, one just runs into the next "method not found". Similar for the finite rings R, S, where one gets a little bit farther, but not much.

So in the end, this is simply a missing feature, which is not great, but at least explicable.

A workaround can be to use rings created via RingByStructureConstants, for those more functionality exists:

gap> T:= EmptySCTable( 1, 0 );;
gap> SetEntrySCTable( T, 1, 1, [ 1, 1 ] );
gap> R:=RingByStructureConstants([9], T);
<ring with 1 generator>
gap> S:=RingByStructureConstants([3], T);
<ring with 1 generator>
gap> hom := RingHomomorphismByImages(R,S,[One(R)],[One(S)]);
[ r.1 ] -> [ r.1 ]
gap> AsSet(Kernel(hom));
[ 0*r.1, 3*r.1, 6*r.1 ]

A filter was computed but not used. The filter that was used
instead always implied IsSCRingGeneralMappingByImagesDefaultRep
which is too broad. As a result, inappropriate methods were
applied to some ring homomorphisms.

Also add an example for using RingByStructureConstants.
@fingolfin fingolfin requested a review from hulpke May 28, 2026 14:02
@fingolfin fingolfin added kind: bug Issues describing general bugs, and PRs fixing them kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them topic: library release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes backport-to-4.16 labels May 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.89%. Comparing base (e94091c) to head (14624a0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6418      +/-   ##
==========================================
- Coverage   78.89%   78.89%   -0.01%     
==========================================
  Files         685      685              
  Lines      293554   293551       -3     
  Branches     8672     8672              
==========================================
- Hits       231592   231586       -6     
  Misses      60156    60156              
- Partials     1806     1809       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-4.16 kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them kind: bug Issues describing general bugs, and PRs fixing them release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant