Skip to content

Further restrict / improve Difference methods #10

@fingolfin

Description

@fingolfin

(Taken from gap-system/gap#2164)

Consider these two inputs:

Difference(Rationals, [1/2]);
R:=GroupRing(Integers, FreeGroup(1));; Difference(R, [R.1]);

Without resclasses, one gets this:

gap> Difference(Rationals, [1/2]);
Error, sorry, cannot subtract from the infinite domain <D> at GAPROOT/lib/coll.gi:3002 called from
<function "unknown">( <arguments> )
 called from read-eval loop at *stdin*:1
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk>

gap> R:=GroupRing(Integers, FreeGroup(1));; Difference(R, [R.1]);
Error, sorry, cannot subtract from the infinite domain <D> at GAPROOT/lib/coll.gi:3002 called from
<function "unknown">( <arguments> )
 called from read-eval loop at *stdin*:1
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk>

With resclasses, one also gets errors, but less helpful ones:

gap> Difference(Rationals, [1/2]);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 2nd choice method found for `ResidueClassUnionCons' on 6 arguments at GAPROOT/lib/methsel2.g:249 called from
ResidueClassUnionCons( IsResidueClassUnion, R, m, r, included, excluded ) at GAPROOT/pkg/resclasses/lib/resclass.gi:886 called from
ResidueClassUnionNC( R, One( R ), [ Zero( R ) ], [  ], Set( S ) ) at GAPROOT/pkg/resclasses/lib/resclass.gi:2126 called from
<function "unknown">( <arguments> )
 called from read-eval loop at *stdin*:1
type 'quit;' to quit to outer loop
brk>

and similar for the second input.

It would be nice if the better error message was retained, e.g. by further restricting the inputs to which resclasses' Difference method applies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions