Skip to content

Commit

Permalink
Replace InstallValue and InstallGobalFunction by BindGlobal
Browse files Browse the repository at this point in the history
.. in many cases. Note that `InstallValue` is a somewhat dangerous
operation that we hope to phase out in GAP on the long run.
  • Loading branch information
fingolfin committed Jan 10, 2024
1 parent 03e550b commit 75c8146
Show file tree
Hide file tree
Showing 20 changed files with 138 additions and 448 deletions.
29 changes: 0 additions & 29 deletions GradedModules/gap/BasicFunctors.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,6 @@
#
####################################

## Cokernel
DeclareGlobalFunction( "_Functor_Cokernel_OnGradedModules" );

DeclareGlobalVariable( "functor_Cokernel_ForGradedModules" );

## ImageObject
DeclareGlobalFunction( "_Functor_ImageObject_OnGradedModules" );

DeclareGlobalVariable( "functor_ImageObject_ForGradedModules" );

## GradedHom
DeclareGlobalFunction( "_Functor_GradedHom_OnGradedModules" );

DeclareGlobalFunction( "_Functor_GradedHom_OnGradedMaps" );

DeclareGlobalVariable( "Functor_GradedHom_ForGradedModules" );

## TensorProduct
DeclareGlobalFunction( "_Functor_TensorProduct_OnGradedModules" );

DeclareGlobalFunction( "_Functor_TensorProduct_OnGradedMaps" );

DeclareGlobalVariable( "Functor_TensorProduct_ForGradedModules" );

## BaseChange
DeclareGlobalFunction( "_functor_BaseChange_OnGradedModules" );

DeclareGlobalVariable( "functor_BaseChange_ForGradedModules" );

####################################
#
# global functions and operations:
Expand Down
24 changes: 12 additions & 12 deletions GradedModules/gap/BasicFunctors.gi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
##

##
InstallGlobalFunction( _Functor_Cokernel_OnGradedModules, ### defines: Cokernel(Epi)
BindGlobal( "_Functor_Cokernel_OnGradedModules", ### defines: Cokernel(Epi)
function( phi )
local S, R, U_phi, epi, positions, p2, p, coker_U_phi, coker, gen_iso, img_emb, emb;

Expand Down Expand Up @@ -118,7 +118,7 @@ end );

## <#GAPDoc Label="functor_Cokernel:code">
## <Listing Type="Code"><![CDATA[
InstallValue( functor_Cokernel_ForGradedModules,
BindGlobal( "functor_Cokernel_ForGradedModules",
CreateHomalgFunctor(
[ "name", "Cokernel" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand All @@ -141,7 +141,7 @@ functor_Cokernel_ForGradedModules!.ContainerForWeakPointersOnComputedBasicMorphi
## ImageObject
##

InstallGlobalFunction( _Functor_ImageObject_OnGradedModules, ### defines: ImageObject(Emb)
BindGlobal( "_Functor_ImageObject_OnGradedModules", ### defines: ImageObject(Emb)
function( phi )
local S, emb, img, coker_epi, img_submodule;

Expand Down Expand Up @@ -203,7 +203,7 @@ end );

## <#GAPDoc Label="functor_ImageObject:code">
## <Listing Type="Code"><![CDATA[
InstallValue( functor_ImageObject_ForGradedModules,
BindGlobal( "functor_ImageObject_ForGradedModules",
CreateHomalgFunctor(
[ "name", "ImageObject" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand All @@ -230,7 +230,7 @@ functor_ImageObject_ForGradedModules!.ContainerForWeakPointersOnComputedBasicMor
## GradedHom
##

InstallGlobalFunction( _Functor_GradedHom_OnGradedModules, ### defines: GradedHom (object part)
BindGlobal( "_Functor_GradedHom_OnGradedModules", ### defines: GradedHom (object part)
function( M, N )
local S, hom, emb, degHP0N, p, HP0N;

Expand Down Expand Up @@ -269,7 +269,7 @@ InstallGlobalFunction( _Functor_GradedHom_OnGradedModules, ### defines: GradedHo
end );

##
InstallGlobalFunction( _Functor_GradedHom_OnGradedMaps, ### defines: GradedHom (morphism part)
BindGlobal( "_Functor_GradedHom_OnGradedMaps", ### defines: GradedHom (morphism part)
function( F_source, F_target, arg_before_pos, phi, arg_behind_pos )
local psi;

Expand All @@ -296,7 +296,7 @@ end );

## <#GAPDoc Label="Functor_Hom:code">
## <Listing Type="Code"><![CDATA[
InstallValue( Functor_GradedHom_ForGradedModules,
BindGlobal( "Functor_GradedHom_ForGradedModules",
CreateHomalgFunctor(
[ "name", "GradedHom" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand Down Expand Up @@ -419,7 +419,7 @@ RightDerivedCofunctor( Functor_GradedHom_ForGradedModules );
## TensorProduct
##

InstallGlobalFunction( _Functor_TensorProduct_OnGradedModules, ### defines: TensorProduct (object part)
BindGlobal( "_Functor_TensorProduct_OnGradedModules", ### defines: TensorProduct (object part)
function( M, N )
local S, degM, degN, degMN, T, alpha, p;

Expand Down Expand Up @@ -463,7 +463,7 @@ InstallGlobalFunction( _Functor_TensorProduct_OnGradedModules, ### defines: Tens
end );

##
InstallGlobalFunction( _Functor_TensorProduct_OnGradedMaps, ### defines: TensorProduct (morphism part)
BindGlobal( "_Functor_TensorProduct_OnGradedMaps", ### defines: TensorProduct (morphism part)
function( F_source, F_target, arg_before_pos, phi, arg_behind_pos )
local psi;

Expand All @@ -490,7 +490,7 @@ end );

## <#GAPDoc Label="Functor_TensorProduct:code">
## <Listing Type="Code"><![CDATA[
InstallValue( Functor_TensorProduct_ForGradedModules,
BindGlobal( "Functor_TensorProduct_ForGradedModules",
CreateHomalgFunctor(
[ "name", "TensorProduct" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand Down Expand Up @@ -544,7 +544,7 @@ fi;
##

##
InstallGlobalFunction( _functor_BaseChange_OnGradedModules, ### defines: BaseChange (object part)
BindGlobal( "_functor_BaseChange_OnGradedModules", ### defines: BaseChange (object part)
function( _R, M )
local R, S, N, p;

Expand Down Expand Up @@ -608,7 +608,7 @@ InstallOtherMethod( BaseChange,

end );

InstallValue( functor_BaseChange_ForGradedModules,
BindGlobal( "functor_BaseChange_ForGradedModules",
CreateHomalgFunctor(
[ "name", "BaseChange" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand Down
49 changes: 3 additions & 46 deletions GradedModules/gap/GradedStructureFunctors.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ DeclareOperation( "RepresentationMapOfRingElement",
DeclareOperation( "RepresentationMapOfRingElement",
[ IsRingElement, IsHomalgModule, IsHomalgElement ] );

DeclareGlobalFunction( "_Functor_RepresentationMapOfRingElement_OnGradedModules" );

DeclareGlobalFunction( "_Functor_RepresentationMapOfRingElement_OnGradedMaps" );

DeclareGlobalVariable( "Functor_RepresentationMapOfRingElement_ForGradedModules" );

## SubmoduleGeneratedByHomogeneousPart

DeclareOperation( "SubmoduleGeneratedByHomogeneousPart",
Expand All @@ -34,15 +28,6 @@ DeclareOperation( "SubmoduleGeneratedByHomogeneousPart",
DeclareOperation( "SubmoduleGeneratedByHomogeneousPart",
[ IsHomalgElement, IsHomalgModule ] );

DeclareGlobalFunction( "_Functor_SubmoduleGeneratedByHomogeneousPart_OnGradedModules" );

DeclareGlobalFunction( "_Functor_SubmoduleGeneratedByHomogeneousPart_OnGradedMaps" );

DeclareGlobalVariable( "Functor_SubmoduleGeneratedByHomogeneousPart_ForGradedModules" );

DeclareOperation( "SubmoduleGeneratedByHomogeneousPartEmbed",
[ IsInt, IsHomalgModule ] );

DeclareOperation( "SubmoduleGeneratedByHomogeneousPartEmbed",
[ IsHomalgElement, IsHomalgModule ] );

Expand All @@ -51,10 +36,6 @@ DeclareAttribute( "EmbeddingOfTruncatedModuleInSuperModule",

## TruncatedSubmoduleEmbed

DeclareGlobalFunction( "_Functor_TruncatedModule_OnGradedModules" );

DeclareGlobalVariable( "Functor_TruncatedModule_ForGradedModules" );

DeclareOperation( "TruncatedSubmoduleEmbed",
[ IsInt, IsHomalgModule ] );

Expand All @@ -73,17 +54,7 @@ DeclareOperation( "TruncatedModule",
DeclareOperation( "TruncatedModule",
[ IsHomalgElement, IsHomalgModule ] );

# DeclareGlobalFunction( "_Functor_TruncatedSubmoduleEmbed_OnGradedModules" );
#
# DeclareGlobalFunction( "_Functor_TruncatedSubmoduleEmbed_OnGradedMaps" );
#
# DeclareGlobalVariable( "Functor_TruncatedSubmoduleEmbed_ForGradedModules" );

DeclareGlobalFunction( "_Functor_TruncatedSubmodule_OnGradedModules" );

DeclareGlobalFunction( "_Functor_TruncatedSubmodule_OnGradedMaps" );

DeclareGlobalVariable( "Functor_TruncatedSubmodule_ForGradedModules" );
DeclareGlobalName( "Functor_TruncatedSubmodule_ForGradedModules" );

## TruncatedSubmoduleRecursiveEmbed

Expand All @@ -93,12 +64,6 @@ DeclareOperation( "TruncatedSubmoduleRecursiveEmbed",
DeclareOperation( "TruncatedSubmoduleRecursiveEmbed",
[ IsHomalgElement, IsHomalgModule ] );

DeclareGlobalFunction( "_Functor_TruncatedSubmoduleRecursiveEmbed_OnGradedModules" );

DeclareGlobalFunction( "_Functor_TruncatedSubmoduleRecursiveEmbed_OnGradedMaps" );

DeclareGlobalVariable( "Functor_TruncatedSubmoduleRecursiveEmbed_ForGradedModules" );

## HomogeneousPartOverCoefficientsRing

DeclareOperation( "RepresentationOfMorphismOnHomogeneousParts",
Expand All @@ -122,11 +87,7 @@ DeclareOperation( "HomogeneousPartOverCoefficientsRing",
DeclareOperation( "HomogeneousPartOverCoefficientsRing",
[ IsHomalgElement, IsHomalgGradedModule ] );

DeclareGlobalFunction( "_Functor_HomogeneousPartOverCoefficientsRing_OnGradedModules" );

DeclareGlobalFunction( "_Functor_HomogeneousPartOverCoefficientsRing_OnGradedMaps" );

DeclareGlobalVariable( "Functor_HomogeneousPartOverCoefficientsRing_ForGradedModules" );
DeclareGlobalName( "Functor_HomogeneousPartOverCoefficientsRing_ForGradedModules" );

## HomogeneousPartOfDegreeZeroOverCoefficientsRing

Expand All @@ -136,8 +97,4 @@ DeclareOperation( "HomogeneousPartOfDegreeZeroOverCoefficientsRing",
DeclareOperation( "HomogeneousPartOfDegreeZeroOverCoefficientsRing",
[ IsHomalgGradedModule ] );

DeclareGlobalFunction( "_Functor_HomogeneousPartOfDegreeZeroOverCoefficientsRing_OnGradedModules" );

DeclareGlobalFunction( "_Functor_HomogeneousPartOfDegreeZeroOverCoefficientsRing_OnGradedMaps" );

DeclareGlobalVariable( "Functor_HomogeneousPartOfDegreeZeroOverCoefficientsRing_ForGradedModules" );
DeclareGlobalName( "Functor_HomogeneousPartOfDegreeZeroOverCoefficientsRing_ForGradedModules" );
36 changes: 18 additions & 18 deletions GradedModules/gap/GradedStructureFunctors.gi
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ end );
## </ManSection>
## <#/GAPDoc>
##
InstallGlobalFunction( _Functor_RepresentationMapOfRingElement_OnGradedModules, ### defines: RepresentationMapOfRingElement (object part)
BindGlobal( "_Functor_RepresentationMapOfRingElement_OnGradedModules", ### defines: RepresentationMapOfRingElement (object part)

function( l, M )
local S, R, r, d, bd, bdp1, r_mult;
Expand Down Expand Up @@ -220,7 +220,7 @@ InstallMethod( RepresentationMapOfRingElement,

end );

InstallValue( Functor_RepresentationMapOfRingElement_ForGradedModules,
BindGlobal( "Functor_RepresentationMapOfRingElement_ForGradedModules",
CreateHomalgFunctor(
[ "name", "RepresentationMapOfRingElement" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand Down Expand Up @@ -255,7 +255,7 @@ InstallFunctor( Functor_RepresentationMapOfRingElement_ForGradedModules );
## </ManSection>
## <#/GAPDoc>
##
InstallGlobalFunction( _Functor_SubmoduleGeneratedByHomogeneousPart_OnGradedModules, ### defines: SubmoduleGeneratedByHomogeneousPart (object part)
BindGlobal( "_Functor_SubmoduleGeneratedByHomogeneousPart_OnGradedModules", ### defines: SubmoduleGeneratedByHomogeneousPart (object part)

function( d, M )
local deg, submodule;
Expand All @@ -277,7 +277,7 @@ InstallGlobalFunction( _Functor_SubmoduleGeneratedByHomogeneousPart_OnGradedModu
end );

##
InstallGlobalFunction( _Functor_SubmoduleGeneratedByHomogeneousPart_OnGradedMaps, ### defines: SubmoduleGeneratedByHomogeneousPart (morphism part)
BindGlobal( "_Functor_SubmoduleGeneratedByHomogeneousPart_OnGradedMaps", ### defines: SubmoduleGeneratedByHomogeneousPart (morphism part)
function( F_source, F_target, arg_before_pos, phi, arg_behind_pos )
local result;

Expand Down Expand Up @@ -342,7 +342,7 @@ InstallMethod( SubmoduleGeneratedByHomogeneousPartEmbed,

end );

InstallValue( Functor_SubmoduleGeneratedByHomogeneousPart_ForGradedModules,
BindGlobal( "Functor_SubmoduleGeneratedByHomogeneousPart_ForGradedModules",
CreateHomalgFunctor(
[ "name", "SubmoduleGeneratedByHomogeneousPart" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand Down Expand Up @@ -377,7 +377,7 @@ end );
##

##
InstallGlobalFunction( _Functor_TruncatedSubmodule_OnGradedModules,
BindGlobal( "_Functor_TruncatedSubmodule_OnGradedModules",

function( d, M )
local deg, certain_deg1, certain_part, certain_deg2, mat, phi1, phi2, phi, M2;
Expand Down Expand Up @@ -426,7 +426,7 @@ InstallGlobalFunction( _Functor_TruncatedSubmodule_OnGradedModules,
end );

##
InstallGlobalFunction( _Functor_TruncatedSubmodule_OnGradedMaps,
BindGlobal( "_Functor_TruncatedSubmodule_OnGradedMaps",
function( F_source, F_target, arg_before_pos, phi, arg_behind_pos )
local truncated_source_embedding, truncated_range_embedding;

Expand All @@ -438,7 +438,7 @@ InstallGlobalFunction( _Functor_TruncatedSubmodule_OnGradedMaps,

end );

InstallValue( Functor_TruncatedSubmodule_ForGradedModules,
BindGlobal( "Functor_TruncatedSubmodule_ForGradedModules",
CreateHomalgFunctor(
[ "name", "TruncatedSubmodule" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand Down Expand Up @@ -484,15 +484,15 @@ end );
##

##
InstallGlobalFunction( _Functor_TruncatedModule_OnGradedModules,
BindGlobal( "_Functor_TruncatedModule_OnGradedModules",

function( d, M )

return Source( TruncatedSubmoduleEmbed( d, M ) );

end );

InstallValue( Functor_TruncatedModule_ForGradedModules,
BindGlobal( "Functor_TruncatedModule_ForGradedModules",
CreateHomalgFunctor(
[ "name", "TruncatedModule" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand Down Expand Up @@ -526,15 +526,15 @@ end );
##

##
InstallGlobalFunction( _Functor_TruncatedSubmoduleRecursiveEmbed_OnGradedModules, ### defines: TruncatedSubmoduleRecursiveEmbed (object part)
BindGlobal( "_Functor_TruncatedSubmoduleRecursiveEmbed_OnGradedModules", ### defines: TruncatedSubmoduleRecursiveEmbed (object part)

function( d, M )

return TruncatedSubmoduleEmbed( d + 1, M ) / TruncatedSubmoduleEmbed( d, M );

end );

InstallValue( Functor_TruncatedSubmoduleRecursiveEmbed_ForGradedModules,
BindGlobal( "Functor_TruncatedSubmoduleRecursiveEmbed_ForGradedModules",
CreateHomalgFunctor(
[ "name", "TruncatedSubmoduleRecursiveEmbed" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand Down Expand Up @@ -618,7 +618,7 @@ InstallMethod( RepresentationOfMorphismOnHomogeneousParts,

end );

InstallGlobalFunction( _Functor_HomogeneousPartOverCoefficientsRing_OnGradedModules, ### defines: HomogeneousPartOverCoefficientsRing (object part)
BindGlobal( "_Functor_HomogeneousPartOverCoefficientsRing_OnGradedModules", ### defines: HomogeneousPartOverCoefficientsRing (object part)

function( d, M )
local S, k_graded, k, deg, emb, mat, map_having_submodule_as_its_image,
Expand Down Expand Up @@ -738,7 +738,7 @@ end );


##
InstallGlobalFunction( _Functor_HomogeneousPartOverCoefficientsRing_OnGradedMaps, ### defines: HomogeneousPartOverCoefficientsRing (morphism part)
BindGlobal( "_Functor_HomogeneousPartOverCoefficientsRing_OnGradedMaps", ### defines: HomogeneousPartOverCoefficientsRing (morphism part)
function( F_source, F_target, arg_before_pos, phi, arg_behind_pos )
local S, k, d, mat, result;

Expand All @@ -765,7 +765,7 @@ InstallGlobalFunction( _Functor_HomogeneousPartOverCoefficientsRing_OnGradedMaps

end );

InstallValue( Functor_HomogeneousPartOverCoefficientsRing_ForGradedModules,
BindGlobal( "Functor_HomogeneousPartOverCoefficientsRing_ForGradedModules",
CreateHomalgFunctor(
[ "name", "HomogeneousPartOverCoefficientsRing" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand Down Expand Up @@ -810,7 +810,7 @@ end );
## HomogeneousPartOfDegreeZeroOverCoefficientsRing
##

InstallGlobalFunction( _Functor_HomogeneousPartOfDegreeZeroOverCoefficientsRing_OnGradedModules, ### defines: HomogeneousPartOfDegreeZeroOverCoefficientsRing (object part)
BindGlobal( "_Functor_HomogeneousPartOfDegreeZeroOverCoefficientsRing_OnGradedModules", ### defines: HomogeneousPartOfDegreeZeroOverCoefficientsRing (object part)

function( M )

Expand All @@ -820,14 +820,14 @@ end );


##
InstallGlobalFunction( _Functor_HomogeneousPartOfDegreeZeroOverCoefficientsRing_OnGradedMaps, ### defines: HomogeneousPartOfDegreeZeroOverCoefficientsRing (morphism part)
BindGlobal( "_Functor_HomogeneousPartOfDegreeZeroOverCoefficientsRing_OnGradedMaps", ### defines: HomogeneousPartOfDegreeZeroOverCoefficientsRing (morphism part)
function( F_source, F_target, arg_before_pos, phi, arg_behind_pos )

return HomogeneousPartOverCoefficientsRing( 0, phi );

end );

InstallValue( Functor_HomogeneousPartOfDegreeZeroOverCoefficientsRing_ForGradedModules,
BindGlobal( "Functor_HomogeneousPartOfDegreeZeroOverCoefficientsRing_ForGradedModules",
CreateHomalgFunctor(
[ "name", "HomogeneousPartOfDegreeZeroOverCoefficientsRing" ],
[ "category", HOMALG_GRADED_MODULES.category ],
Expand Down
Loading

0 comments on commit 75c8146

Please sign in to comment.