# SPDX-License-Identifier: GPL-2.0-or-later # GradedModules: A homalg based package for the Abelian category of finitely presented graded modules over computable graded rings # # Implementations #
## Implementations for graded homalg modules.
#################################### # # global variables: # ####################################
# a central place for configuration variables:
InstallValue( HOMALG_GRADED_MODULES,
rec(
category := rec(
description := "f.p. graded modules and their maps over computable graded rings",
short_description := "_for_fp_graded_modules",
TryPostDivideWithoutAids := true, # see homalg/ToolFunctors.gi
MorphismConstructor := GradedMap,
TypeOfElements := TheTypeHomalgModuleElement,
InternalHom := GradedHom,
InternalExt := GradedExt,
),
ModulesSave := [ ],
MorphismsSave := [ ], # this sets the bound at which modules are cut of when computing ModuleOfGlobalSections. # it should be zero to ensure that global sections sets the correct transformation
LowerTruncationBound := 0
)
);
DeclareRepresentation( "IsGradedModuleOrGradedSubmoduleRep",
IsHomalgGradedModule and
IsStaticFinitelyPresentedObjectOrSubobjectRep and
IsHomalgGradedRingOrGradedModuleRep,
[ ] );
DeclareRepresentation( "IsGradedModuleRep",
IsGradedModuleOrGradedSubmoduleRep and
IsStaticFinitelyPresentedObjectRep,
[ "UnderlyingModule", "SetOfDegreesOfGenerators" ] );
##
DeclareRepresentation( "IsCategoryOfFinitelyPresentedGradedLeftModulesRep",
IsHomalgCategoryOfLeftObjectsRep and
IsCategoryOfGradedModules,
[ ] );
##
DeclareRepresentation( "IsCategoryOfFinitelyPresentedGradedRightModulesRep",
IsHomalgCategoryOfRightObjectsRep and
IsCategoryOfGradedModules,
[ ] );
#################################### # # families and types: # ####################################
# a new family:
BindGlobal( "TheFamilyOfHomalgGradedModules",
NewFamily( "TheFamilyOfHomalgGradedModules" ) );
# two new types:
BindGlobal( "TheTypeHomalgGradedLeftModule",
NewType( TheFamilyOfHomalgGradedModules, IsHomalgLeftObjectOrMorphismOfLeftObjects and IsGradedModuleRep )
);
BindGlobal( "TheTypeHomalgGradedRightModule",
NewType( TheFamilyOfHomalgGradedModules, IsHomalgRightObjectOrMorphismOfRightObjects and IsGradedModuleRep )
);
# two new types:
BindGlobal( "TheTypeCategoryOfFinitelyPresentedGradedLeftModules",
NewType( TheFamilyOfHomalgCategories,
IsCategoryOfFinitelyPresentedGradedLeftModulesRep ) );
## first restore the saved settings if IsBound( M!.LockObjectOnCertainPresentation ) then
SetPositionOfTheDefaultPresentation( M, M!.LockObjectOnCertainPresentation );
Unbind( M!.LockObjectOnCertainPresentation ); fi;
if len >= j+2then for j in [ res!.degrees[j+2] .. res!.degrees[len] ] do if IsIdenticalObj( F_j, 0 * S ) or IsIdenticalObj( F_j, S * 0 ) then # take care not to create the graded zero morphism between distinguished zero modules again each step
d_j := TheZeroMorphism( F_j, F_j );
Add( graded_res, d_j ); # no need for resetting F_j, since all other modules will be zero, too else
d_j := GradedMap( res!.(j), "create", F_j, S );
Assert( 3, IsMorphism( d_j ) );
SetIsMorphism( d_j, true );
Add( graded_res, d_j );
F_j := Source( d_j ); fi;
od; fi;
if HasIsAcyclic( res ) and IsAcyclic( res ) then
SetIsAcyclic( graded_res, true ); fi; if HasIsRightAcyclic( res ) and HasIsRightAcyclic( res ) then
SetIsRightAcyclic( graded_res, true ); fi;
if IsBound( res!.LengthOfResolution ) then
graded_res!.LengthOfResolution := res!.LengthOfResolution; fi;
return MonomialMap( HomalgElementToInteger( d ), M );
end );
## <#GAPDoc Label="RandomMatrix"> ## <ManSection> ## <Oper Arg="S,T" Name="RandomMatrix"/> ## <Returns>a &homalg; matrix</Returns> ## <Description> ## A random matrix between the graded source module <A>S</A> and the graded target module <A>T</A>. ## <#Include Label="RandomMatrix:example"> ## </Description> ## </ManSection> ## <#/GAPDoc> ##
InstallMethod( RandomMatrix, "for homalg modules",
[ IsHomalgGradedModule, IsHomalgGradedModule ],
function( S, T )
local left, degreesS, degreesT, R;
left := IsHomalgLeftObjectOrMorphismOfLeftObjects( S );
if IsHomalgLeftObjectOrMorphismOfLeftObjects( T ) <> left then
Error( "both modules must either be left or either be right modules" ); fi;
degreesS := DegreesOfGenerators( S );
degreesT := DegreesOfGenerators( T );
R := HomalgRing( S );
if left then
return RandomMatrixBetweenGradedFreeLeftModules( degreesS, degreesT, R ); else
return RandomMatrixBetweenGradedFreeRightModules( degreesT, degreesS, R ); fi;
end );
##
InstallMethod( \/, ### defines: / (SubfactorModule) "for a homalg matrix and a graded module",
[ IsHomalgMatrix, IsGradedModuleOrGradedSubmoduleRep ], 10000,
function( mat, M ) # local B, N, gen, S, SF;
local mat2, res;
if IsHomalgMatrixOverGradedRingRep( mat ) then
mat2 := UnderlyingMatrixOverNonGradedRing( mat ); else
mat2 := mat; fi;
res := mat2 / UnderlyingModule( M );
return GradedModule( res, HomalgRing( M ) );
end );
##
InstallMethod( \/, ## needed by _Functor_Kernel_OnObjects since SyzygiesGenerators returns a set of relations "for a set of homalg relations and a graded module",
[ IsHomalgRelations, IsGradedModuleOrGradedSubmoduleRep ], 10000,
if parity = "right" and IsBound( R!.category_of_fp_graded_right_modules ) then
return R!.category_of_fp_graded_right_modules; elif IsBound( R!.category_of_fp_graded_left_modules ) then
return R!.category_of_fp_graded_left_modules; fi;
function( module, degrees, S )
local degree_group, weights, i, GradedModule, setofdegrees, type, ring;
if IsGradedModuleRep( module ) then
return module; fi;
# if not Length( degrees ) = 0 then # # if not IsHomalgElement( degrees[ 1 ] ) and not Set( degrees ) = [ 0 ] then # # weights := GeneratingElements( DegreeGroup( S ) ); # # if not IsInt( degrees[ 1 ] ) then # # if not Length( weights ) = Length( degrees[ 1 ] ) then # Error(" number of generators of DegreeGroup does not match length of degrees."); # fi; # # fi; # # for i in [ 1 .. Length( weights ) ] do # # degrees[ i ] := degrees[ i ] * weights[ i ]; # # od; # # degrees := Flat( degrees ); # # fi; # # fi;
degrees := List( degrees, i -> i * weights[ 1 ] );
else
Error( "input weights do not match generators of degree group" );
fi;
elif IsList( degrees[ 1 ] ) then
if Length( degrees[ 1 ] ) = Length( weights ) then
degrees := List( degrees, i -> HomalgModuleElement( i, degree_group ) );
else
Error( "something went terribly wrong" );
fi;
elif not IsHomalgElement( degrees[ 1 ] ) then
Error( "wrong input degrees" );
fi;
fi;
if IsBound( module!.GradedVersions ) then for i in module!.GradedVersions do if IsIdenticalObj( HomalgRing( i ), S ) and degrees = DegreesOfGenerators( i ) then
return i; fi;
od; fi;
if not IsIdenticalObj( UnderlyingNonGradedRing( S ), HomalgRing( module ) ) and
not IsIdenticalObj( S, HomalgRing( module ) ) then
Error( "Underlying rings do not match" ); fi;
if not ( Length( degrees ) = NrGenerators( module ) ) then
Error( "The number of degrees ", Length( degrees ), " has to equal the number of Generators ", NrGenerators( module ), "\n" ); fi;
if IsBound( module!.distinguished ) and module!.distinguished and HasIsZero( module ) and IsZero( module ) then if IsHomalgLeftObjectOrMorphismOfLeftObjects( module ) then if IsBound( S!.ZeroLeftModule ) then
return S!.ZeroLeftModule; fi; else if IsBound( S!.ZeroRightModule ) then
return S!.ZeroRightModule; fi; fi; fi;
if IsHomalgLeftObjectOrMorphismOfLeftObjects( module ) then
type := TheTypeHomalgGradedLeftModule;
ring := LeftActingDomain;
GradedModule.category := HomalgCategory( S, "left" ); else
type := TheTypeHomalgGradedRightModule;
ring := RightActingDomain;
GradedModule.category := HomalgCategory( S, "right" ); fi;
## Objectify:
ObjectifyWithAttributes(
GradedModule, type,
UnderlyingModule, module,
ring, S
);
if IsBound( module!.distinguished ) and module!.distinguished and HasIsZero( module ) and IsZero( module ) then if IsHomalgLeftObjectOrMorphismOfLeftObjects( module ) then
GradedModule!.distinguished := true;
S!.ZeroLeftModule := GradedModule; else
GradedModule!.distinguished := true;
S!.ZeroRightModule := GradedModule; fi; fi;
# if AssertionLevel() >= 10 then # for i in [ 1 .. Length( HOMALG_GRADED_MODULES.ModulesSave ) ] do # Assert( 10, # not IsIdenticalObj( UnderlyingModule( HOMALG_GRADED_MODULES.ModulesSave[i] ), UnderlyingModule( GradedModule ) ) # or IsIdenticalObj( HOMALG_GRADED_MODULES.ModulesSave[i], GradedModule ), # "a module is about to be graded (at least) twice. This might be intentionally. Set AssertionLevel to 11 to get an error message" ); # Assert( 11, # not IsIdenticalObj( UnderlyingModule( HOMALG_GRADED_MODULES.ModulesSave[i] ), UnderlyingModule( GradedModule ) ) # or IsIdenticalObj( HOMALG_GRADED_MODULES.ModulesSave[i], GradedModule ) ); # od; # Add( HOMALG_GRADED_MODULES.ModulesSave, GradedModule ); # fi;
if not IsBound( module!.GradedVersions ) then
module!.GradedVersions := [ GradedModule ]; else
Add( module!.GradedVersions, GradedModule ); fi;
## User should take care that d is element in the DegreeGroup of s.
return GradedModule( module, ListWithIdenticalEntries( NrGenerators( module ), d ), S ); end );
if Length( degrees ) <> NumberColumns( mat ) then
Error( "the number of degrees must coincide with the number of columns\n" ); fi;
if IsHomalgMatrixOverGradedRingRep( mat ) then
M := LeftPresentation( UnderlyingMatrixOverNonGradedRing( mat ) ); else
M := LeftPresentation( mat ); fi;
if Length( degrees ) <> NumberRows( mat ) then
Error( "the number of degrees must coincide with the number of rows\n" ); fi;
if IsHomalgMatrixOverGradedRingRep( mat ) then
M := RightPresentation( UnderlyingMatrixOverNonGradedRing( mat ) ); else
M := RightPresentation( mat ); fi;
##
InstallOtherMethod( Zero, "for homalg modules",
[ IsGradedModuleRep and IsHomalgRightObjectOrMorphismOfRightObjects ], 10001, ## FIXME: is it O.K. to use such a high ranking
function( M )
return ZeroRightModule( HomalgRing( M ) );
end );
##
InstallOtherMethod( Zero, "for homalg modules",
[ IsGradedModuleRep and IsHomalgLeftObjectOrMorphismOfLeftObjects ], 10001, ## FIXME: is it O.K. to use such a high ranking
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.