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 11, 2023
1 parent dfa939e commit 97be517
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
2 changes: 1 addition & 1 deletion PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "FinSetsForCAP",
Subtitle := "The elementary topos of (skeletal) finite sets",
Version := "2023.10-01",
Version := "2023.10-02",

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",
Expand Down
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 );

Check warning on line 489 in gap/SkeletalFinSets.gi

View check run for this annotation

Codecov / codecov/patch

gap/SkeletalFinSets.gi#L489

Added line #L489 was not covered by tests

## 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 );

Check warning on line 494 in gap/SkeletalFinSets.gi

View check run for this annotation

Codecov / codecov/patch

gap/SkeletalFinSets.gi#L494

Added line #L494 was not covered by tests

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

Check warning on line 497 in gap/SkeletalFinSets.gi

View check run for this annotation

Codecov / codecov/patch

gap/SkeletalFinSets.gi#L496-L497

Added lines #L496 - L497 were not covered by tests

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

Check warning on line 499 in gap/SkeletalFinSets.gi

View check run for this annotation

Codecov / codecov/patch

gap/SkeletalFinSets.gi#L499

Added line #L499 was not covered by tests

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;

Check warning on line 23 in gap/precompiled_categories/SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled.gi

View check run for this annotation

Codecov / codecov/patch

gap/precompiled_categories/SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled.gi#L14-L23

Added lines #L14 - L23 were not covered by tests
else
return deduped_7_1[SafePosition( deduped_3_1, y_2 )];
fi;

Check warning on line 26 in gap/precompiled_categories/SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled.gi

View check run for this annotation

Codecov / codecov/patch

gap/precompiled_categories/SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled.gi#L25-L26

Added lines #L25 - L26 were not covered by tests
return;
end ) );

Check warning on line 28 in gap/precompiled_categories/SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled.gi

View check run for this annotation

Codecov / codecov/patch

gap/precompiled_categories/SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled.gi#L28

Added line #L28 was not covered by tests
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 ) );

Check warning on line 224 in gap/precompiled_categories/SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled.gi

View check run for this annotation

Codecov / codecov/patch

gap/precompiled_categories/SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled.gi#L219-L224

Added lines #L219 - L224 were not covered by tests
end
########

, 100 );

##
AddColift( cat,

Expand Down

0 comments on commit 97be517

Please sign in to comment.