1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
##############################################################################
##
#W lcset.gi GAP4 package `Utils' Chris Wensley
##
#Y Copyright (C) 2015-2025, The GAP Group
#############################################################################
##
#O LeftCoset( <g>, <U> ) . . . . . . . . forms a left coset of U by g \in G
##
InstallMethod( LeftCoset, "generic method for left cosets", true,
[ IsObject, IsGroup ], 0,
function( g, U )
local lc, fam;
fam := FamilyObj( U );
if not IsBound( fam!.leftCosetsDefaultType ) then
fam!.leftCosetsDefaultType :=
NewType( fam, IsLeftCosetDefaultRep and HasActingDomain
and HasFunctionAction and HasRepresentative );
fi;
lc := rec();
ObjectifyWithAttributes( lc, fam!.leftCosetsDefaultType,
Representative, g,
ActingDomain, U,
FunctionAction, OnRight,
IsLeftCoset, true );
if HasSize( U ) then
SetSize( lc, Size( U ) );
fi;
return lc;
end);
#############################################################################
##
#A Inverse( <lc> ) . . . . . forms the right coset Ug^-1 corresponding to gU
#A Inverse( <rc> ) . . . . . forms the left coset g^-1U corresponding to Ug
##
InstallOtherMethod( Inverse, "generic method for left cosets", true,
[ IsLeftCoset ], 0,
function( lc )
local g, U, rc;
g := Representative( lc );
U := ActingDomain( lc );
rc := RightCoset( U, g^-1 );
SetInverse( rc, lc );
return rc;
end);
InstallOtherMethod( Inverse, "generic method for right cosets", true,
[ IsRightCoset ], 0,
function( rc )
local g, U, lc;
g := Representative( rc );
U := ActingDomain( rc );
lc := LeftCoset( g^-1, U );
SetInverse( lc, rc );
return lc;
end);
InstallMethod( PrintString, "for a left coset", true, [ IsLeftCoset ], 0,
function( d )
return STRINGIFY( "LeftCoset(\<",
PrintString( Representative(d) ), ",\>",
PrintString( ActingDomain(d) ), ")" );
end);
InstallMethod( PrintObj, "for a left coset", true, [ IsLeftCoset ], 0,
function( d )
Print( PrintString( d ) );
end);
InstallMethod( ViewString, "for a left coset", true, [ IsLeftCoset ], 0,
function( d )
return STRINGIFY( "LeftCoset(\<",
ViewString( Representative(d) ), ",\>",
ViewString( ActingDomain(d) ), ")" );
end);
InstallMethod( ViewObj, "for a left coset", true, [ IsLeftCoset ], 0,
function( d )
Print( ViewString( d ) );
end);
InstallMethod( \=, "for two left cosets", IsIdenticalObj,
[ IsLeftCoset, IsLeftCoset ], 0,
function( lc1, lc2 )
return ( ActingDomain( lc1 ) = ActingDomain( lc2 ) ) and
( Representative(lc1)/Representative(lc2) in ActingDomain( lc1 ) );
end);
InstallMethod( \in, "element and LeftCoset", true,
[ IsMultiplicativeElementWithInverse, IsLeftCoset ], 100,
function( g, lc )
return ( Representative(lc)^-1 * g ) in ActingDomain( lc );
end);
InstallOtherMethod( \*, "element and LeftCoset", true,
[ IsMultiplicativeElementWithInverse, IsLeftCoset ], 0,
function( g, lc )
return LeftCoset( g * Representative( lc ), ActingDomain( lc ) );
end);
InstallOtherMethod( \^, "LeftCoset and element", true,
[ IsLeftCoset, IsMultiplicativeElementWithInverse ], 0,
function( lc, g )
return g^-1 * lc;
end);
InstallMethod( Size, "for a left coset", true, [ IsLeftCoset ], 0,
function( lc )
return Size( ActingDomain( lc ) );
end);
InstallOtherMethod( IsBiCoset, "for a left coset", true, [ IsLeftCoset ], 0,
function( lc )
return IsBiCoset( Inverse( lc ) );
end);
InstallOtherMethod( AsSet, "for a left coset", true, [ IsLeftCoset ], 0,
function( lc )
local L;
L := AsSet( Inverse( lc ) );
return Set( L, g -> g^-1 );
end);
InstallOtherMethod( Intersection2, "for two left cosets", true,
[ IsLeftCoset, IsLeftCoset ], 0,
function( lc1, lc2 )
local L;
L := Intersection2( Inverse( lc1 ), Inverse( lc2 ) );
return Set( L, g -> g^-1 );
## return Inverse( L ); to be used once 4r12 is out
end);
#############################################################################
##
#F LeftCosets( <G> <U> ) . . . . . . . . . . . . left cosets of U by g \in G
#O LeftCosetsNC( <G> <U> ) . . . . . . . . . . . left cosets of U by g \in G
##
BindGlobal( "LeftCosets",
function( G, U )
if not IsSubset( G, U ) then
Error("not contained");
fi;
return LeftCosetsNC( G, U );
end );
InstallMethod( LeftCosetsNC, "generic", IsIdenticalObj, [ IsGroup, IsGroup ], 0,
function( G, U )
local L;
L := RightCosetsNC( G, U );
return List( L, Inverse );
end);
|