Skip to content

Commit

Permalink
AddCoimageProjection
Browse files Browse the repository at this point in the history
ImageObject( phi )   ⤳ Set
CoimageObject( phi ) ⤳ DuplicateFreeList

and compiled AstrictionToCoimage
  • Loading branch information
mohamed-barakat committed Oct 4, 2023
1 parent dfa939e commit 65ef4a2
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

LoadPackage( "FinSetsForCAP", false );
#! true
LoadPackage( "CompilerForCAP", false );
LoadPackage( "CompilerForCAP", ">= 2023.10-03", false );
#! true

ReadPackage( "FinSetsForCAP", "gap/CompilerLogic.gi" );
Expand All @@ -24,6 +24,7 @@ primitive_operations :=
category_constructor( : no_precompiled_code := true ) );;
list_of_operations :=
SortedList( Concatenation( primitive_operations, [
"AstrictionToCoimage",
"CoastrictionToImage",
"IsHomSetInhabited",
"TruthMorphismOfImplies",
Expand Down
19 changes: 19 additions & 0 deletions gap/SkeletalFinSets.gi
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,25 @@ AddImageEmbedding( SkeletalFinSets,

end );

##
AddCoimageProjection( SkeletalFinSets,
function ( cat, phi )
local L, imgs, map;

L := AsList( phi );

## unlike ImageObject which is a subobject of the range,
## the CoimageObject is a factor object of the source,
## and we want to retain the sorting of source
imgs := DuplicateFreeList( L );

map := List( [ 0 .. Length( Source( phi ) ) - 1 ], i ->
-1 + SafePosition( imgs, L[1 + i] ) );

return MorphismConstructor( cat, Source( phi ), map, ObjectConstructor( cat, BigInt( Length( imgs ) ) ) );

end );

## Limits

##
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@
#
BindGlobal( "ADD_FUNCTIONS_FOR_SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled", function ( cat )

##
AddAstrictionToCoimage( cat,

########
function ( cat_1, alpha_1 )
local deduped_3_1, hoisted_4_1, deduped_5_1, deduped_6_1, deduped_7_1;
deduped_7_1 := AsList( alpha_1 );
deduped_6_1 := DuplicateFreeList( deduped_7_1 );
deduped_5_1 := BigInt( Length( deduped_6_1 ) );
hoisted_4_1 := BigInt( 0 );
deduped_3_1 := List( [ 0 .. Length( Source( alpha_1 ) ) - 1 ], function ( i_2 )
return -1 + SafePosition( deduped_6_1, deduped_7_1[(1 + i_2)] );
end );
return CreateCapCategoryMorphismWithAttributes( cat_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, deduped_5_1 ), Range( alpha_1 ), AsList, List( [ 0 .. deduped_5_1 - 1 ], function ( y_2 )
if not y_2 in deduped_3_1 then
return hoisted_4_1;
else
return deduped_7_1[SafePosition( deduped_3_1, y_2 )];
fi;
return;
end ) );
end
########

, 202 : IsPrecompiledDerivation := true );

##
AddCartesianBraidingInverseWithGivenDirectProducts( cat,

Expand Down Expand Up @@ -184,6 +210,23 @@ end

, 100 );

##
AddCoimageProjection( cat,

########
function ( cat_1, alpha_1 )
local deduped_3_1, deduped_4_1, deduped_5_1;
deduped_5_1 := AsList( alpha_1 );
deduped_4_1 := Source( alpha_1 );
deduped_3_1 := DuplicateFreeList( deduped_5_1 );
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 )
return -1 + SafePosition( deduped_3_1, deduped_5_1[(1 + i_2)] );
end ) );
end
########

, 100 );

##
AddColift( cat,

Expand Down

0 comments on commit 65ef4a2

Please sign in to comment.