From 75f216b4075ea616c65730124da098c5cbf1908c Mon Sep 17 00:00:00 2001 From: Fabian Zickgraf Date: Thu, 26 Sep 2024 15:18:50 +0200 Subject: [PATCH 1/4] Simplify AddPrimitiveOperation and improve DerivationInfo --- CAP/gap/Derivations.gi | 13 ++----------- CAP/gap/Finalize.gi | 8 +++++++- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CAP/gap/Derivations.gi b/CAP/gap/Derivations.gi index 5a5750f110..fc2752b856 100644 --- a/CAP/gap/Derivations.gi +++ b/CAP/gap/Derivations.gi @@ -452,7 +452,7 @@ BindGlobal( "TryToInstallDerivation", function ( owl, d ) if new_weight < current_weight or (new_weight = current_weight and current_derivation <> fail and d!.position_in_derivations_by_target < current_derivation!.position_in_derivations_by_target) then - Info( DerivationInfo, 1, Concatenation( "install(", + Info( DerivationInfo, 1, Concatenation( "derive(", String( new_weight ), ") ", target, @@ -525,18 +525,9 @@ end ); InstallMethod( AddPrimitiveOperation, [ IsOperationWeightList, IsString, IsInt ], function( owl, op_name, new_weight ) - local current_weight; - - Info( DerivationInfo, 1, Concatenation( "install(", - String( new_weight ), - ") ", - op_name, - ": primitive installation\n" ) ); - - current_weight := owl!.operation_weights.( op_name ); owl!.operation_weights.( op_name ) := new_weight; - owl!.operation_derivations.( op_name ) := fail; + Assert( 0, owl!.operation_derivations.( op_name ) = fail ); end ); diff --git a/CAP/gap/Finalize.gi b/CAP/gap/Finalize.gi index b50604e394..11c81effb5 100644 --- a/CAP/gap/Finalize.gi +++ b/CAP/gap/Finalize.gi @@ -318,6 +318,12 @@ InstallMethod( Finalize, if weight_list!.operation_weights.(op_name) <> infinity and weight_list!.operation_derivations.(op_name) = fail then + Info( DerivationInfo, 1, Concatenation( "add(", + String( weight_list!.operation_weights.(op_name) ), + ") ", + op_name, + ": primitive installation\n" ) ); + InstallDerivationsUsingOperation( weight_list, op_name ); fi; @@ -390,7 +396,7 @@ InstallMethod( Finalize, # the derivations provided in the bundle. if new_weight <= current_weight then - Info( DerivationInfo, 1, Concatenation( "install(", + Info( DerivationInfo, 1, Concatenation( "derive(", String( new_weight ), ") ", op_name, From 65739ae67c59f95ad1d617c3a044b8cab061fd17 Mon Sep 17 00:00:00 2001 From: Fabian Zickgraf Date: Thu, 26 Sep 2024 15:41:34 +0200 Subject: [PATCH 2/4] Use `CanCompute` at more places --- ActionsForCAP/gap/ActionsCategory.gi | 26 +++++++------------ ActionsForCAP/gap/CoactionsCategory.gi | 25 +++++++----------- CAP/gap/ProductCategory.gi | 6 ++--- .../gap/CocomplexCategory.gi | 6 ++--- .../gap/FilteredObjects.gi | 6 ++--- .../gap/ZFunctors.gi | 6 ++--- .../GeneralizedMorphismCategoryByCospans.gi | 10 +++---- .../gap/GeneralizedMorphismCategoryBySpans.gi | 10 +++---- ...eneralizedMorphismCategoryByThreeArrows.gi | 10 +++---- .../gap/SerreQuotientsByCospans.gi | 6 ++--- .../gap/SerreQuotientsBySpans.gi | 6 ++--- .../gap/SerreQuotientsByThreeArrows.gi | 6 ++--- 12 files changed, 46 insertions(+), 77 deletions(-) diff --git a/ActionsForCAP/gap/ActionsCategory.gi b/ActionsForCAP/gap/ActionsCategory.gi index 85be93e42d..8989edadfc 100644 --- a/ActionsForCAP/gap/ActionsCategory.gi +++ b/ActionsForCAP/gap/ActionsCategory.gi @@ -30,7 +30,7 @@ InstallMethod( LeftActionsCategory, [ IsCapCategoryObject, IsString, IsList ], function( acting_object, name, context_filter_list ) - local underlying_monoidal_category, preconditions, category_weight_list, i, + local underlying_monoidal_category, preconditions, i, structure_record, object_constructor, morphism_constructor, left_actions_category, identity_of_acting_object, tensor_preserves_epis; @@ -111,14 +111,11 @@ InstallMethod( LeftActionsCategory, end; - ## - category_weight_list := underlying_monoidal_category!.derivations_weight_list; - ## Left action for ZeroObject preconditions := [ "UniversalMorphismIntoZeroObject", "TensorProductOnObjects" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then structure_record.ZeroObject := function( underlying_zero_object ) @@ -134,7 +131,7 @@ InstallMethod( LeftActionsCategory, "DirectSumFunctorialWithGivenDirectSums", "PreCompose" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then structure_record.DirectSum := function( obj_list, underlying_direct_sum ) @@ -160,7 +157,7 @@ InstallMethod( LeftActionsCategory, "TensorProductOnObjects", #belongs to TensorProductOnMorphisms "LiftAlongMonomorphism" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then identity_of_acting_object := IdentityMorphism( acting_object ); @@ -193,7 +190,7 @@ InstallMethod( LeftActionsCategory, Add( preconditions, "Colift" ); fi; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then identity_of_acting_object := IdentityMorphism( acting_object ); @@ -285,7 +282,7 @@ InstallMethod( RightActionsCategory, [ IsCapCategoryObject, IsString, IsList ], function( acting_object, name, context_filter_list ) - local underlying_monoidal_category, preconditions, category_weight_list, i, + local underlying_monoidal_category, preconditions, i, structure_record, object_constructor, morphism_constructor, right_actions_category, identity_of_acting_object, tensor_preserves_epis; @@ -366,14 +363,11 @@ InstallMethod( RightActionsCategory, end; - ## - category_weight_list := underlying_monoidal_category!.derivations_weight_list; - ## Right action for ZeroObject preconditions := [ "UniversalMorphismIntoZeroObject", "TensorProductOnObjects" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then structure_record.ZeroObject := function( underlying_zero_object ) @@ -389,7 +383,7 @@ InstallMethod( RightActionsCategory, "DirectSumFunctorialWithGivenDirectSums", "PreCompose" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then structure_record.DirectSum := function( obj_list, underlying_direct_sum ) @@ -415,7 +409,7 @@ InstallMethod( RightActionsCategory, "TensorProductOnObjects", #belongs to TensorProductOnMorphisms "LiftAlongMonomorphism" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then identity_of_acting_object := IdentityMorphism( acting_object ); @@ -448,7 +442,7 @@ InstallMethod( RightActionsCategory, Add( preconditions, "Colift" ); fi; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then identity_of_acting_object := IdentityMorphism( acting_object ); diff --git a/ActionsForCAP/gap/CoactionsCategory.gi b/ActionsForCAP/gap/CoactionsCategory.gi index 5c2793646f..d9301a04c0 100644 --- a/ActionsForCAP/gap/CoactionsCategory.gi +++ b/ActionsForCAP/gap/CoactionsCategory.gi @@ -29,7 +29,7 @@ InstallMethod( LeftCoactionsCategory, [ IsCapCategoryObject, IsString, IsList ], function( coacting_object, name, context_filter_list ) - local underlying_monoidal_category, preconditions, category_weight_list, i, + local underlying_monoidal_category, preconditions, i, structure_record, object_constructor, morphism_constructor, left_coactions_category, identity_of_coacting_object; @@ -110,14 +110,11 @@ InstallMethod( LeftCoactionsCategory, end; - ## - category_weight_list := underlying_monoidal_category!.derivations_weight_list; - ## Left coaction for ZeroObject preconditions := [ "UniversalMorphismIntoZeroObject", "TensorProductOnObjects" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then structure_record.ZeroObject := function( underlying_zero_object ) @@ -133,7 +130,7 @@ InstallMethod( LeftCoactionsCategory, "DirectSumFunctorialWithGivenDirectSums", "PreCompose" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then structure_record.DirectSum := function( obj_list, underlying_direct_sum ) @@ -160,7 +157,7 @@ InstallMethod( LeftCoactionsCategory, "TensorProductOnObjects", #belongs to TensorProductOnMorphisms "Lift" ]; #we can't use LiftAlongMonomorphism here because we don't know if the tensor product is left exact - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then identity_of_coacting_object := IdentityMorphism( coacting_object ); @@ -185,7 +182,7 @@ InstallMethod( LeftCoactionsCategory, "TensorProductOnObjects", #belongs to TensorProductOnMorphisms "ColiftAlongEpimorphism" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then identity_of_coacting_object := IdentityMorphism( coacting_object ); @@ -263,7 +260,7 @@ InstallMethod( RightCoactionsCategory, [ IsCapCategoryObject, IsString, IsList ], function( coacting_object, name, context_filter_list ) - local underlying_monoidal_category, preconditions, category_weight_list, i, + local underlying_monoidal_category, preconditions, i, structure_record, object_constructor, morphism_constructor, right_coactions_category, identity_of_coacting_object; @@ -345,13 +342,11 @@ InstallMethod( RightCoactionsCategory, end; ## - category_weight_list := underlying_monoidal_category!.derivations_weight_list; - ## Right coaction for ZeroObject preconditions := [ "UniversalMorphismIntoZeroObject", "TensorProductOnObjects" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then structure_record.ZeroObject := function( underlying_zero_object ) @@ -367,7 +362,7 @@ InstallMethod( RightCoactionsCategory, "DirectSumFunctorialWithGivenDirectSums", "PreCompose" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then structure_record.DirectSum := function( obj_list, underlying_direct_sum ) @@ -394,7 +389,7 @@ InstallMethod( RightCoactionsCategory, "TensorProductOnObjects", #belongs to TensorProductOnMorphisms "Lift" ]; #we can't use LiftAlongMonomorphism here because we don't know if the tensor product is left exact - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then identity_of_coacting_object := IdentityMorphism( coacting_object ); @@ -419,7 +414,7 @@ InstallMethod( RightCoactionsCategory, "TensorProductOnObjects", #belongs to TensorProductOnMorphisms "ColiftAlongEpimorphism" ]; - if ForAll( preconditions, c -> CurrentOperationWeight( category_weight_list, c ) < infinity ) then + if ForAll( preconditions, c -> CanCompute( underlying_monoidal_category, c ) ) then identity_of_coacting_object := IdentityMorphism( coacting_object ); diff --git a/CAP/gap/ProductCategory.gi b/CAP/gap/ProductCategory.gi index e4bd688579..eda7ec75ca 100644 --- a/CAP/gap/ProductCategory.gi +++ b/CAP/gap/ProductCategory.gi @@ -130,15 +130,13 @@ end ); BindGlobal( "CAP_INTERNAL_INSTALL_PRODUCT_ADDS_FROM_CATEGORY", function( product_category ) - local recnames, current_recname, category_weight_list, current_entry, func, + local recnames, current_recname, current_entry, func, current_add, create_func, components; recnames := RecNames( CAP_INTERNAL_METHOD_NAME_RECORD ); components := Components( product_category ); - category_weight_list := List( components, category -> category!.derivations_weight_list ); - for current_recname in recnames do current_entry := CAP_INTERNAL_METHOD_NAME_RECORD.( current_recname ); @@ -151,7 +149,7 @@ BindGlobal( "CAP_INTERNAL_INSTALL_PRODUCT_ADDS_FROM_CATEGORY", continue; fi; - if ForAny( category_weight_list, list -> CurrentOperationWeight( list, current_recname ) = infinity ) then + if ForAny( components, category -> not CanCompute( category, current_recname ) ) then continue; fi; diff --git a/ComplexesAndFilteredObjectsForCAP/gap/CocomplexCategory.gi b/ComplexesAndFilteredObjectsForCAP/gap/CocomplexCategory.gi index 5b4cee583a..8b7f34afaa 100644 --- a/ComplexesAndFilteredObjectsForCAP/gap/CocomplexCategory.gi +++ b/ComplexesAndFilteredObjectsForCAP/gap/CocomplexCategory.gi @@ -711,7 +711,7 @@ BindGlobal( "INSTALL_ALL_ADDS_COMPLEX_COCOMPLEX", InstallGlobalFunction( ValueGlobal( Concatenation( "INSTALL_OPERATIONS_FOR_", name_part, "_CATEGORY" ) ), function( category ) - local z_functor_category, install_entries, entry, weight_list; + local z_functor_category, install_entries, entry; z_functor_category := ZFunctorCategory( category ); @@ -791,11 +791,9 @@ BindGlobal( "INSTALL_ALL_ADDS_COMPLEX_COCOMPLEX", ]; - weight_list := z_functor_category!.derivations_weight_list; - for entry in install_entries do - if ForAll( entry[ 1 ], i -> CurrentOperationWeight( weight_list, i ) < infinity ) then + if ForAll( entry[ 1 ], i -> CanCompute( z_functor_category, i ) ) then entry[ 2 ]( category ); diff --git a/ComplexesAndFilteredObjectsForCAP/gap/FilteredObjects.gi b/ComplexesAndFilteredObjectsForCAP/gap/FilteredObjects.gi index 75cfae65b9..a1ab464abe 100644 --- a/ComplexesAndFilteredObjectsForCAP/gap/FilteredObjects.gi +++ b/ComplexesAndFilteredObjectsForCAP/gap/FilteredObjects.gi @@ -487,7 +487,7 @@ BindGlobal( "INSTALL_ALL_ADDS_FILTERED", InstallGlobalFunction( ValueGlobal( Concatenation( "INSTALL_OPERATIONS_FOR_", name_part, "_CATEGORY" ) ), function( category ) - local z_functor_category, install_entries, entry, weight_list; + local z_functor_category, install_entries, entry; z_functor_category := ZFunctorCategory( category ); @@ -541,11 +541,9 @@ BindGlobal( "INSTALL_ALL_ADDS_FILTERED", ]; - weight_list := z_functor_category!.derivations_weight_list; - for entry in install_entries do - if ForAll( entry[ 1 ], i -> CurrentOperationWeight( weight_list, i ) < infinity ) then + if ForAll( entry[ 1 ], i -> CanCompute( z_functor_category, i ) ) then entry[ 2 ]( category ); diff --git a/ComplexesAndFilteredObjectsForCAP/gap/ZFunctors.gi b/ComplexesAndFilteredObjectsForCAP/gap/ZFunctors.gi index 78eb3963df..9b2b2e9ecd 100644 --- a/ComplexesAndFilteredObjectsForCAP/gap/ZFunctors.gi +++ b/ComplexesAndFilteredObjectsForCAP/gap/ZFunctors.gi @@ -984,7 +984,7 @@ end ); InstallGlobalFunction( INSTALL_OPERATIONS_FOR_ZFUNCTOR_CATEGORY, function( category ) - local install_entries, entry, weight_list; + local install_entries, entry; install_entries := [ [ [ "PreCompose" ], ADD_PRECOMPOSE_IN_Z_FUNCTORS ], @@ -1061,11 +1061,9 @@ InstallGlobalFunction( INSTALL_OPERATIONS_FOR_ZFUNCTOR_CATEGORY, ]; - weight_list := category!.derivations_weight_list; - for entry in install_entries do - if ForAll( entry[ 1 ], i -> CurrentOperationWeight( weight_list, i ) < infinity ) then + if ForAll( entry[ 1 ], i -> CanCompute( category, i ) ) then entry[ 2 ]( category ); diff --git a/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryByCospans.gi b/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryByCospans.gi index feb10fa1a8..bcd47540d1 100644 --- a/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryByCospans.gi +++ b/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryByCospans.gi @@ -172,7 +172,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_GENERALIZED_MORPHISM_CATEGORY_BY_CO end ); - if CurrentOperationWeight( underlying_honest_category!.derivations_weight_list, "IsWellDefinedForObjects" ) < infinity then + if CanCompute( underlying_honest_category, "IsWellDefinedForObjects" ) then AddIsWellDefinedForObjects( category, @@ -184,7 +184,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_GENERALIZED_MORPHISM_CATEGORY_BY_CO fi; - if CurrentOperationWeight( underlying_honest_category!.derivations_weight_list, "IsWellDefinedForMorphisms" ) < infinity then + if CanCompute( underlying_honest_category, "IsWellDefinedForMorphisms" ) then AddIsWellDefinedForMorphisms( category, @@ -228,7 +228,7 @@ InstallMethod( GeneralizedMorphismCategoryByCospans, [ IsCapCategory ], function( category ) - local name, generalized_morphism_category, category_weight_list, i, preconditions; + local name, generalized_morphism_category, i, preconditions; if not IsFinalized( category ) then @@ -258,11 +258,9 @@ InstallMethod( GeneralizedMorphismCategoryByCospans, "CoastrictionToImage", "ImageEmbedding" ]; - category_weight_list := category!.derivations_weight_list; - for i in preconditions do - if CurrentOperationWeight( category_weight_list, i ) = infinity then + if not CanCompute( category, i ) then Error( Concatenation( "category must be able to compute ", i ) ); return; diff --git a/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryBySpans.gi b/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryBySpans.gi index 6d95b25f31..8d81ff39f3 100644 --- a/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryBySpans.gi +++ b/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryBySpans.gi @@ -165,7 +165,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_GENERALIZED_MORPHISM_CATEGORY_BY_SP end ); - if CurrentOperationWeight( underlying_honest_category!.derivations_weight_list, "IsWellDefinedForObjects" ) < infinity then + if CanCompute( underlying_honest_category, "IsWellDefinedForObjects" ) then AddIsWellDefinedForObjects( category, @@ -177,7 +177,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_GENERALIZED_MORPHISM_CATEGORY_BY_SP fi; - if CurrentOperationWeight( underlying_honest_category!.derivations_weight_list, "IsWellDefinedForMorphisms" ) < infinity then + if CanCompute( underlying_honest_category, "IsWellDefinedForMorphisms" ) then AddIsWellDefinedForMorphisms( category, @@ -224,7 +224,7 @@ InstallMethod( GeneralizedMorphismCategoryBySpans, [ IsCapCategory ], function( category ) - local name, generalized_morphism_category, category_weight_list, i, preconditions; + local name, generalized_morphism_category, i, preconditions; if not IsFinalized( category ) then @@ -254,11 +254,9 @@ InstallMethod( GeneralizedMorphismCategoryBySpans, "CoastrictionToImage", "ImageEmbedding" ]; - category_weight_list := category!.derivations_weight_list; - for i in preconditions do - if CurrentOperationWeight( category_weight_list, i ) = infinity then + if not CanCompute( category, i ) then Error( Concatenation( "category must be able to compute ", i ) ); return; diff --git a/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryByThreeArrows.gi b/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryByThreeArrows.gi index 6f0e51e180..7f00378b1c 100644 --- a/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryByThreeArrows.gi +++ b/GeneralizedMorphismsForCAP/gap/GeneralizedMorphismCategoryByThreeArrows.gi @@ -223,7 +223,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_GENERALIZED_MORPHISM_BY_THREE_ARROW end ); - if CurrentOperationWeight( underlying_honest_category!.derivations_weight_list, "IsWellDefinedForObjects" ) < infinity then + if CanCompute( underlying_honest_category, "IsWellDefinedForObjects" ) then AddIsWellDefinedForObjects( category, @@ -235,7 +235,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_GENERALIZED_MORPHISM_BY_THREE_ARROW fi; - if CurrentOperationWeight( underlying_honest_category!.derivations_weight_list, "IsWellDefinedForMorphisms" ) < infinity then + if CanCompute( underlying_honest_category, "IsWellDefinedForMorphisms" ) then AddIsWellDefinedForMorphisms( category, @@ -276,7 +276,7 @@ InstallMethod( GeneralizedMorphismCategoryByThreeArrows, [ IsCapCategory ], function( category ) - local name, generalized_morphism_category, category_weight_list, i, preconditions; + local name, generalized_morphism_category, i, preconditions; if not IsFinalized( category ) then @@ -306,11 +306,9 @@ InstallMethod( GeneralizedMorphismCategoryByThreeArrows, "CoastrictionToImage", "ImageEmbedding" ]; - category_weight_list := category!.derivations_weight_list; - for i in preconditions do - if CurrentOperationWeight( category_weight_list, i ) = infinity then + if not CanCompute( category, i ) then Error( Concatenation( "category must be able to compute ", i ) ); return; diff --git a/GeneralizedMorphismsForCAP/gap/SerreQuotientsByCospans.gi b/GeneralizedMorphismsForCAP/gap/SerreQuotientsByCospans.gi index 1d6007eeed..2aefe2dff4 100644 --- a/GeneralizedMorphismsForCAP/gap/SerreQuotientsByCospans.gi +++ b/GeneralizedMorphismsForCAP/gap/SerreQuotientsByCospans.gi @@ -357,7 +357,7 @@ InstallMethodWithCacheFromObject( SerreQuotientCategoryByCospans, [ IsCapCategory, IsFunction, IsString ], function( category, test_function, function_name ) - local serre_category, gen_category, name, preconditions, category_weight_list, i; + local serre_category, gen_category, name, preconditions, i; if not IsFinalized( category ) then @@ -380,11 +380,9 @@ InstallMethodWithCacheFromObject( SerreQuotientCategoryByCospans, "KernelEmbedding", "CokernelProjection" ]; - category_weight_list := category!.derivations_weight_list; - for i in preconditions do - if CurrentOperationWeight( category_weight_list, i ) = infinity then + if not CanCompute( category, i ) then Error( Concatenation( "category must be able to compute ", i ) ); return; diff --git a/GeneralizedMorphismsForCAP/gap/SerreQuotientsBySpans.gi b/GeneralizedMorphismsForCAP/gap/SerreQuotientsBySpans.gi index c8b0010830..3153611ab8 100644 --- a/GeneralizedMorphismsForCAP/gap/SerreQuotientsBySpans.gi +++ b/GeneralizedMorphismsForCAP/gap/SerreQuotientsBySpans.gi @@ -427,7 +427,7 @@ InstallMethodWithCacheFromObject( SerreQuotientCategoryBySpans, [ IsCapCategory, IsFunction, IsString ], function( category, test_function, function_name ) - local serre_category, gen_category, name, preconditions, category_weight_list, i; + local serre_category, gen_category, name, preconditions, i; if not IsFinalized( category ) then @@ -450,11 +450,9 @@ InstallMethodWithCacheFromObject( SerreQuotientCategoryBySpans, "KernelEmbedding", "CokernelProjection" ]; - category_weight_list := category!.derivations_weight_list; - for i in preconditions do - if CurrentOperationWeight( category_weight_list, i ) = infinity then + if not CanCompute( category, i ) then Error( Concatenation( "category must be able to compute ", i ) ); return; diff --git a/GeneralizedMorphismsForCAP/gap/SerreQuotientsByThreeArrows.gi b/GeneralizedMorphismsForCAP/gap/SerreQuotientsByThreeArrows.gi index 2baf746d6b..6276a2ea66 100644 --- a/GeneralizedMorphismsForCAP/gap/SerreQuotientsByThreeArrows.gi +++ b/GeneralizedMorphismsForCAP/gap/SerreQuotientsByThreeArrows.gi @@ -381,7 +381,7 @@ InstallMethodWithCacheFromObject( SerreQuotientCategoryByThreeArrows, [ IsCapCategory, IsFunction, IsString ], function( category, test_function, function_name ) - local serre_category, gen_category, name, preconditions, category_weight_list, i; + local serre_category, gen_category, name, preconditions, i; if not IsFinalized( category ) then @@ -404,11 +404,9 @@ InstallMethodWithCacheFromObject( SerreQuotientCategoryByThreeArrows, "KernelEmbedding", "CokernelProjection" ]; - category_weight_list := category!.derivations_weight_list; - for i in preconditions do - if CurrentOperationWeight( category_weight_list, i ) = infinity then + if not CanCompute( category, i ) then Error( Concatenation( "category must be able to compute ", i ) ); return; From 3cdf9c488386268d1320e9c481a6093983ce8549 Mon Sep 17 00:00:00 2001 From: Fabian Zickgraf Date: Thu, 26 Sep 2024 16:25:18 +0200 Subject: [PATCH 3/4] Rename `MakeDerivation` to `CreateDerivation and change the order of the arguments --- CAP/gap/Derivations.gd | 15 ++++++--------- CAP/gap/Derivations.gi | 20 +++++++++++--------- CAP/gap/Finalize.gi | 12 ++++++------ 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/CAP/gap/Derivations.gd b/CAP/gap/Derivations.gd index a67f600e87..27c8022a5b 100644 --- a/CAP/gap/Derivations.gd +++ b/CAP/gap/Derivations.gd @@ -36,11 +36,9 @@ DeclareCategory( "IsDerivedMethod", IsAttributeStoringRep ); #! @Description #! Creates a new derivation object. -#! The argument name is an arbitrary name used to -#! identify this derivation, and is useful only for debugging -#! purposes. #! The argument target_op_name is the name of the operation which #! the derived method implements. +#! The argument description should describe the derivation. #! The argument used_ops_with_multiples contains #! #! * the name of each operation used by the derived method, @@ -53,23 +51,22 @@ DeclareCategory( "IsDerivedMethod", IsAttributeStoringRep ); #! category for which this derivation will be installed, #! and return a category for which the operation in the first #! entry must be installed for the derivation to be considered applicable. +#! The argument func contains the actual implementation of the +#! derived method. #! The argument weight is an additional number to add #! when calculating the resulting weight of the target operation #! using this derivation. Unless there is any particular reason #! to regard the derivation as exceedingly expensive, this number #! should be 1. -#! The argument func contains the actual implementation of the -#! derived method. #! The argument category_filter is a filter (or function) describing #! which categories the derivation is valid for. If it is valid #! for all categories, then this argument should have the value #! IsCapCategory. The output of category_filter must not #! change during the installation of operations. In particular, it must #! not rely on `CanCompute` to check conditions. -#! @Arguments name, target_op, used_ops_with_multiples, weight, func, category_filter -DeclareOperation( "MakeDerivation", - [ IsString, IsString, IsDenseList, - IsPosInt, IsFunction, IsFunction ] ); +#! @Arguments target_op_name, description, used_ops_with_multiples, func, weight, category_filter +DeclareOperation( "CreateDerivation", + [ IsString, IsString, IsDenseList, IsFunction, IsPosInt, IsFunction ] ); #! @Description #! A description of the derivation. diff --git a/CAP/gap/Derivations.gi b/CAP/gap/Derivations.gi index fc2752b856..8da123bbb4 100644 --- a/CAP/gap/Derivations.gi +++ b/CAP/gap/Derivations.gi @@ -26,10 +26,10 @@ InstallGlobalFunction( "DeactivateDerivationInfo", SetInfoLevel( DerivationInfo, 0 ); end ); -InstallMethod( MakeDerivation, - [ IsString, IsString, IsDenseList, IsPosInt, IsFunction, IsFunction ], +InstallMethod( CreateDerivation, + [ IsString, IsString, IsDenseList, IsFunction, IsPosInt, IsFunction ], -function( description, target_op_name, used_op_names_with_multiples_and_category_getters, weight, func, category_filter ) +function( target_op_name, description, used_op_names_with_multiples_and_category_getters, func, weight, category_filter ) local wrapped_category_filter, derivation; #= comment for Julia @@ -236,12 +236,14 @@ InstallGlobalFunction( AddDerivation, fi; # =# - derivation := MakeDerivation( description, - target_op_name, - used_op_names_with_multiples_and_category_getters, - weight, - func, - category_filter ); + derivation := CreateDerivation( + target_op_name, + description, + used_op_names_with_multiples_and_category_getters, + func, + weight, + category_filter + ); if function_called_before_installation <> false then diff --git a/CAP/gap/Finalize.gi b/CAP/gap/Finalize.gi index 11c81effb5..f322824d4b 100644 --- a/CAP/gap/Finalize.gi +++ b/CAP/gap/Finalize.gi @@ -189,12 +189,12 @@ InstallGlobalFunction( AddFinalDerivationBundle, FunctionWithNamedArguments( fi; # =# - Add( derivations, MakeDerivation( - Concatenation( description, " (final derivation)" ), + Add( derivations, CreateDerivation( NameFunction( current_additional_func[1] ), + Concatenation( description, " (final derivation)" ), used_op_names_with_multiples_and_category_getters, - weight, current_additional_func[3], + weight, category_filter ) ); @@ -262,12 +262,12 @@ InstallGlobalFunction( AddFinalDerivationBundle, FunctionWithNamedArguments( fi; # only used to check if we can install all the derivations in `derivations` - dummy_derivation := MakeDerivation( - "dummy derivation", + dummy_derivation := CreateDerivation( "internal dummy function of a final derivation", + "dummy derivation", used_op_names_with_multiples_and_category_getters, - 1, ReturnTrue, + 1, category_filter ); From 3c400a7f860e95303a9362f65e346d81141b4145 Mon Sep 17 00:00:00 2001 From: Fabian Zickgraf Date: Thu, 26 Sep 2024 18:35:22 +0200 Subject: [PATCH 4/4] Bump versions --- ActionsForCAP/PackageInfo.g | 2 +- CAP/PackageInfo.g | 2 +- ComplexesAndFilteredObjectsForCAP/PackageInfo.g | 2 +- GeneralizedMorphismsForCAP/PackageInfo.g | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ActionsForCAP/PackageInfo.g b/ActionsForCAP/PackageInfo.g index 007e859243..ec62d2171c 100644 --- a/ActionsForCAP/PackageInfo.g +++ b/ActionsForCAP/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "ActionsForCAP", Subtitle := "Actions and Coactions for CAP", -Version := "2024.09-01", +Version := "2024.09-02", Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ), License := "GPL-2.0-or-later", diff --git a/CAP/PackageInfo.g b/CAP/PackageInfo.g index 11340c284b..d81b3a3725 100644 --- a/CAP/PackageInfo.g +++ b/CAP/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "CAP", Subtitle := "Categories, Algorithms, Programming", -Version := "2024.09-28", +Version := "2024.09-29", Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ), License := "GPL-2.0-or-later", diff --git a/ComplexesAndFilteredObjectsForCAP/PackageInfo.g b/ComplexesAndFilteredObjectsForCAP/PackageInfo.g index 136391ff57..2a59cf8ed4 100644 --- a/ComplexesAndFilteredObjectsForCAP/PackageInfo.g +++ b/ComplexesAndFilteredObjectsForCAP/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "ComplexesAndFilteredObjectsForCAP", Subtitle := "Implementation of complexes, cocomplexes and filtered objects for CAP", -Version := "2024.04-01", +Version := "2024.09-01", Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ), License := "GPL-2.0-or-later", diff --git a/GeneralizedMorphismsForCAP/PackageInfo.g b/GeneralizedMorphismsForCAP/PackageInfo.g index 1612c15f2e..872f8c462b 100644 --- a/GeneralizedMorphismsForCAP/PackageInfo.g +++ b/GeneralizedMorphismsForCAP/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "GeneralizedMorphismsForCAP", Subtitle := "Implementations of generalized morphisms for the CAP project", -Version := "2024.09-02", +Version := "2024.09-03", Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ), License := "GPL-2.0-or-later",