Skip to content

Commit 65ef4a2

Browse files
AddCoimageProjection
ImageObject( phi ) ⤳ Set CoimageObject( phi ) ⤳ DuplicateFreeList and compiled AstrictionToCoimage
1 parent dfa939e commit 65ef4a2

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

examples/PrecompileCategoryOfSkeletalFinSetsWithMorphismsGivenByLists.g

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
LoadPackage( "FinSetsForCAP", false );
1010
#! true
11-
LoadPackage( "CompilerForCAP", false );
11+
LoadPackage( "CompilerForCAP", ">= 2023.10-03", false );
1212
#! true
1313

1414
ReadPackage( "FinSetsForCAP", "gap/CompilerLogic.gi" );
@@ -24,6 +24,7 @@ primitive_operations :=
2424
category_constructor( : no_precompiled_code := true ) );;
2525
list_of_operations :=
2626
SortedList( Concatenation( primitive_operations, [
27+
"AstrictionToCoimage",
2728
"CoastrictionToImage",
2829
"IsHomSetInhabited",
2930
"TruthMorphismOfImplies",

gap/SkeletalFinSets.gi

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,25 @@ AddImageEmbedding( SkeletalFinSets,
481481

482482
end );
483483

484+
##
485+
AddCoimageProjection( SkeletalFinSets,
486+
function ( cat, phi )
487+
local L, imgs, map;
488+
489+
L := AsList( phi );
490+
491+
## unlike ImageObject which is a subobject of the range,
492+
## the CoimageObject is a factor object of the source,
493+
## and we want to retain the sorting of source
494+
imgs := DuplicateFreeList( L );
495+
496+
map := List( [ 0 .. Length( Source( phi ) ) - 1 ], i ->
497+
-1 + SafePosition( imgs, L[1 + i] ) );
498+
499+
return MorphismConstructor( cat, Source( phi ), map, ObjectConstructor( cat, BigInt( Length( imgs ) ) ) );
500+
501+
end );
502+
484503
## Limits
485504

486505
##

gap/precompiled_categories/SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled.gi

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,32 @@
55
#
66
BindGlobal( "ADD_FUNCTIONS_FOR_SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled", function ( cat )
77

8+
##
9+
AddAstrictionToCoimage( cat,
10+
11+
########
12+
function ( cat_1, alpha_1 )
13+
local deduped_3_1, hoisted_4_1, deduped_5_1, deduped_6_1, deduped_7_1;
14+
deduped_7_1 := AsList( alpha_1 );
15+
deduped_6_1 := DuplicateFreeList( deduped_7_1 );
16+
deduped_5_1 := BigInt( Length( deduped_6_1 ) );
17+
hoisted_4_1 := BigInt( 0 );
18+
deduped_3_1 := List( [ 0 .. Length( Source( alpha_1 ) ) - 1 ], function ( i_2 )
19+
return -1 + SafePosition( deduped_6_1, deduped_7_1[(1 + i_2)] );
20+
end );
21+
return CreateCapCategoryMorphismWithAttributes( cat_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, deduped_5_1 ), Range( alpha_1 ), AsList, List( [ 0 .. deduped_5_1 - 1 ], function ( y_2 )
22+
if not y_2 in deduped_3_1 then
23+
return hoisted_4_1;
24+
else
25+
return deduped_7_1[SafePosition( deduped_3_1, y_2 )];
26+
fi;
27+
return;
28+
end ) );
29+
end
30+
########
31+
32+
, 202 : IsPrecompiledDerivation := true );
33+
834
##
935
AddCartesianBraidingInverseWithGivenDirectProducts( cat,
1036

@@ -184,6 +210,23 @@ end
184210

185211
, 100 );
186212

213+
##
214+
AddCoimageProjection( cat,
215+
216+
########
217+
function ( cat_1, alpha_1 )
218+
local deduped_3_1, deduped_4_1, deduped_5_1;
219+
deduped_5_1 := AsList( alpha_1 );
220+
deduped_4_1 := Source( alpha_1 );
221+
deduped_3_1 := DuplicateFreeList( deduped_5_1 );
222+
return CreateCapCategoryMorphismWithAttributes( cat_1, deduped_4_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( Length( deduped_3_1 ) ) ), AsList, List( [ 0 .. Length( deduped_4_1 ) - 1 ], function ( i_2 )
223+
return -1 + SafePosition( deduped_3_1, deduped_5_1[(1 + i_2)] );
224+
end ) );
225+
end
226+
########
227+
228+
, 100 );
229+
187230
##
188231
AddColift( cat,
189232

0 commit comments

Comments
 (0)