Skip to content

Commit c20c5e7

Browse files
AddIsColiftable + AddColift for FinSets
1 parent 8723a07 commit c20c5e7

File tree

5 files changed

+88
-1
lines changed

5 files changed

+88
-1
lines changed

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 := "FinSetsForCAP",
1212
Subtitle := "The elementary topos of (skeletal) finite sets",
13-
Version := "2021.12-06",
13+
Version := "2021.12-07",
1414

1515
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
1616
License := "GPL-2.0-or-later",

doc/Doc.autodoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
@Subsection Lift
5353
@InsertChunk Lift
5454

55+
@Subsection Colift
56+
@InsertChunk Colift
57+
5558
@Subsection Topos properties
5659
@InsertChunk Topos
5760

examples/Colift.g

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#! @Chunk Colift
2+
3+
LoadPackage( "FinSetsForCAP" );
4+
5+
#! @Example
6+
m := FinSet( [ 1 .. 5 ] );
7+
#! <An object in FinSets>
8+
n := FinSet( [ 1 .. 4 ] );
9+
#! <An object in FinSets>
10+
f := MapOfFinSets(
11+
m,
12+
[ [ 1, 2 ], [ 2, 2 ], [ 3, 1 ], [ 4, 1 ], [ 5, 3 ] ],
13+
n );
14+
#! <A morphism in FinSets>
15+
g := MapOfFinSets(
16+
m,
17+
[ [ 1, 5 ], [ 2, 5 ], [ 3, 4 ], [ 4, 4 ], [ 5, 5 ] ],
18+
m );
19+
#! <A morphism in FinSets>
20+
IsColiftable( f, g );
21+
#! true
22+
chi := Colift( f, g );
23+
#! <A morphism in FinSets>
24+
Display( chi );
25+
#! [ [ 1 .. 4 ], [ [ 1, 4 ], [ 2, 5 ], [ 3, 5 ], [ 4, 1 ] ], [ 1 .. 5 ] ]
26+
PreCompose( f, Colift( f, g ) ) = g;
27+
#! true
28+
IsColiftable( g, f );
29+
#! false
30+
#! @EndExample

gap/FinSetsForCAP.gd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ DeclareOperation( "ProjectionOfFinSets",
217217
DeclareOperation( "Preimage",
218218
[ IsFiniteSetMap, IsFiniteSet ] );
219219

220+
#! @Description
221+
#! Compute an element of the preimage of the element <A>y</A> under the morphism <A>f</A>.
222+
#! @Arguments f, y
223+
#! @Returns a GAP object
224+
DeclareOperation( "ElementOfPreimage",
225+
[ IsFiniteSetMap, IsObject ] );
226+
220227
#! @Description
221228
#! Compute the image of <A>S_</A> under the morphism <A>f</A>.
222229
#! @Arguments f, S_

gap/FinSetsForCAP.gi

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,17 @@ InstallMethod( Preimage,
352352

353353
end );
354354

355+
##
356+
InstallMethod( ElementOfPreimage,
357+
"for a CAP map of finite sets and a GAP object",
358+
[ IsFiniteSetMap, IsObject ],
359+
360+
function ( f, y )
361+
362+
return First( Source( f ), x -> IsEqualForElementsOfFinSets( f(x), y ) );
363+
364+
end );
365+
355366
##
356367
InstallMethod( ImageObject,
357368
"for a CAP map of finite sets and a CAP finite set",
@@ -768,6 +779,42 @@ AddLift( category_of_finite_sets,
768779

769780
end );
770781

782+
## beta \circ alpha^{-1} is again an ordinary function,
783+
## i.e., fibers of alpha are mapped under beta to the same element
784+
AddIsColiftable( category_of_finite_sets,
785+
function ( category_of_finite_sets, alpha, beta )
786+
787+
return ForAll( AsList( ImageObject( alpha ) ),
788+
i -> Length( DuplicateFreeList( List( Preimage( alpha, FinSetNC( category_of_finite_sets, [ i ] ) ), beta ) ) ) = 1 );
789+
790+
end );
791+
792+
##
793+
AddColift( category_of_finite_sets,
794+
function ( category_of_finite_sets, alpha, beta )
795+
local S, T, im_alpha, elm_T, chi;
796+
797+
S := Range( alpha );
798+
T := Range( beta );
799+
800+
im_alpha := AsList( ImageObject( alpha ) );
801+
802+
if not IsInitial( T ) then ## this is, e.g., implied by not IsInitial( S ), since we assume a colift exists
803+
elm_T := AsList( T )[1];
804+
fi;
805+
806+
chi :=
807+
function ( y )
808+
if not y in im_alpha then
809+
return [ y, elm_T ];
810+
fi;
811+
return [ y, beta( ElementOfPreimage( alpha, y ) ) ];
812+
end;
813+
814+
return MapOfFinSets( S, List( AsList( S ), chi ), T );
815+
816+
end );
817+
771818
##
772819
AddImageEmbedding( category_of_finite_sets,
773820
function ( category_of_finite_sets, phi )

0 commit comments

Comments
 (0)