Skip to content

Commit

Permalink
AddIsColiftable + AddColift for FinSets
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamed-barakat committed Dec 3, 2021
1 parent 7b69c00 commit 7f818cc
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 1 deletion.
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 := "2021.11-16",
Version := "2021.11-17",

Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
License := "GPL-2.0-or-later",
Expand Down
3 changes: 3 additions & 0 deletions doc/Doc.autodoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
@Subsection Lift
@InsertChunk Lift

@Subsection Colift
@InsertChunk Colift

@Subsection Topos properties
@InsertChunk Topos

Expand Down
30 changes: 30 additions & 0 deletions examples/Colift.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#! @Chunk Colift

LoadPackage( "FinSetsForCAP" );

#! @Example
m := FinSet( [ 1 .. 5 ] );
#! <An object in FinSets>
n := FinSet( [ 1 .. 4 ] );
#! <An object in FinSets>
f := MapOfFinSets(
m,
[ [ 1, 2 ], [ 2, 2 ], [ 3, 1 ], [ 4, 1 ], [ 5, 3 ] ],
n );
#! <A morphism in FinSets>
g := MapOfFinSets(
m,
[ [ 1, 5 ], [ 2, 5 ], [ 3, 4 ], [ 4, 4 ], [ 5, 5 ] ],
m );
#! <A morphism in FinSets>
IsColiftable( f, g );
#! true
chi := Colift( f, g );
#! <A morphism in FinSets>
Display( chi );
#! [ [ 1 .. 4 ], [ [ 1, 4 ], [ 2, 5 ], [ 3, 5 ], [ 4, 1 ] ], [ 1 .. 5 ] ]
PreCompose( f, Colift( f, g ) ) = g;
#! true
IsColiftable( g, f );
#! false
#! @EndExample
7 changes: 7 additions & 0 deletions gap/FinSetsForCAP.gd
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ DeclareOperation( "ProjectionOfFinSets",
DeclareOperation( "Preimage",
[ IsFiniteSetMap, IsFiniteSet ] );

#! @Description
#! Compute an element of the preimage of the element <A>y</A> under the morphism <A>f</A>.
#! @Arguments f, y
#! @Returns a GAP object
DeclareOperation( "ElementOfPreimage",
[ IsFiniteSetMap, IsObject ] );

#! @Description
#! Compute the image of <A>S_</A> under the morphism <A>f</A>.
#! @Arguments f, S_
Expand Down
47 changes: 47 additions & 0 deletions gap/FinSetsForCAP.gi
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,17 @@ InstallMethod( Preimage,

end );

##
InstallMethod( ElementOfPreimage,
"for a CAP map of finite sets and a GAP object",
[ IsFiniteSetMap, IsObject ],

function ( f, y )

return First( Source( f ), x -> IsEqualForElementsOfFinSets( f(x), y ) );

end );

##
InstallMethod( ImageObject,
"for a CAP map of finite sets and a CAP finite set",
Expand Down Expand Up @@ -770,6 +781,42 @@ AddLift( category_of_finite_sets,

end );

## beta \circ alpha^{-1} is again an ordinary function,
## i.e., fibers of alpha are mapped under beta to the same element
AddIsColiftable( category_of_finite_sets,
function ( category_of_finite_sets, alpha, beta )

return ForAll( AsList( ImageObject( alpha ) ),
i -> Length( DuplicateFreeList( List( Preimage( alpha, FinSetNC( category_of_finite_sets, [ i ] ) ), beta ) ) ) = 1 );

end );

##
AddColift( category_of_finite_sets,
function ( category_of_finite_sets, alpha, beta )
local S, T, im_alpha, elm_T, chi;

S := Range( alpha );
T := Range( beta );

im_alpha := AsList( ImageObject( alpha ) );

if not IsInitial( T ) then ## this is, e.g., implied by not IsInitial( S ), since we assume a colift exists
elm_T := AsList( T )[1];
fi;

chi :=
function ( y )
if not y in im_alpha then
return [ y, elm_T ];
fi;
return [ y, beta( ElementOfPreimage( alpha, y ) ) ];
end;

return MapOfFinSets( S, List( AsList( S ), chi ), T );

end );

##
AddImageEmbedding( category_of_finite_sets,
function ( category_of_finite_sets, phi )
Expand Down

0 comments on commit 7f818cc

Please sign in to comment.