Skip to content

Commit

Permalink
AddAstrictionToCoimage
Browse files Browse the repository at this point in the history
ImageEmbedding( phi )      ⤳ Set
AstrictionToCoimage( phi ) ⤳ DuplicateFreeList

and compiled CoimageProjection

needs Toposes v2023.10-13
  • Loading branch information
mohamed-barakat committed Nov 4, 2023
1 parent e3ee93e commit 240dcdf
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 5 deletions.
4 changes: 2 additions & 2 deletions 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-02",
Version := "2023.10-03",

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 Expand Up @@ -100,7 +100,7 @@ Dependencies := rec(
NeededOtherPackages := [
[ "CAP", ">= 2023.09-11" ],
[ "CartesianCategories", ">= 2023.08-13" ],
[ "Toposes", ">= 2023.10-01" ],
[ "Toposes", ">= 2023.10-13" ],
],
SuggestedOtherPackages := [ ],
ExternalConditions := [ ],
Expand Down
3 changes: 3 additions & 0 deletions doc/Doc.autodoc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
@InsertChunk SkeletalImageEmbedding
@InsertChunk SkeletalCoastrictionToImage

@Subsection Skeletal Coimage
@InsertChunk SkeletalCoimageObject

@Subsection Skeletal Preimage
@InsertChunk SkeletalPreimage

Expand Down
5 changes: 3 additions & 2 deletions examples/CoimageObject.g
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ IsEpimorphism( phi );
#! false
IsSplitEpimorphism( phi );
#! false
iota := AstrictionToCoimage( phi );
#! <A morphism in FinSets>
pi := CoimageProjection( phi );
#! <An epimorphism in FinSets>
iota := AstrictionToCoimage( phi );
#! <A morphism in FinSets>
PreCompose( pi, iota ) = phi;
#! true

#! @EndExample
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 @@ -25,6 +25,7 @@ primitive_operations :=
list_of_operations :=
SortedList( Concatenation( primitive_operations, [
"CoastrictionToImage",
"CoimageProjection",
"IsHomSetInhabited",
"TruthMorphismOfImplies",
#"HasPushoutComplement",
Expand Down
32 changes: 32 additions & 0 deletions examples/SkeletalCoimageObject.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#! @Chunk SkeletalCoimageObject

#! @Example
LoadPackage( "FinSetsForCAP", false );
#! true
m := FinSet( 3 );
#! |3|
n := FinSet( 3 );
#! |3|
phi := MapOfFinSets( m, [ 1, 0, 1 ], n );
#! |3| → |3|
I := CoimageObject( phi );
#! |2|
IsMonomorphism( phi );
#! false
IsSplitMonomorphism( phi );
#! false
IsEpimorphism( phi );
#! false
IsSplitEpimorphism( phi );
#! false
pi := CoimageProjection( phi );
#! |3| → |2|
iota := AstrictionToCoimage( phi );
#! |2| → |3|
PreCompose( pi, iota ) = phi;
#! true
Display( iota );
#! { 0, 1 } ⱶ[ 1, 0 ]→ { 0, 1, 2 }
Display( ImageEmbedding( phi ) );
#! { 0, 1 } ⱶ[ 0, 1 ]→ { 0, 1, 2 }
#! @EndExample
16 changes: 16 additions & 0 deletions gap/SkeletalFinSets.gi
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,22 @@ AddImageEmbedding( SkeletalFinSets,

end );

##
AddAstrictionToCoimage( SkeletalFinSets,
function ( cat, phi )
local L, 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 the source:
map := DuplicateFreeList( L );

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

end );

## Limits

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

##
AddAstrictionToCoimage( cat,

########
function ( cat_1, alpha_1 )
local deduped_1_1;
deduped_1_1 := DuplicateFreeList( AsList( alpha_1 ) );
return CreateCapCategoryMorphismWithAttributes( cat_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( Length( deduped_1_1 ) ) ), Range( alpha_1 ), AsList, deduped_1_1 );
end
########

, 100 );

##
AddCartesianBraidingInverseWithGivenDirectProducts( cat,

Expand Down Expand Up @@ -184,6 +197,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 ( x_2 )
return -1 + BigInt( SafePosition( deduped_3_1, deduped_5_1[(1 + x_2)] ) );
end ) );
end
########

, 202 : IsPrecompiledDerivation := true );

##
AddColift( cat,

Expand Down

0 comments on commit 240dcdf

Please sign in to comment.