Skip to content

Commit

Permalink
Fix + and * of DirectProductElement and non-list collection
Browse files Browse the repository at this point in the history
These are problematic as follows: Suppose you want to know what kind
of object A*B is:

* If A and B are "scalars", it is their product.
* If A is a "scalar" and B=[x,y] is a list or a direct product element (dpe),
  it is the list [A*x,A*y].
* If A=[x,y] is a list and B is a "scalar", it is the list [x*B, y*B]
* If both are lists, it is their scalar product

But now what if A is a RightCoset in a group G, and B a group element? Then
we might expect this to be the new right coset A*B, at least if B is in G.

But if B is a list or dpe [x,y], it could also mean the dpe [A*x, A*y].

This ambiguity is the source of problems once the method ranks fluctuate.

This commit works around this issue by modifying some methods which currently
try to disambiguate the above situation by checking the arguments against the
filter `IsList`, to instead check `IsListOrCollection`.
  • Loading branch information
fingolfin committed Oct 2, 2018
1 parent 099bd5c commit e10aef5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/tuples.gd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ DeclareInfoClass( "InfoDirectProductElements" );
## The sum and the product of a direct product element and a list in
## <Ref Func="IsListDefault"/> is the list of sums and products,
## respectively.
## The sum and the product of a direct product element and a non-list
## The sum and the product of a direct product element and an object
## that is neither a list nor a collection
## is the direct product element of componentwise sums and products,
## respectively.
## </Description>
Expand Down
8 changes: 4 additions & 4 deletions lib/tuples.gi
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ InstallOtherMethod( \+,
"for a direct product element, and a non-list",
[ IsDirectProductElement, IsObject ],
function( dpelm, nonlist )
if IsList( nonlist ) then
if IsListOrCollection( nonlist ) then
TryNextMethod();
fi;
return DirectProductElement( List( dpelm, entry -> entry + nonlist ) );
Expand All @@ -480,7 +480,7 @@ InstallOtherMethod( \+,
"for a non-list, and a direct product element",
[ IsObject, IsDirectProductElement ],
function( nonlist, dpelm )
if IsList( nonlist ) then
if IsListOrCollection( nonlist ) then
TryNextMethod();
fi;
return DirectProductElement( List( dpelm, entry -> nonlist + entry ) );
Expand All @@ -490,7 +490,7 @@ InstallOtherMethod( \*,
"for a direct product element, and a non-list",
[ IsDirectProductElement, IsObject ],
function( dpelm, nonlist )
if IsList( nonlist ) then
if IsListOrCollection( nonlist ) then
TryNextMethod();
fi;
return DirectProductElement( List( dpelm, entry -> entry * nonlist ) );
Expand All @@ -500,7 +500,7 @@ InstallOtherMethod( \*,
"for a non-list, and a direct product element",
[ IsObject, IsDirectProductElement ],
function( nonlist, dpelm )
if IsList( nonlist ) then
if IsListOrCollection( nonlist ) then
TryNextMethod();
fi;
return DirectProductElement( List( dpelm, entry -> nonlist * entry ) );
Expand Down

0 comments on commit e10aef5

Please sign in to comment.