/usr/share/gap/lib/mgmideal.gi is in gap-libs 4r8p8-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | #############################################################################
##
#W mgmideal.gi GAP library Andrew Solomon
##
##
#Y Copyright (C) 1996, Lehrstuhl D für Mathematik, RWTH Aachen, Germany
#Y (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland
#Y Copyright (C) 2002 The GAP Group
##
## This file contains generic methods for magma ideals
##
#############################################################################
##
#M PrintObj( <S> )
## print a [left, right, two-sided] MagmaIdeal
##
## left
InstallMethod( PrintObj,
"for a left magma ideal",
true,
[ IsLeftMagmaIdeal ], 0,
function( S )
Print( "LeftMagmaIdeal( ... )" );
end );
InstallMethod( PrintObj,
"for a left magma ideal with known generators",
true,
[ IsLeftMagmaIdeal and HasGeneratorsOfLeftMagmaIdeal ], 0,
function( S )
Print( "LeftMagmaIdeal( ", GeneratorsOfLeftMagmaIdeal( S ), " )" );
end );
## right
InstallMethod( PrintObj,
"for a right magma ideal",
true,
[ IsRightMagmaIdeal ], 0,
function( S )
Print( "RightMagmaIdeal( ... )" );
end );
InstallMethod( PrintObj,
"for a right magma ideal with known generators",
true,
[ IsRightMagmaIdeal and HasGeneratorsOfRightMagmaIdeal ], 0,
function( S )
Print( "RightMagmaIdeal( ", GeneratorsOfRightMagmaIdeal( S ), " )" );
end );
## two sided
InstallMethod( PrintObj,
"for a magma ideal",
true,
[ IsMagmaIdeal ], 0,
function( S )
Print( "MagmaIdeal( ... )" );
end );
InstallMethod( PrintObj,
"for a magma ideal with known generators",
true,
[ IsMagmaIdeal and HasGeneratorsOfMagmaIdeal ], 0,
function( S )
Print( "MagmaIdeal( ", GeneratorsOfMagmaIdeal( S ), " )" );
end );
#############################################################################
##
#M ViewObj( <S> )
## view a [left,right,two-sided] magma ideal
##
## left
InstallMethod( ViewObj,
"for a LeftMagmaIdeal",
true,
[ IsLeftMagmaIdeal ], 0,
function( S )
Print( "<LeftMagmaIdeal>" );
end );
InstallMethod( ViewObj,
"for a LeftMagmaIdeal with generators",
true,
[ IsLeftMagmaIdeal and HasGeneratorsOfLeftMagmaIdeal ], 0,
function( S )
Print( "<LeftMagmaIdeal with ", Length( GeneratorsOfLeftMagmaIdeal( S ) ),
" generators>" );
end );
## right
InstallMethod( ViewObj,
"for a RightMagmaIdeal",
true,
[ IsRightMagmaIdeal ], 0,
function( S )
Print( "<RightMagmaIdeal>" );
end );
InstallMethod( ViewObj,
"for a RightMagmaIdeal with generators",
true,
[ IsRightMagmaIdeal and HasGeneratorsOfRightMagmaIdeal ], 0,
function( S )
Print( "<RightMagmaIdeal with ", Length( GeneratorsOfRightMagmaIdeal( S ) ),
" generators>" );
end );
## two sided
InstallMethod( ViewObj,
"for a MagmaIdeal",
true,
[ IsMagmaIdeal ], 0,
function( S )
Print( "<MagmaIdeal>" );
end );
InstallMethod( ViewObj,
"for a MagmaIdeal with generators",
true,
[ IsMagmaIdeal and HasGeneratorsOfMagmaIdeal ], 0,
function( S )
Print( "<MagmaIdeal with ", Length( GeneratorsOfMagmaIdeal( S ) ),
" generators>" );
end );
#############################################################################
##
#M LeftMagmaIdealByGenerators( <D>, <gens> )
#M RightMagmaIdealByGenerators( <D>, <gens> )
#M MagmaIdealByGenerators( <D>, <gens> )
##
## ASSUMES that <gens> are a subset of <D>
##
InstallMethod( LeftMagmaIdealByGenerators,
"for a collection of magma elements",
IsIdenticalObj,
[ IsMagma, IsCollection ], 0,
function( M, gens )
local S;
S:= Objectify( NewType( FamilyObj( gens ),
IsLeftMagmaIdeal and IsAttributeStoringRep ),
rec() );
SetGeneratorsOfLeftMagmaIdeal( S, AsList( gens ) );
SetParent(S, M);
SetLeftActingDomain(S, M);
if HasGeneratorsOfGroup(M) then
# Because any ideal of a group the whole group, we should set the
# generators.
SetGeneratorsOfGroup(S, GeneratorsOfGroup(M));
fi;
return S;
end );
InstallMethod( RightMagmaIdealByGenerators,
"for a collection of magma elements",
IsIdenticalObj,
[ IsMagma, IsCollection ], 0,
function( M, gens )
local S;
S:= Objectify( NewType( FamilyObj( gens ),
IsRightMagmaIdeal and IsAttributeStoringRep ),
rec() );
SetGeneratorsOfRightMagmaIdeal( S, AsList( gens ) );
SetParent(S, M);
SetRightActingDomain(S, M);
if HasGeneratorsOfGroup(M) then
# Because any ideal of a group is the whole group, we should set the
# generators.
SetGeneratorsOfGroup(S, GeneratorsOfGroup(M));
fi;
return S;
end );
InstallMethod( MagmaIdealByGenerators,
"for a collection of magma elements",
IsIdenticalObj,
[ IsMagma, IsCollection ], 0,
function( M, gens )
local S;
S:= Objectify( NewType( FamilyObj( gens ),
IsMagmaIdeal and IsAttributeStoringRep ),
rec() );
SetGeneratorsOfMagmaIdeal( S, AsList( gens ) );
SetParent(S, M);
SetActingDomain(S, M);
if HasGeneratorsOfGroup(M) then
# Because any ideal of a group is the whole group, we should set the
# generators.
SetGeneratorsOfGroup(S, GeneratorsOfGroup(M));
fi;
return S;
end );
#############################################################################
##
#F LeftMagmaIdeal( <gen>, ... )
#F RightMagmaIdeal( <gens> )
#F MagmaIdeal( <gens> )
##
## Unimplemented
##
# InstallGlobalFunction( LeftMagmaIdeal, function( arg )
# InstallGlobalFunction( RightMagmaIdeal, function( arg )
# InstallGlobalFunction( MagmaIdeal, function( arg )
#############################################################################
##
#M AsLeftMagmaIdeal( <D>, <C> )
##
## Regard the list <C> of elements as a left ideal of <D>.
## It is not checked, but assumed, that <C> are all the elements
## of the ideal and that <C> is a subset of <D>.
##
InstallMethod( AsLeftMagmaIdeal,
"generic method for a domain and a collection",
IsIdenticalObj,
[ IsDomain, IsCollection ], 0,
function( D, C )
local S;
S:= LeftMagmaIdealByGenerators( D, AsList(C));
UseIsomorphismRelation( C, S );
UseSubsetRelation( C, S );
return S;
end );
#############################################################################
##
#M Enumerator( <I> ) . . . . . . . . . . . . elements of a magma ideal
##
BindGlobal( "EnumeratorOfMagmaIdeal", function( I )
local gens, # magma generators of <I>
H, # submagma
gen, # generator of <I>
x,y, # elements of parent
M; # parent
# handle the case of an empty magma
gens:= GeneratorsOfMagmaIdeal( I );
if IsEmpty( gens ) then
return [];
fi;
M := Parent(I); # the magma whose ideal it is
# start with the empty magma and its element generators list
H:= Submagma( M, [] );
SetAsSSortedList( H, Immutable( [ ] ) );
# Add the generators one after the other.
# We use a function that maintains the elements list for the closure.
for gen in gens do
for x in AsSSortedList(M) do
for y in AsSSortedList(M) do
H:= ClosureMagmaDefault( H, x*gen*y );
od;
od;
od;
# return the list of elements
Assert( 2, HasAsSSortedList( H ) );
return AsSSortedList( H );
end );
InstallMethod( Enumerator,
"generic method for a magma ideal",
true,
[ IsMagma and IsAttributeStoringRep and IsMagmaIdeal ], 0,
EnumeratorOfMagmaIdeal );
#############################################################################
##
#M AsSSortedList( <R> ) - for a right magma ideal
#M AsSSortedList( <L> ) - for a left magma ideal
##
## Lazy methods for listing the elements of a left/right magma ideal
## assuming the object is finite. Should write enumerators some time...
##
InstallMethod( AsSSortedList,
"for a right magma ideal", true,
[IsRightMagmaIdeal and HasGeneratorsOfRightMagmaIdeal],0,
function(I)
local
g, # a generator of the ideal
x, # an element of the parent
plist, # elements of the parent
genlist, # right ideal generators
idealelts; # elements of the ideal
plist := AsSet(Parent(I));
genlist := AsSet(GeneratorsOfRightMagmaIdeal(I));
idealelts := ShallowCopy(genlist);
for g in genlist do
for x in plist do
AddSet(idealelts, g*x);
od;
od;
return idealelts;
end);
InstallMethod( AsSSortedList,
"for a left magma ideal", true,
[IsLeftMagmaIdeal and HasGeneratorsOfLeftMagmaIdeal],0,
function(I)
local
g, # a generator of the ideal
x, # an element of the parent
plist, # elements of the parent
genlist, # left ideal generators
idealelts; # elements of the ideal
plist := AsSet(Parent(I));
genlist := AsSet(GeneratorsOfLeftMagmaIdeal(I));
idealelts := ShallowCopy(genlist);
for g in genlist do
for x in plist do
AddSet(idealelts, x*g);
od;
od;
return idealelts;
end);
#############################################################################
##
#E
|