Skip to content

Method selection loop for OneInverseOfSemigroupElementNC when applied to groups #1094

@reiniscirpons

Description

@reiniscirpons

Did some root-causing of an issue raised by @JosephDayngerRuiz in his Cartan Matrix PR, minimal reproducible example below:

gap> t := Transformation([3, 3, 4, 2]);;
gap> S := Semigroup(t);;
gap> OneInverseOfSemigroupElementNC(S, t); # No error
Transformation( [ 4, 4, 2, 3 ] )
gap> IsGroupAsSemigroup(S);
gap> OneInverseOfSemigroupElementNC(S, t); # Loop!
Error, recursion depth trap (5000) in
  HasLibsemigroupsFroidurePin( S ) at /home/rc234/Desktop/Source/gap/pkg/Semigroups/gap/main/froidure-pin.gi:26 called from 
HasFroidurePin( S ) at /home/rc234/Desktop/Source/gap/pkg/Semigroups/gap/main/acting.gi:76 called from
x in S at /home/rc234/Desktop/Source/gap/pkg/Semigroups/gap/greens/acting.gi:865 called from
RClass( S, a ) at /home/rc234/Desktop/Source/gap/pkg/Semigroups/gap/attributes/attr.gi:823 called from
OneInverseOfSemigroupElementNC( S, x ) at /home/rc234/Desktop/Source/gap/pkg/Semigroups/gap/attributes/attr.gi:849 called from
OneInverseOfSemigroupElement( S, a ) at /home/rc234/Desktop/Source/gap/pkg/Semigroups/gap/greens/generic.gi:484 called from
...  at *stdin*:7
you may 'return;'
brk>

Tracing the applicable method stack of the second call we get

gap> ApplicableMethod(OneInverseOfSemigroupElementNC, [S, t], 6);
#I  Searching Method for OneInverseOfSemigroupElementNC with 2 arguments:
#I  Total: 2 entries
#I  Method 1: ``OneInverseOfSemigroupElementNC: for CanUseFroidurePin and a multiplicative element'' at /home/rc234/Desktop/Source/gap/pkg/Semigroups/gap/attributes/attr.gi:
818, value: 22
#I  Function Body:
function ( S, a )
    local R, L, e, f, s;
    R := RClass( S, a );
    L := LClass( S, a );
    e := Idempotents( R );
    if IsEmpty( e ) then
        return fail;
    fi;
    e := e[1];
    f := Idempotents( L );
    if IsEmpty( f ) then
        return fail;
    fi;
    f := f[1];
    s := RightGreensMultiplierNC( S, a, e );
    return f * s * e;
endfunction( S, a ) ... end

Which resolves to a call to RightGreensMultiplierNC with e := Transformation( [ 2, 2 ] );, tracing this call reveals

gap> ApplicableMethod(RightGreensMultiplierNC, [S, t, e], 6);                                                
#I  Searching Method for RightGreensMultiplierNC with 3 arguments:
#I  Total: 4 entries
#I  Method 1: ``RightGreensMultiplierNC: for a semigroup and R-related elements'' at /home/rc234/Desktop/Source/gap/pkg/Semigroups/gap/greens/generic.gi:486, value: 53
#I   - 1st argument needs [ "IsMagmaWithInverses" ]
#I  Method 2: ``RightGreensMultiplierNC: for a semigroup and R-related elements'' at /home/rc234/Desktop/Source/gap/pkg/Semigroups/gap/greens/generic.gi:481, value: 45
#I  Function Body:
function ( S, a, b )
    return OneInverseOfSemigroupElement( S, a ) * b;
endfunction( S, a, b ) ... end

Finally, OneInverseOfSemigroupElement then calls OneInverseOfSemigroupElementNC:

gap> ApplicableMethod(OneInverseOfSemigroupElement, [S, t], 6);  
#I  Searching Method for OneInverseOfSemigroupElement with 2 arguments:
#I  Total: 1 entry
#I  Method 1: ``OneInverseOfSemigroupElement: for a semigroup and a multiplicative element'' at /home/rc234/Desktop/Source/gap/pkg/Semigroups/gap/attributes/attr.gi:839, value: 18
#I  Function Body:
function ( S, x )
    if not IsFinite( S ) then
        ErrorNoReturn( "the semigroup is not finite" );
    elif not x in S then
        ErrorNoReturn( "the 2nd argument (a mult. element) must belong to the 1st ", "argument (a semigroup)" );
    fi;
    return OneInverseOfSemigroupElementNC( S, x );
endfunction( S, x ) ... end

This completes the loop.

One quick fix might be just to add a higher priority method for OneInverseOfSemigroupElement for groups which just calls the groups Inverse function, but the underlying loop is still a bit of an issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions