diff --git a/ActionsForCAP/PackageInfo.g b/ActionsForCAP/PackageInfo.g index aa11100a0d..007e859243 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.08-02", +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/ActionsForCAP/examples/IndirectionTest.g b/ActionsForCAP/examples/IndirectionTest.g index 0842c0de5d..56c1cd1cf4 100644 --- a/ActionsForCAP/examples/IndirectionTest.g +++ b/ActionsForCAP/examples/IndirectionTest.g @@ -91,7 +91,6 @@ category_with_attributes_record := rec( triple := EnhancementWithAttributes( category_with_attributes_record );; indirection_category := triple[1];; SetIsAbelianCategory( indirection_category, true );; -Reevaluate( indirection_category!.derivations_weight_list ); AddIsEqualForObjects( indirection_category, function( cat, obj1, obj2 ) return UnderlyingCell( obj1 ) = UnderlyingCell( obj2 ); end );; AddIsEqualForMorphisms( indirection_category, function( cat, mor1, mor2 ) return IsIdenticalObj( mor1, mor2 ); end );; AddIsCongruentForMorphisms( indirection_category, function( cat, mor1, mor2 ) return UnderlyingCell( mor1 ) = UnderlyingCell( mor2 ); end );; diff --git a/CAP/PackageInfo.g b/CAP/PackageInfo.g index a7fc2e20cf..b75c52ce2a 100644 --- a/CAP/PackageInfo.g +++ b/CAP/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "CAP", Subtitle := "Categories, Algorithms, Programming", -Version := "2024.09-24", +Version := "2024.09-25", 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/gap/Derivations.gi b/CAP/gap/Derivations.gi index f7bcb21ced..5a5750f110 100644 --- a/CAP/gap/Derivations.gi +++ b/CAP/gap/Derivations.gi @@ -538,13 +538,6 @@ function( owl, op_name, new_weight ) owl!.operation_weights.( op_name ) := new_weight; owl!.operation_derivations.( op_name ) := fail; - # if the weight has not changed, there is no need to re-trigger the chain of derivations - if new_weight <> current_weight then - - InstallDerivationsUsingOperation( owl, op_name ); - - fi; - end ); InstallMethod( PrintDerivationTree, diff --git a/CAP/gap/Finalize.gi b/CAP/gap/Finalize.gi index 95eab3698b..9b0feed6b0 100644 --- a/CAP/gap/Finalize.gi +++ b/CAP/gap/Finalize.gi @@ -292,7 +292,7 @@ InstallMethod( Finalize, [ "FinalizeCategory", true ], ], function( CAP_NAMED_ARGUMENTS, category ) - local derivation_list, weight_list, current_install, current_final_derivation, op_name, new_weight, current_weight, old_weights, categorical_properties, diff, properties_with_logic, property, i, derivation, operation, property_name, installed_operations_of_homomorphism_structure, original_REORDER_METHODS_SUSPENSION_LEVEL; + local derivation_list, weight_list, current_install, current_final_derivation, op_name, new_weight, current_weight, old_weights, properties_with_logic, property, i, derivation, operation, property_name, installed_operations_of_homomorphism_structure, original_REORDER_METHODS_SUSPENSION_LEVEL; if IsFinalized( category ) then @@ -306,15 +306,6 @@ InstallMethod( Finalize, fi; - # prepare for the checks below (usually this is done when the first add function is called, but we support the case that no add function is called at all) - if not IsBound( category!.initially_known_categorical_properties ) then - - category!.initially_known_categorical_properties := ShallowCopy( ListKnownCategoricalProperties( category ) ); - - InstallDerivationsUsingOperation( category!.derivations_weight_list, "none" ); - - fi; - # Warn about categories marked as being computable but not having an implementation of IsCongruentForMorphisms. # Since IsCongruentForMorphisms currently is derived from IsEqualForMorphisms, the latter also has to be taken into account. if category!.is_computable and not CanCompute( category, "IsEqualForMorphisms" ) and not CanCompute( category, "IsCongruentForMorphisms") then @@ -339,6 +330,18 @@ InstallMethod( Finalize, weight_list := category!.derivations_weight_list; + InstallDerivationsUsingOperation( weight_list, "none" ); + + for op_name in SortedList( RecNames( weight_list!.operation_weights ) ) do + + if weight_list!.operation_weights.(op_name) <> infinity and weight_list!.operation_derivations.(op_name) = fail then + + InstallDerivationsUsingOperation( weight_list, op_name ); + + fi; + + od; + while true do current_install := fail; @@ -429,45 +432,24 @@ InstallMethod( Finalize, od; - if category!.overhead then - - # Check if reevaluation triggers new derivations. Derivations are installed recursively by `InstallDerivationsUsingOperation`, so this should never happen. - # See the WARNING below for possible causes why it still might happen. - old_weights := StructuralCopy( weight_list!.operation_weights ); - - Info( DerivationInfo, 1, "Starting reevaluation of derivation weight list of the category name \"", Name( category ), "\"\n" ); - - Reevaluate( weight_list ); - - Info( DerivationInfo, 1, "Finished reevaluation of derivation weight list of the category name \"", Name( category ), "\"\n" ); - - categorical_properties := ListKnownCategoricalProperties( category ); - - if not IsSubset( categorical_properties, category!.initially_known_categorical_properties ) then - - Print( "WARNING: The category named \"", Name( category ), "\" has lost the following categorical properties since installation of the first function:\n" ); - Display( Difference( category!.initially_known_categorical_properties, categorical_properties ) ); - - fi; + # TODO: remove once this check has passed the CI of all packages + # Check if reevaluation triggers new derivations. Derivations are installed recursively by `InstallDerivationsUsingOperation`, so this should never happen. + # See the WARNING below for possible causes why it still might happen. + old_weights := StructuralCopy( weight_list!.operation_weights ); + + Info( DerivationInfo, 1, "Starting reevaluation of derivation weight list of the category name \"", Name( category ), "\"\n" ); + + Reevaluate( weight_list ); + + Info( DerivationInfo, 1, "Finished reevaluation of derivation weight list of the category name \"", Name( category ), "\"\n" ); + + if weight_list!.operation_weights <> old_weights then - if weight_list!.operation_weights <> old_weights then - - Print( "WARNING: The installed derivations of the category named \"", Name( category ), "\" have changed by reevaluation, which is not expected at this point.\n" ); - Print( "This might be due to one of the following reasons:\n" ); - Print( "* The category might have gained a new setting like `supports_empty_limits` since adding the first function. Such settings should always be set before adding functions.\n" ); - Print( "* The category filter of some derivation might not fulfill the specification.\n" ); - - diff := Difference( categorical_properties, category!.initially_known_categorical_properties ); - - if not IsEmpty( diff ) then - - Print( "* The category has gained the following new categorical properties since adding the first function: ", diff, ". Properties should always be set before adding functions for operations which might trigger derivations involving the properties.\n" ); - - fi; - - Print( "For debugging, call `ActivateDerivationInfo( )`, retry, and look at the derivations between \"Starting reevaluation of ...\" and \"Finished reevaluation of ...\".\n" ); - - fi; + Print( "WARNING: The installed derivations of the category named \"", Name( category ), "\" have changed by reevaluation, which is not expected at this point.\n" ); + Print( "This might be due to one of the following reasons:\n" ); + Print( "* The category might have gained a new setting like `supports_empty_limits` since adding the first function. Such settings should always be set before adding functions.\n" ); + Print( "* The category filter of some derivation might not fulfill the specification.\n" ); + Print( "For debugging, call `ActivateDerivationInfo( )`, retry, and look at the derivations between \"Starting reevaluation of ...\" and \"Finished reevaluation of ...\".\n" ); fi; diff --git a/CAP/gap/InstallAdds.gi b/CAP/gap/InstallAdds.gi index 323f0e03a8..5b1d597084 100644 --- a/CAP/gap/InstallAdds.gi +++ b/CAP/gap/InstallAdds.gi @@ -47,15 +47,6 @@ InstallMethod( AddCapOperation, fi; - # prepare for the checks in Finalize - if not IsBound( category!.initially_known_categorical_properties ) then - - category!.initially_known_categorical_properties := ShallowCopy( ListKnownCategoricalProperties( category ) ); - - InstallDerivationsUsingOperation( category!.derivations_weight_list, "none" ); - - fi; - if weight = -1 then weight := 100; fi; diff --git a/FreydCategoriesForCAP/PackageInfo.g b/FreydCategoriesForCAP/PackageInfo.g index 5bac377164..29f4cd9b99 100644 --- a/FreydCategoriesForCAP/PackageInfo.g +++ b/FreydCategoriesForCAP/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "FreydCategoriesForCAP", Subtitle := "Freyd categories - Formal (co)kernels for additive categories", -Version := "2024.09-08", +Version := "2024.09-09", 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/FreydCategoriesForCAP/gap/AdditiveClosure.gi b/FreydCategoriesForCAP/gap/AdditiveClosure.gi index 3697fc5646..2a20842cb7 100644 --- a/FreydCategoriesForCAP/gap/AdditiveClosure.gi +++ b/FreydCategoriesForCAP/gap/AdditiveClosure.gi @@ -1070,7 +1070,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_ADDITIVE_CLOSURE, SetRangeCategoryOfHomomorphismStructure( category, range_category ); SetIsEquippedWithHomomorphismStructure( category, true ); - if ForAll( [ "DirectSum" ], f -> CanCompute( range_category, f ) ) and + if (ForAll( [ "DirectSum" ], f -> CanCompute( range_category, f ) ) or IsIdenticalObj( range_category, category )) and ForAll( [ "HomomorphismStructureOnObjects" ], f -> CanCompute( underlying_category, f ) ) then ## @@ -1090,7 +1090,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_ADDITIVE_CLOSURE, fi; # legacy - if ForAll( [ "MorphismBetweenDirectSumsWithGivenDirectSums" ], f -> CanCompute( range_category, f ) ) and + if (ForAll( [ "MorphismBetweenDirectSumsWithGivenDirectSums" ], f -> CanCompute( range_category, f ) ) or IsIdenticalObj( range_category, category )) and ForAll( [ "HomomorphismStructureOnMorphismsWithGivenObjects" ], f -> CanCompute( underlying_category, f ) ) and not (IsBound( range_category!.supports_empty_limits ) and range_category!.supports_empty_limits = true) then @@ -1130,7 +1130,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_ADDITIVE_CLOSURE, fi; - if ForAll( [ "MorphismBetweenDirectSumsWithGivenDirectSums" ], f -> CanCompute( range_category, f ) ) + if (ForAll( [ "MorphismBetweenDirectSumsWithGivenDirectSums" ], f -> CanCompute( range_category, f ) ) or IsIdenticalObj( range_category, category )) and ForAll( [ "HomomorphismStructureOnMorphismsWithGivenObjects" ], f -> CanCompute( underlying_category, f ) ) and IsBound( range_category!.supports_empty_limits ) and range_category!.supports_empty_limits = true then @@ -1208,9 +1208,9 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_ADDITIVE_CLOSURE, fi; - if ForAll( [ "UniversalMorphismIntoZeroObject", + if (ForAll( [ "UniversalMorphismIntoZeroObject", "UniversalMorphismIntoDirectSum" ], - f -> CanCompute( range_category, f ) ) and + f -> CanCompute( range_category, f ) ) or IsIdenticalObj( range_category, category )) and ForAll( [ "DistinguishedObjectOfHomomorphismStructure", "InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure" ], f -> CanCompute( underlying_category, f ) ) and @@ -1245,8 +1245,8 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_ADDITIVE_CLOSURE, fi; - if ForAll( [ "UniversalMorphismIntoDirectSum" ], - f -> CanCompute( range_category, f ) ) and + if (ForAll( [ "UniversalMorphismIntoDirectSum" ], + f -> CanCompute( range_category, f ) ) or IsIdenticalObj( range_category, category )) and ForAll( [ "DistinguishedObjectOfHomomorphismStructure", "InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure" ], f -> CanCompute( underlying_category, f ) ) and @@ -1297,9 +1297,9 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_ADDITIVE_CLOSURE, if ForAll( [ "HomomorphismStructureOnObjects", "InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism" ], f -> CanCompute( underlying_category, f ) ) and - ForAll( [ "PreCompose", + (ForAll( [ "PreCompose", "ProjectionInFactorOfDirectSum" ], - f -> CanCompute( range_category, f ) ) then + f -> CanCompute( range_category, f ) ) or IsIdenticalObj( range_category, category )) then ## AddInterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( category, diff --git a/FreydCategoriesForCAP/gap/CategoryOfRows.gi b/FreydCategoriesForCAP/gap/CategoryOfRows.gi index 89e193ec61..20525f6b86 100644 --- a/FreydCategoriesForCAP/gap/CategoryOfRows.gi +++ b/FreydCategoriesForCAP/gap/CategoryOfRows.gi @@ -41,9 +41,6 @@ InstallMethod( CategoryOfRows, SetIsRigidSymmetricCoclosedMonoidalCategory( cat, true ); - # since methods have been added before, we have to reevaluate the derivations - Reevaluate( cat!.derivations_weight_list ); - fi; INSTALL_FUNCTIONS_FOR_CATEGORY_OF_ROWS( cat ); diff --git a/FreydCategoriesForCAP/gap/CategoryOfRows_as_AdditiveClosure_RingAsCategory.gi b/FreydCategoriesForCAP/gap/CategoryOfRows_as_AdditiveClosure_RingAsCategory.gi index ab546e8c54..ec1c5161e7 100644 --- a/FreydCategoriesForCAP/gap/CategoryOfRows_as_AdditiveClosure_RingAsCategory.gi +++ b/FreydCategoriesForCAP/gap/CategoryOfRows_as_AdditiveClosure_RingAsCategory.gi @@ -30,8 +30,7 @@ InstallMethod( CategoryOfRows_as_AdditiveClosure_RingAsCategory, # These ring properties should actually be propagated to some categorical properties of `ring_as_category` # which the AdditiveClosure can use generically. # However, such categorical properties do not (yet) exist, so we have to set the categorical properties - # a posteriori here. Afterwards, we have to reevaluate the derivations because they might have changed - # by setting the properties. + # a posteriori here. if HasHasInvariantBasisProperty( homalg_ring ) and HasInvariantBasisProperty( homalg_ring ) then SetIsSkeletalCategory( add, true ); @@ -50,8 +49,6 @@ InstallMethod( CategoryOfRows_as_AdditiveClosure_RingAsCategory, fi; - Reevaluate( add!.derivations_weight_list ); - Finalize( add );