Skip to content

Commit 991ad9a

Browse files
authored
Merge pull request #1255 from zickgraf/master
Simplify and improve OppositeCategory
2 parents 8d51687 + 9413d11 commit 991ad9a

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

CAP/PackageInfo.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SetPackageInfo( rec(
1010

1111
PackageName := "CAP",
1212
Subtitle := "Categories, Algorithms, Programming",
13-
Version := "2023.02-07",
13+
Version := "2023.02-08",
1414
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
1515
License := "GPL-2.0-or-later",
1616

CAP/gap/OppositeCategory.gi

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ end );
5959
BindGlobal( "CAP_INTERNAL_INSTALL_OPPOSITE_ADDS_FROM_CATEGORY",
6060

6161
function( opposite_category, category )
62-
local only_primitive_operations, recnames, list_of_installed_operations,
62+
local only_primitive_operations, recnames, list_of_underlying_operations,
6363
operations_of_homomorphism_structure, operations_of_external_hom,
6464
current_recname, current_entry, dual_operation_name, filter_list, input_arguments_names, return_type, func_string,
6565
dual_preprocessor_func_string, preprocessor_string, dual_arguments, tmp,
@@ -99,9 +99,9 @@ BindGlobal( "CAP_INTERNAL_INSTALL_OPPOSITE_ADDS_FROM_CATEGORY",
9999
"IdenticalTwoCell" ] );
100100

101101
if only_primitive_operations then
102-
list_of_installed_operations := ListPrimitivelyInstalledOperationsOfCategory( category );
102+
list_of_underlying_operations := ListPrimitivelyInstalledOperationsOfCategory( category );
103103
else
104-
list_of_installed_operations := ListInstalledOperationsOfCategory( category );
104+
list_of_underlying_operations := ListInstalledOperationsOfCategory( category );
105105
fi;
106106

107107
operations_of_homomorphism_structure :=
@@ -114,8 +114,13 @@ BindGlobal( "CAP_INTERNAL_INSTALL_OPPOSITE_ADDS_FROM_CATEGORY",
114114
"InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism",
115115
];
116116

117-
if HasRangeCategoryOfHomomorphismStructure( category ) and
118-
not IsEmpty( Intersection( list_of_installed_operations, operations_of_homomorphism_structure ) ) then
117+
if not IsEmpty( Intersection( list_of_underlying_operations, operations_of_homomorphism_structure ) ) then
118+
119+
if not HasRangeCategoryOfHomomorphismStructure( category ) then
120+
121+
Error( "<category> has operations related to the homomorphism structure but no range category is set. This is not supported." );
122+
123+
fi;
119124

120125
SetRangeCategoryOfHomomorphismStructure( opposite_category, RangeCategoryOfHomomorphismStructure( category ) );
121126
SetIsEquippedWithHomomorphismStructure( opposite_category, true );
@@ -137,11 +142,7 @@ BindGlobal( "CAP_INTERNAL_INSTALL_OPPOSITE_ADDS_FROM_CATEGORY",
137142

138143
dual_operation_name := current_entry.dual_operation;
139144

140-
if not CanCompute( category, dual_operation_name ) then
141-
continue;
142-
fi;
143-
144-
if not dual_operation_name in list_of_installed_operations then
145+
if not dual_operation_name in list_of_underlying_operations then
145146
continue;
146147
fi;
147148

0 commit comments

Comments
 (0)