From 56b0ee41c04c418adb5803722d39639efce20132 Mon Sep 17 00:00:00 2001 From: Tom Kuhmichel Date: Mon, 27 Feb 2023 15:45:30 +0100 Subject: [PATCH] Move operations to compile and compile IsEqualForObjects and PreCompose --- ...AsFreydCategoryOfCategoryOfRowsOrColumns.g | 46 +++++++++---------- .../gap/ModulePresentationsForCAP.gi | 33 ------------- ...ategoryOfRowsOfArbitraryRingPrecompiled.gi | 30 ++++++++++++ ...egoryOfRowsOfCommutativeRingPrecompiled.gi | 30 ++++++++++++ ...egoryOfCategoryOfRowsOfFieldPrecompiled.gi | 30 ++++++++++++ ...goryOfColumnsOfArbitraryRingPrecompiled.gi | 30 ++++++++++++ ...ryOfColumnsOfCommutativeRingPrecompiled.gi | 30 ++++++++++++ ...ryOfCategoryOfColumnsOfFieldPrecompiled.gi | 30 ++++++++++++ 8 files changed, 203 insertions(+), 56 deletions(-) diff --git a/CompilerForCAP/examples/PrecompileModulePresentationsAsFreydCategoryOfCategoryOfRowsOrColumns.g b/CompilerForCAP/examples/PrecompileModulePresentationsAsFreydCategoryOfCategoryOfRowsOrColumns.g index c5eb6d76f7..9d3bcaf040 100644 --- a/CompilerForCAP/examples/PrecompileModulePresentationsAsFreydCategoryOfCategoryOfRowsOrColumns.g +++ b/CompilerForCAP/examples/PrecompileModulePresentationsAsFreydCategoryOfCategoryOfRowsOrColumns.g @@ -19,52 +19,52 @@ EEE := KoszulDualRing( QQxy * "a,b" );; operations_for_arbitrary_ring := [ "AdditionForMorphisms", "AdditiveInverseForMorphisms", - #"AssociatorLeftToRightWithGivenTensorProducts", - #"AssociatorRightToLeftWithGivenTensorProducts", - #"BraidingWithGivenTensorProducts", - #"CoevaluationMorphismWithGivenRange", "CokernelColiftWithGivenCokernelObject", "CokernelProjection", - #"Colift", - #"ColiftOrFail", "DirectSum", "EpimorphismFromSomeProjectiveObject", - #"EvaluationMorphismWithGivenSource", "IdentityMorphism", "InjectionOfCofactorOfDirectSumWithGivenDirectSum", - #"InternalHomOnMorphismsWithGivenInternalHoms", - #"InternalHomOnObjects", - #"IsColiftable", "IsCongruentForMorphisms", "IsEqualForMorphisms", - #"IsEqualForObjects", - #"IsLiftable", + "IsEqualForObjects", #"IsWellDefinedForMorphisms", #"IsWellDefinedForObjects", "IsZeroForMorphisms", #"KernelEmbedding", - #"LeftUnitorWithGivenTensorProduct", - #"Lift", #"LiftAlongMonomorphism", - #"LiftOrFail", - #"MultiplyWithElementOfCommutativeRingForMorphisms", - #"PreCompose", + "PreCompose", "ProjectionInFactorOfDirectSumWithGivenDirectSum", - #"RightUnitorWithGivenTensorProduct", - #"TensorProductOnMorphismsWithGivenTensorProducts", - #"TensorProductOnObjects", - #"TensorUnit", "UniversalMorphismFromDirectSumWithGivenDirectSum", "UniversalMorphismFromZeroObjectWithGivenZeroObject", "UniversalMorphismIntoDirectSumWithGivenDirectSum", "UniversalMorphismIntoZeroObjectWithGivenZeroObject", "ZeroMorphism", - "ZeroObject" + "ZeroObject", ];; operations_for_commutative_ring := Concatenation( operations_for_arbitrary_ring, - [ "MultiplyWithElementOfCommutativeRingForMorphisms" ] + [ #"AssociatorLeftToRightWithGivenTensorProducts", + #"AssociatorRightToLeftWithGivenTensorProducts", + #"BraidingWithGivenTensorProducts", + #"CoevaluationMorphismWithGivenRange", + #"Colift", + #"ColiftOrFail", + #"EvaluationMorphismWithGivenSource", + #"InternalHomOnMorphismsWithGivenInternalHoms", + #"InternalHomOnObjects", + #"IsColiftable", + #"IsLiftable", + #"LeftUnitorWithGivenTensorProduct", + #"Lift", + #"LiftOrFail", + "MultiplyWithElementOfCommutativeRingForMorphisms", + #"RightUnitorWithGivenTensorProduct", + #"TensorProductOnMorphismsWithGivenTensorProducts", + #"TensorProductOnObjects", + #"TensorUnit", + ] );; precompile_LeftPresentations := function( ring, name, operations ) diff --git a/ModulePresentationsForCAP/gap/ModulePresentationsForCAP.gi b/ModulePresentationsForCAP/gap/ModulePresentationsForCAP.gi index 106f1c8915..7a5a7f9a45 100644 --- a/ModulePresentationsForCAP/gap/ModulePresentationsForCAP.gi +++ b/ModulePresentationsForCAP/gap/ModulePresentationsForCAP.gi @@ -227,9 +227,6 @@ InstallGlobalFunction( ADD_FUNCTIONS_FOR_LEFT_PRESENTATION, # has special cases ADD_PRECOMPOSE_LEFT( category ); - # simpler than the compiled version - ADD_EQUAL_FOR_OBJECTS( category ); - # IsWellDefined* should not be compiled ADD_IS_WELL_DEFINED_FOR_OBJECTS( category ); @@ -274,8 +271,6 @@ InstallGlobalFunction( ADD_FUNCTIONS_FOR_RIGHT_PRESENTATION, ADD_PRECOMPOSE_RIGHT( category ); - ADD_EQUAL_FOR_OBJECTS( category ); - ADD_IS_WELL_DEFINED_FOR_OBJECTS( category ); ADD_IS_WELL_DEFINED_FOR_MORPHISM_RIGHT( category ); @@ -394,21 +389,6 @@ InstallGlobalFunction( ADD_IS_WELL_DEFINED_FOR_MORPHISM_RIGHT, end ); -## -InstallGlobalFunction( ADD_EQUAL_FOR_OBJECTS, - - function( category ) - - AddIsEqualForObjects( category, - - function( cat, object1, object2 ) - - return UnderlyingMatrix( object1 ) = UnderlyingMatrix( object2 ); - - end ); - -end ); - ## InstallGlobalFunction( ADD_KERNEL_LEFT, @@ -510,12 +490,6 @@ InstallGlobalFunction( ADD_PRECOMPOSE_LEFT, AddPreCompose( category, [ - [ function( cat, left_morphism, right_morphism ) - - return PresentationMorphism( Source( left_morphism ), UnderlyingMatrix( left_morphism ) * UnderlyingMatrix( right_morphism ), Range( right_morphism ) ); - - end, [ ] ], - [ function( cat, left_morphism, identity_morphism ) return left_morphism; @@ -560,13 +534,6 @@ InstallGlobalFunction( ADD_PRECOMPOSE_RIGHT, AddPreCompose( category, [ - - [ function( cat, left_morphism, right_morphism ) - - return PresentationMorphism( Source( left_morphism ), UnderlyingMatrix( right_morphism ) * UnderlyingMatrix( left_morphism ), Range( right_morphism ) ); - - end, [ ] ], - [ function( cat, left_morphism, identity_morphism ) return left_morphism; diff --git a/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfArbitraryRingPrecompiled.gi b/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfArbitraryRingPrecompiled.gi index 624c67774d..e1182894c9 100644 --- a/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfArbitraryRingPrecompiled.gi +++ b/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfArbitraryRingPrecompiled.gi @@ -129,6 +129,25 @@ end , 100 ); + ## + AddIsEqualForObjects( cat, + +######## +function ( cat_1, arg2_1, arg3_1 ) + local deduped_1_1, deduped_2_1; + deduped_2_1 := UnderlyingMatrix( arg3_1 ); + deduped_1_1 := UnderlyingMatrix( arg2_1 ); + if NumberRows( deduped_1_1 ) = NumberRows( deduped_2_1 ) and NumberColumns( deduped_1_1 ) = NumberColumns( deduped_2_1 ) then + return deduped_1_1 = deduped_2_1; + else + return false; + fi; + return; +end +######## + + , 100 ); + ## AddIsZeroForMorphisms( cat, @@ -140,6 +159,17 @@ end , 100 ); + ## + AddPreCompose( cat, + +######## +function ( cat_1, alpha_1, beta_1 ) + return CreateCapCategoryMorphismWithAttributes( cat_1, Source( alpha_1 ), Range( beta_1 ), UnderlyingMatrix, UnderlyingMatrix( alpha_1 ) * UnderlyingMatrix( beta_1 ) ); +end +######## + + , 100 ); + ## AddProjectionInFactorOfDirectSumWithGivenDirectSum( cat, diff --git a/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfCommutativeRingPrecompiled.gi b/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfCommutativeRingPrecompiled.gi index 3e5692d3d2..5df35a8085 100644 --- a/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfCommutativeRingPrecompiled.gi +++ b/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfCommutativeRingPrecompiled.gi @@ -129,6 +129,25 @@ end , 100 ); + ## + AddIsEqualForObjects( cat, + +######## +function ( cat_1, arg2_1, arg3_1 ) + local deduped_1_1, deduped_2_1; + deduped_2_1 := UnderlyingMatrix( arg3_1 ); + deduped_1_1 := UnderlyingMatrix( arg2_1 ); + if NumberRows( deduped_1_1 ) = NumberRows( deduped_2_1 ) and NumberColumns( deduped_1_1 ) = NumberColumns( deduped_2_1 ) then + return deduped_1_1 = deduped_2_1; + else + return false; + fi; + return; +end +######## + + , 100 ); + ## AddIsZeroForMorphisms( cat, @@ -140,6 +159,17 @@ end , 100 ); + ## + AddPreCompose( cat, + +######## +function ( cat_1, alpha_1, beta_1 ) + return CreateCapCategoryMorphismWithAttributes( cat_1, Source( alpha_1 ), Range( beta_1 ), UnderlyingMatrix, UnderlyingMatrix( alpha_1 ) * UnderlyingMatrix( beta_1 ) ); +end +######## + + , 100 ); + ## AddProjectionInFactorOfDirectSumWithGivenDirectSum( cat, diff --git a/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfFieldPrecompiled.gi b/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfFieldPrecompiled.gi index fae4a6ef4c..f2c3a4d76b 100644 --- a/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfFieldPrecompiled.gi +++ b/ModulePresentationsForCAP/gap/precompiled_categories/LeftPresentationsAsFreydCategoryOfCategoryOfRowsOfFieldPrecompiled.gi @@ -129,6 +129,25 @@ end , 100 ); + ## + AddIsEqualForObjects( cat, + +######## +function ( cat_1, arg2_1, arg3_1 ) + local deduped_1_1, deduped_2_1; + deduped_2_1 := UnderlyingMatrix( arg3_1 ); + deduped_1_1 := UnderlyingMatrix( arg2_1 ); + if NumberRows( deduped_1_1 ) = NumberRows( deduped_2_1 ) and NumberColumns( deduped_1_1 ) = NumberColumns( deduped_2_1 ) then + return deduped_1_1 = deduped_2_1; + else + return false; + fi; + return; +end +######## + + , 100 ); + ## AddIsZeroForMorphisms( cat, @@ -140,6 +159,17 @@ end , 100 ); + ## + AddPreCompose( cat, + +######## +function ( cat_1, alpha_1, beta_1 ) + return CreateCapCategoryMorphismWithAttributes( cat_1, Source( alpha_1 ), Range( beta_1 ), UnderlyingMatrix, UnderlyingMatrix( alpha_1 ) * UnderlyingMatrix( beta_1 ) ); +end +######## + + , 100 ); + ## AddProjectionInFactorOfDirectSumWithGivenDirectSum( cat, diff --git a/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfArbitraryRingPrecompiled.gi b/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfArbitraryRingPrecompiled.gi index d68fad3743..1a507a15c8 100644 --- a/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfArbitraryRingPrecompiled.gi +++ b/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfArbitraryRingPrecompiled.gi @@ -129,6 +129,25 @@ end , 100 ); + ## + AddIsEqualForObjects( cat, + +######## +function ( cat_1, arg2_1, arg3_1 ) + local deduped_1_1, deduped_2_1; + deduped_2_1 := UnderlyingMatrix( arg3_1 ); + deduped_1_1 := UnderlyingMatrix( arg2_1 ); + if NumberColumns( deduped_1_1 ) = NumberColumns( deduped_2_1 ) and NumberRows( deduped_1_1 ) = NumberRows( deduped_2_1 ) then + return deduped_1_1 = deduped_2_1; + else + return false; + fi; + return; +end +######## + + , 100 ); + ## AddIsZeroForMorphisms( cat, @@ -140,6 +159,17 @@ end , 100 ); + ## + AddPreCompose( cat, + +######## +function ( cat_1, alpha_1, beta_1 ) + return CreateCapCategoryMorphismWithAttributes( cat_1, Source( alpha_1 ), Range( beta_1 ), UnderlyingMatrix, UnderlyingMatrix( beta_1 ) * UnderlyingMatrix( alpha_1 ) ); +end +######## + + , 100 ); + ## AddProjectionInFactorOfDirectSumWithGivenDirectSum( cat, diff --git a/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfCommutativeRingPrecompiled.gi b/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfCommutativeRingPrecompiled.gi index 8f052556ec..2c4af9a821 100644 --- a/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfCommutativeRingPrecompiled.gi +++ b/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfCommutativeRingPrecompiled.gi @@ -129,6 +129,25 @@ end , 100 ); + ## + AddIsEqualForObjects( cat, + +######## +function ( cat_1, arg2_1, arg3_1 ) + local deduped_1_1, deduped_2_1; + deduped_2_1 := UnderlyingMatrix( arg3_1 ); + deduped_1_1 := UnderlyingMatrix( arg2_1 ); + if NumberColumns( deduped_1_1 ) = NumberColumns( deduped_2_1 ) and NumberRows( deduped_1_1 ) = NumberRows( deduped_2_1 ) then + return deduped_1_1 = deduped_2_1; + else + return false; + fi; + return; +end +######## + + , 100 ); + ## AddIsZeroForMorphisms( cat, @@ -140,6 +159,17 @@ end , 100 ); + ## + AddPreCompose( cat, + +######## +function ( cat_1, alpha_1, beta_1 ) + return CreateCapCategoryMorphismWithAttributes( cat_1, Source( alpha_1 ), Range( beta_1 ), UnderlyingMatrix, UnderlyingMatrix( beta_1 ) * UnderlyingMatrix( alpha_1 ) ); +end +######## + + , 100 ); + ## AddProjectionInFactorOfDirectSumWithGivenDirectSum( cat, diff --git a/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfFieldPrecompiled.gi b/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfFieldPrecompiled.gi index cdff8fad44..370df24bff 100644 --- a/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfFieldPrecompiled.gi +++ b/ModulePresentationsForCAP/gap/precompiled_categories/RightPresentationsAsFreydCategoryOfCategoryOfColumnsOfFieldPrecompiled.gi @@ -129,6 +129,25 @@ end , 100 ); + ## + AddIsEqualForObjects( cat, + +######## +function ( cat_1, arg2_1, arg3_1 ) + local deduped_1_1, deduped_2_1; + deduped_2_1 := UnderlyingMatrix( arg3_1 ); + deduped_1_1 := UnderlyingMatrix( arg2_1 ); + if NumberColumns( deduped_1_1 ) = NumberColumns( deduped_2_1 ) and NumberRows( deduped_1_1 ) = NumberRows( deduped_2_1 ) then + return deduped_1_1 = deduped_2_1; + else + return false; + fi; + return; +end +######## + + , 100 ); + ## AddIsZeroForMorphisms( cat, @@ -140,6 +159,17 @@ end , 100 ); + ## + AddPreCompose( cat, + +######## +function ( cat_1, alpha_1, beta_1 ) + return CreateCapCategoryMorphismWithAttributes( cat_1, Source( alpha_1 ), Range( beta_1 ), UnderlyingMatrix, UnderlyingMatrix( beta_1 ) * UnderlyingMatrix( alpha_1 ) ); +end +######## + + , 100 ); + ## AddProjectionInFactorOfDirectSumWithGivenDirectSum( cat,