Skip to content

Commit

Permalink
Merge pull request #653 from zickgraf/misc
Browse files Browse the repository at this point in the history
Miscellaneous changes
  • Loading branch information
zickgraf authored Apr 13, 2021
2 parents e583a56 + dc05bbd commit 30740bf
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CAP/doc/AddFunctions.autodoc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ The record can have the following components, used as described:
* functorial (optional): If an object has a corresponding functorial function, e.g., KernelObject and KernelObjectFunctorial,
the name of the functorial is stored as a string.

* number_of_diagram_arguments: Specifies how many of the arguments (counting from the first argument) of the function specify the diagram of the universal object.
* number_of_diagram_arguments: Specifies how many of the arguments (counting from the second argument, assuming that the first is the category) of the function specify the diagram of the universal object.

* dual_arguments_reversed: Boolean, marks whether for the call of the dual operation all arguments have to be given in reversed order.

Expand Down
7 changes: 7 additions & 0 deletions CAP/gap/CAP.gi
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ InstallGlobalFunction( GET_METHOD_CACHE,

if IsBound( category!.caches.( name ) ) and IsCachingObject( category!.caches.( name ) ) then

if category!.caches.( name )!.nr_keys <> number then

Error( "you have requested a cache for \"", name, "\" with ", number,
" keys but the existing cache with the same name has ", category!.caches.( name )!.nr_keys, " keys" );

fi;

return category!.caches.( name );

fi;
Expand Down
9 changes: 8 additions & 1 deletion CAP/gap/Derivations.gi
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ end );
InstallMethod( AddDerivation,
[ IsDerivedMethodGraphRep, IsDerivedMethod ],
function( G, d )
local method_name, filter_list, number_of_proposed_arguments, current_function_argument_number, impl, op_name;
local method_name, filter_list, number_of_proposed_arguments, current_function_argument_number, current_additional_filter_list_length, impl, op_name;

if IsIdenticalObj( G, CAP_INTERNAL_DERIVATION_GRAPH ) then

Expand All @@ -244,6 +244,13 @@ function( G, d )
" arguments but should have ", String( number_of_proposed_arguments ) );
fi;

current_additional_filter_list_length := Length( impl[ 2 ] );

if current_additional_filter_list_length > 0 and current_additional_filter_list_length <> number_of_proposed_arguments then
Error( "While adding a derivation for ", method_name, ": there are ", String( current_additional_filter_list_length ),
" additional filters but there should be ", String( number_of_proposed_arguments ), " (or none)" );
fi;

od;

if NumberArgumentsFunction( CategoryFilter( d ) ) = 0 or NumberArgumentsFunction( CategoryFilter( d ) ) > 1 then
Expand Down
9 changes: 8 additions & 1 deletion CAP/gap/Finalize.gi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ InstallValue( CAP_INTERNAL_FINAL_DERIVATION_LIST,
BindGlobal( "CAP_INTERNAL_FINAL_DERIVATION_SANITY_CHECK",

function( derivation )
local possible_names, all_operations, function_object, function_string, string_stream, methods_to_check, method_name, filter_list, number_of_proposed_arguments, current_function_argument_number, i, method, impl;
local possible_names, all_operations, function_object, function_string, string_stream, methods_to_check, method_name, filter_list, number_of_proposed_arguments, current_function_argument_number, current_additional_filter_list_length, i, method, impl;

possible_names := derivation!.can_compute;

Expand Down Expand Up @@ -72,6 +72,13 @@ BindGlobal( "CAP_INTERNAL_FINAL_DERIVATION_SANITY_CHECK",
" arguments but should have ", String( number_of_proposed_arguments ) );
fi;

current_additional_filter_list_length := Length( impl[ 2 ] );

if current_additional_filter_list_length > 0 and current_additional_filter_list_length <> number_of_proposed_arguments then
Error( "While adding a final derivation for ", method_name, ": there are ", String( current_additional_filter_list_length ),
" additional filters but there should be ", String( number_of_proposed_arguments ), " (or none)" );
fi;

od;

od;
Expand Down
16 changes: 12 additions & 4 deletions CAP/gap/InstallAdds.gi
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ InstallGlobalFunction( CapInternalInstallAdd,
current_additional_filter_list_length := Length( method_list[ current_function_number ][ 2 ] );

if current_additional_filter_list_length > 0 and current_additional_filter_list_length <> number_of_proposed_arguments then
Error( "In ", add_name, ": the additional filter list of given function ", String( current_function_number ),
" has length ", String( current_additional_filter_list_length ), " but should have ", String( number_of_proposed_arguments ) );
Error( "In ", add_name, ": the additional filter list of given function ", String( current_function_number ), " has length ",
String( current_additional_filter_list_length ), " but should have length ", String( number_of_proposed_arguments ), " (or 0)" );
fi;

fi;
Expand Down Expand Up @@ -626,12 +626,12 @@ BindGlobal( "CAP_INTERNAL_INSTALL_WITH_GIVEN_DERIVATIONS", function( record )
if current_rec.is_with_given then

without_given_name := current_rec.with_given_without_given_name_pair[1];
with_given_name := current_recname;
with_given_name := current_rec.with_given_without_given_name_pair[2];
object_name := current_rec.universal_object;
# first argument is the category
object_arguments := [ 1 .. current_rec.number_of_diagram_arguments + 1 ];

if current_rec.filter_list[1] <> "category" or record.( object_name ).filter_list[1] <> "category" or record.( without_given_name ).filter_list[1] <> "category" then
if record.( without_given_name ).filter_list[1] <> "category" or record.( object_name ).filter_list[1] <> "category" or record.( with_given_name ).filter_list[1] <> "category" then

Display( Concatenation(
"WARNING: You seem to be relying on automatically installed WithGiven derivations but the first arguments of the functions involved are not the category. ",
Expand All @@ -640,6 +640,14 @@ BindGlobal( "CAP_INTERNAL_INSTALL_WITH_GIVEN_DERIVATIONS", function( record )
"Search for `category_as_first_argument` in the documentation for more details."
) );

elif Length( record.( without_given_name ).filter_list ) + 1 <> Length( record.( with_given_name ).filter_list ) then

Display( Concatenation(
"WARNING: You seem to be relying on automatically installed WithGiven derivations. ",
"For this, the with given method must have exactly one additional argument compared to the without given method. ",
"This is not the case, so no automatic WithGiven derivation will be installed."
) );

else

CAP_INTERNAL_INSTALL_WITH_GIVEN_DERIVATION_PAIR( without_given_name, with_given_name, object_name, object_arguments );
Expand Down
24 changes: 17 additions & 7 deletions CAP/gap/MethodRecord.gi
Original file line number Diff line number Diff line change
Expand Up @@ -4394,8 +4394,8 @@ end );

BindGlobal( "CAP_INTERNAL_CREATE_POST_FUNCTION",

function( source_range_object, object_function_name, object_arg_list, object_call_name, object_cache_name )
local object_getter, diagram_name, setter_function, is_attribute, cache_key_length;
function( source_range_object, object_function_name, object_arg_list, object_cache_name )
local object_getter, setter_function, is_attribute, cache_key_length;

if source_range_object = "Source" then
object_getter := Source;
Expand All @@ -4405,7 +4405,6 @@ BindGlobal( "CAP_INTERNAL_CREATE_POST_FUNCTION",
Error( "the first argument of CAP_INTERNAL_CREATE_POST_FUNCTION must be 'Source' or 'Range'" );
fi;

diagram_name := Concatenation( object_call_name, "Diagram" );
setter_function := Setter( ValueGlobal( object_function_name ) );
is_attribute := setter_function <> false;
cache_key_length := Length( object_arg_list );
Expand Down Expand Up @@ -4628,7 +4627,9 @@ InstallGlobalFunction( CAP_INTERNAL_ENHANCE_NAME_RECORD,

## FIXME: If the redirect function is already bound, then this part is superfluous

with_given_name := Concatenation( current_recname, "WithGiven" );
without_given_name := current_recname;

with_given_name := Concatenation( without_given_name, "WithGiven" );

with_given_name_length := Length( with_given_name );

Expand All @@ -4650,7 +4651,7 @@ InstallGlobalFunction( CAP_INTERNAL_ENHANCE_NAME_RECORD,

fi;

current_rec.with_given_without_given_name_pair := [ current_recname, with_given_name ];
current_rec.with_given_without_given_name_pair := [ without_given_name, with_given_name ];

object_name := with_given_name{[ with_given_name_length + 1 .. Length( with_given_name ) ]};

Expand All @@ -4667,7 +4668,7 @@ InstallGlobalFunction( CAP_INTERNAL_ENHANCE_NAME_RECORD,

if not IsBound( current_rec.redirect_function ) then

if current_rec.filter_list[1] <> "category" or record.( object_name ).filter_list[1] <> "category" or record.( with_given_name ).filter_list[1] <> "category" then
if record.( without_given_name ).filter_list[1] <> "category" or record.( object_name ).filter_list[1] <> "category" or record.( with_given_name ).filter_list[1] <> "category" then

Display( Concatenation(
"WARNING: You seem to be relying on automatically installed redirect functions but the first arguments of the functions involved are not the category. ",
Expand All @@ -4676,6 +4677,15 @@ InstallGlobalFunction( CAP_INTERNAL_ENHANCE_NAME_RECORD,
"Search for `category_as_first_argument` in the documentation for more details."
) );

elif Length( record.( without_given_name ).filter_list ) + 1 <> Length( record.( with_given_name ).filter_list ) then

Display( Concatenation(
"WARNING: You seem to be relying on automatically installed redirect functions. ",
"For this, the with given method must have exactly one additional argument compared to the without given method. ",
"This is not the case, so no automatic redirect function will be installed. ",
"Install a custom redirect function to prevent this warning."
) );

else

current_rec.redirect_function := CAP_INTERNAL_CREATE_REDIRECTION( with_given_name, object_func, object_arg_list, object_func );
Expand All @@ -4697,7 +4707,7 @@ InstallGlobalFunction( CAP_INTERNAL_ENHANCE_NAME_RECORD,

else

current_rec.post_function := CAP_INTERNAL_CREATE_POST_FUNCTION( current_rec.universal_object_position, object_func, object_arg_list, object_name, object_func );
current_rec.post_function := CAP_INTERNAL_CREATE_POST_FUNCTION( current_rec.universal_object_position, object_func, object_arg_list, object_func );

fi;

Expand Down
6 changes: 6 additions & 0 deletions CAP/gap/OppositeCategory.gi
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ BindGlobal( "CAP_INTERNAL_INSTALL_OPPOSITE_ADDS_FROM_CATEGORY",

dual_name := current_entry.dual_operation;

if not IsBound( CAP_INTERNAL_METHOD_NAME_RECORD.( dual_name ) ) then

Error( "the dual operation must be a CAP operation" );

fi;

if CurrentOperationWeight( category_weight_list, dual_name ) = infinity then
continue;
fi;
Expand Down
21 changes: 20 additions & 1 deletion CAP/gap/UniversalObjects.gd
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,15 @@ DeclareOperation( "AddInitialObjectFunctorial",

## Main Operations and Attributes

#! @Description
#! This is a convenience method.
#! There are two different ways to use this method:
#! * The argument is a list of objects $D = (S_1, \dots, S_n)$.
#! * The arguments are objects $S_1, \dots, S_n$.
#! The output is the direct sum $\bigoplus_{i=1}^n S_i$.
#! @Returns an object
# DeclareGlobalFunction( "DirectSum" ); # already defined by GAP

#! @Description
#! The argument is a list of objects $D = (S_1, \dots, S_n)$.
#! The output is the direct sum $\bigoplus_{i=1}^n S_i$.
Expand Down Expand Up @@ -2239,6 +2248,16 @@ DeclareOperation( "AddCoproductFunctorialWithGivenCoproducts",


## Main Operations and Attributes

#! @Description
#! This is a convenience method.
#! There are two different ways to use this method:
#! * The argument is a list of objects $D = ( P_1, \dots, P_n )$.
#! * The arguments are objects $P_1, \dots, P_n$.
#! The output is the direct product $\prod_{i=1}^n P_i$.
#! @Returns an object
# DeclareGlobalFunction( "DirectProduct" ); # already defined by GAP

#! @Description
#! The argument is a list of objects $D = ( P_1, \dots, P_n )$.
#! The output is the direct product $\prod_{i=1}^n P_i$.
Expand Down Expand Up @@ -3857,7 +3876,7 @@ DeclareOperation( "AddDirectSumProjectionInPushout",
[ IsCapCategory, IsList ] );

#! @Description
#! The argument is a list of morphisms $D = ( \beta_i: B \rightarrow I_i )_{i = 1 \dots n}$
#! The argument is a list of morphisms $D = ( \beta_i: B \rightarrow I_i )_{i = 1 \dots n}$.
#! The output is the pushout $\mathrm{Pushout}(D)$.
#! @Returns an object
#! @Arguments D
Expand Down
61 changes: 60 additions & 1 deletion CAP/gap/UniversalObjects.gi
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ InstallMethod( KernelObjectFunctorial,

function( morphism_of_morphisms )

Print(
Concatenation(
"WARNING: KernelObjectFunctorial( IsList ) is deprecated and will not be supported after 2022.03.18. ",
"Please use KernelObjectFunctorial( IsCapCategoryMorphism, IsCapCategoryMorphism, IsCapCategoryMorphism ) instead.\n"
)
);

return KernelObjectFunctorialWithGivenKernelObjects(
KernelObject( morphism_of_morphisms[1] ),
morphism_of_morphisms[1], morphism_of_morphisms[2][1], morphism_of_morphisms[3],
Expand All @@ -35,6 +42,15 @@ InstallMethod( KernelObjectFunctorialWithGivenKernelObjects,

function( s, alpha, mu, nu, alpha_prime, r )

Print(
Concatenation(
"WARNING: KernelObjectFunctorialWithGivenKernelObjects( IsCapCategoryObject, IsCapCategoryMorphism, IsCapCategoryMorphism, ",
"IsCapCategoryMorphism, IsCapCategoryMorphism, IsCapCategoryObject ) is deprecated and will not be supported after 2022.03.18. ",
"Please use KernelObjectFunctorialWithGivenKernelObjects( IsCapCategoryObject, IsCapCategoryMorphism, IsCapCategoryMorphism, ",
"IsCapCategoryMorphism, IsCapCategoryObject ) instead.\n"
)
);

return KernelObjectFunctorialWithGivenKernelObjects(
s, alpha, mu, alpha_prime, r );

Expand All @@ -56,6 +72,13 @@ InstallMethod( CokernelObjectFunctorial,

function( morphism_of_morphisms )

Print(
Concatenation(
"WARNING: CokernelObjectFunctorial( IsList ) is deprecated and will not be supported after 2022.03.18. ",
"Please use CokernelObjectFunctorial( IsCapCategoryMorphism, IsCapCategoryMorphism, IsCapCategoryMorphism ) instead.\n"
)
);

return CokernelObjectFunctorialWithGivenCokernelObjects(
CokernelObject( morphism_of_morphisms[1] ),
morphism_of_morphisms[1], morphism_of_morphisms[2][2], morphism_of_morphisms[3],
Expand All @@ -70,6 +93,15 @@ InstallMethod( CokernelObjectFunctorialWithGivenCokernelObjects,

function( s, alpha, mu, nu, alpha_prime, r )

Print(
Concatenation(
"WARNING: CokernelObjectFunctorialWithGivenCokernelObjects( IsCapCategoryObject, IsCapCategoryMorphism, IsCapCategoryMorphism, ",
"IsCapCategoryMorphism, IsCapCategoryMorphism, IsCapCategoryObject ) is deprecated and will not be supported after 2022.03.18. ",
"Please use CokernelObjectFunctorialWithGivenCokernelObjects( IsCapCategoryObject, IsCapCategoryMorphism, IsCapCategoryMorphism, ",
"IsCapCategoryMorphism, IsCapCategoryObject ) instead.\n"
)
);

return CokernelObjectFunctorialWithGivenCokernelObjects(
s, alpha, nu, alpha_prime, r );

Expand Down Expand Up @@ -371,14 +403,20 @@ InstallMethod( MorphismBetweenDirectSums,

end );

## TODO: is this deprecated?
##
InstallMethod( MorphismBetweenDirectSumsOp,
[ IsList, IsInt, IsInt ],

function( morphism_matrix_listlist, rows, cols )
local morphism_matrix, i, diagram_direct_sum_source, diagram_direct_sum_range, test_diagram_product, test_diagram_coproduct, morphism_into_product;

Print(
Concatenation(
"WARNING: MorphismBetweenDirectSums( IsList, IsInt, IsInt ) is deprecated and will not be supported after 2022.03.18. ",
"Please use MorphismBetweenDirectSums( IsList ) instead.\n"
)
);

morphism_matrix := [ ];

for i in [ 1 .. rows ] do
Expand Down Expand Up @@ -407,6 +445,13 @@ InstallMethod( ZeroObject,

function( cell )

Print(
Concatenation(
"WARNING: ZeroObject( IsCapCategoryCell ) is deprecated and will not be supported after 2022.03.18. ",
"Please use ZeroObject( IsCapCategory ) instead.\n"
)
);

return ZeroObject( CapCategory( cell ) );

end );
Expand Down Expand Up @@ -447,6 +492,13 @@ InstallMethod( TerminalObject,

function( cell )

Print(
Concatenation(
"WARNING: TerminalObject( IsCapCategoryCell ) is deprecated and will not be supported after 2022.03.18. ",
"Please use TerminalObject( IsCapCategory ) instead.\n"
)
);

return TerminalObject( CapCategory( cell ) );

end );
Expand All @@ -467,6 +519,13 @@ InstallMethod( InitialObject,

function( cell )

Print(
Concatenation(
"WARNING: InitialObject( IsCapCategoryCell ) is deprecated and will not be supported after 2022.03.18. ",
"Please use InitialObject( IsCapCategory ) instead.\n"
)
);

return InitialObject( CapCategory( cell ) );

end );
Expand Down
4 changes: 2 additions & 2 deletions FreydCategoriesForCAP/examples/GradedRowsAndColumns.g
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ Display( InternalHomOnObjects( ObjectR, ObjectR ) );
#! @Example
aR := GradedRow( [ [ [1,0], 1 ] ], S );
#! <A graded row of rank 1>
bR := ZeroObject( aR );
bR := ZeroObject( CapCategory( aR ) );
#! <A graded row of rank 0>
coevR := CoevaluationForDual( bR );
#! <A morphism in Category of graded rows over Q[x_1,x_2,x_3,x_4]
Expand Down Expand Up @@ -1160,7 +1160,7 @@ IsWellDefined( tens_mor );
#! @Example
aC := GradedColumn( [ [ [1,0], 1 ] ], S );
#! <A graded column of rank 1>
bC := ZeroObject( aC );
bC := ZeroObject( CapCategory( aC ) );
#! <A graded column of rank 0>
coevC := CoevaluationForDual( bC );
#! <A morphism in Category of graded columns over Q[x_1,x_2,x_3,x_4]
Expand Down

0 comments on commit 30740bf

Please sign in to comment.