Skip to content

Commit

Permalink
d&i IsClosedPreSheafWRTCoproductCocones
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamed-barakat committed Mar 3, 2024
1 parent 3546f09 commit 1032cff
Show file tree
Hide file tree
Showing 5 changed files with 286 additions and 1 deletion.
12 changes: 12 additions & 0 deletions FunctorCategories/gap/PreSheaves.gd
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,15 @@ DeclareOperation( "ApplyPreSheafToMorphismInFiniteStrictCoproductCompletion",
#! @Arguments C
DeclareAttribute( "CategoryOfInternalCategories",
IsCapCategory );

DeclareOperation( "IsClosedPreSheafWRTCoproductCocones",
[ IsPreSheafCategory, IsObjectInPreSheafCategory, IsList ] );

DeclareOperation( "IsClosedPreSheafWRTCoproducts",
[ IsPreSheafCategory, IsObjectInPreSheafCategory, IsList ] );

DeclareOperation( "IsClosedPreSheafWRTCoproductsByIndices",
[ IsPreSheafCategory, IsObjectInPreSheafCategory, IsList ] );

DeclareOperation( "CoproductCoconesClosureOperatorOfPreSheaf",
[ IsPreSheafCategory, IsObjectInPreSheafCategory, IsList ] );
94 changes: 93 additions & 1 deletion FunctorCategories/gap/PreSheaves.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2775,7 +2775,10 @@ InstallMethodForCompilerForCAP( ApplyObjectInPreSheafCategoryOfFpEnrichedCategor

else

Error( "the type of the source category `B` is not supported yet\n" );
morB_op := MorphismConstructor( B_op,
SetOfObjects( B_op )[SafeUniquePositionProperty( SetOfObjects( B ), obj -> IsEqualForObjects( B, obj, Target( morB ) ) )],

Check warning on line 2779 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L2778-L2779

Added lines #L2778 - L2779 were not covered by tests
morB,
SetOfObjects( B_op )[SafeUniquePositionProperty( SetOfObjects( B ), obj -> IsEqualForObjects( B, obj, Source( morB ) ) )] );

Check warning on line 2781 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L2781

Added line #L2781 was not covered by tests

fi;

Expand Down Expand Up @@ -4441,6 +4444,95 @@ InstallMethod( SimpleObjects,

end );

####################################
#
# Methods for operations
#
####################################

##
InstallMethod( IsClosedPreSheafWRTCoproductCocones,
[ IsPreSheafCategory, IsObjectInPreSheafCategory, IsList ],

function( PSh, F, list_of_coproduct_cones )
local H, coproducts, cocones;

H := Target( PSh );

Check warning on line 4460 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4460

Added line #L4460 was not covered by tests

coproducts := List( list_of_coproduct_cones, cocone -> cocone[1] );
cocones := List( list_of_coproduct_cones, cocone -> cocone[2] );

Check warning on line 4463 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4462-L4463

Added lines #L4462 - L4463 were not covered by tests

return ForAll( [ 1 .. Length( coproducts ) ], i ->
IsIsomorphism( H,
UniversalMorphismIntoDirectProduct( H,
List( cocones[i], morphism ->
ApplyObjectInPreSheafCategoryOfFpEnrichedCategoryToObject( PSh, F, Source( morphism ) ) ),
ApplyObjectInPreSheafCategoryOfFpEnrichedCategoryToObject( PSh, F, coproducts[i] ),
List( cocones[i], morphism ->
ApplyObjectInPreSheafCategoryOfFpEnrichedCategoryToMorphism( PSh, F, morphism ) ) ) ) );

Check warning on line 4472 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4465-L4472

Added lines #L4465 - L4472 were not covered by tests

end );

##
InstallMethod( IsClosedPreSheafWRTCoproducts,
[ IsPreSheafCategory and IsThinCategory, IsObjectInPreSheafCategory, IsList ],

function( PSh, F, list_of_coproducts )
local P, coproducts, cocones, list_of_coproduct_cones;

P := Source( PSh );

Check warning on line 4483 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4483

Added line #L4483 was not covered by tests

if not CanCompute( P, "UniqueMorphism" ) then
Error( "the poset `P := Source( PSh )` cannot compute the categorical operation `UniqueMorphism`\n" );
fi;

Check warning on line 4487 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4485-L4487

Added lines #L4485 - L4487 were not covered by tests

coproducts := List( list_of_coproducts, cocone -> cocone[1] );
cocones := List( list_of_coproducts, cocone -> List( cocone[2], cofactor -> UniqueMorphism( P, cofactor, cocone[1] ) ) );

Check warning on line 4490 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4489-L4490

Added lines #L4489 - L4490 were not covered by tests

list_of_coproduct_cones := ListN( coproducts, cocones, { coproduct, cocone } -> [ coproduct, cocone ] );

Check warning on line 4492 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4492

Added line #L4492 was not covered by tests

return IsClosedPreSheafWRTCoproductCocones( PSh, F, list_of_coproduct_cones );

Check warning on line 4494 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4494

Added line #L4494 was not covered by tests

end );

##
InstallMethod( IsClosedPreSheafWRTCoproductsByIndices,
[ IsPreSheafCategory and IsThinCategory, IsObjectInPreSheafCategory, IsList ],

function( PSh, F, list_of_coproducts_by_indices )
local offset, P, objects, coproducts, cofactors, list_of_coproducts;

offset := CAP_INTERNAL_RETURN_OPTION_OR_DEFAULT( "offset", 0 );

Check warning on line 4505 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4505

Added line #L4505 was not covered by tests

P := Source( PSh );

Check warning on line 4507 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4507

Added line #L4507 was not covered by tests

objects := SetOfObjects( P );

Check warning on line 4509 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4509

Added line #L4509 was not covered by tests

coproducts := List( list_of_coproducts_by_indices, cocone -> objects[offset + cocone[1]] );
cofactors := List( list_of_coproducts_by_indices, cocone -> List( cocone[2], i -> objects[offset + i] ) );

Check warning on line 4512 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4511-L4512

Added lines #L4511 - L4512 were not covered by tests

list_of_coproducts := ListN( coproducts, cofactors, { coproduct, cofactor } -> [ coproduct, cofactor ] );

Check warning on line 4514 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4514

Added line #L4514 was not covered by tests

return IsClosedPreSheafWRTCoproducts( PSh, F, list_of_coproducts );

Check warning on line 4516 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4516

Added line #L4516 was not covered by tests

end );

##
InstallMethod( CoproductCoconesClosureOperatorOfPreSheaf,
[ IsPreSheafCategory, IsObjectInPreSheafCategory, IsList ],

function( PSh, F, list_of_coproduct_cones )
local coproducts, cocones, objects;

coproducts := List( list_of_coproduct_cones, cocone -> cocone[1] );
cocones := List( list_of_coproduct_cones, cocone -> cocone[2] );

Check warning on line 4528 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4527-L4528

Added lines #L4527 - L4528 were not covered by tests

objects := SetOfObjects( Source( PSh ) );

Check warning on line 4530 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4530

Added line #L4530 was not covered by tests

Error( );

Check warning on line 4532 in FunctorCategories/gap/PreSheaves.gi

View check run for this annotation

Codecov / codecov/patch

FunctorCategories/gap/PreSheaves.gi#L4532

Added line #L4532 was not covered by tests

end );

####################################
#
# View, Print, Display and LaTeX methods:
Expand Down
80 changes: 80 additions & 0 deletions Locales/examples/DifferenceCSL.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#! @Chunk DifferenceCSL

# the assumption si <= mi leads to fewer meets and joins:

#! @Example
LoadPackage( "FunctorCategories", false );
#! true
q := "q(m0,s0,m1,s1,m2,s2,m0_x_s1,s0_u_m1,m1_x_s2,s1_u_m2)\
[sm0:s0->m0,sm1:s1->m1,sm2:s2->m2,\
p011:m0_x_s1->s1,\
i101:m1->s0_u_m1,\
p122:m1_x_s2->s2,\
i212:m2->s1_u_m2,\
mc0:m0_x_s1->s0,jc0:m0->s0_u_m1,\
mc1:m1_x_s2->s1,jc1:m1->s1_u_m2]";;
q := FinQuiver( q );
#! FinQuiver( "q(m0,s0,m1,s1,m2,s2,m0_x_s1,s0_u_m1,m1_x_s2,s1_u_m2)
#! [sm0:s0-≻m0,sm1:s1-≻m1,sm2:s2-≻m2,
#! p011:m0_x_s1-≻s1,
#! i101:m1-≻s0_u_m1,
#! p122:m1_x_s2-≻s2,
#! i212:m2-≻s1_u_m2,
#! mc0:m0_x_s1-≻s0,jc0:m0-≻s0_u_m1,
#! mc1:m1_x_s2-≻s1,jc1:m1-≻s1_u_m2]" )
F := PathCategory( q );
#! PathCategory( FinQuiver( "q(m0,s0,m1,s1,m2,s2,m0_x_s1,s0_u_m1,m1_x_s2,s1_u_m2)
#! [sm0:s0-≻m0,sm1:s1-≻m1,sm2:s2-≻m2,
#! p011:m0_x_s1-≻s1,
#! i101:m1-≻s0_u_m1,
#! p122:m1_x_s2-≻s2,
#! i212:m2-≻s1_u_m2,
#! mc0:m0_x_s1-≻s0,jc0:m0-≻s0_u_m1,
#! mc1:m1_x_s2-≻s1,jc1:m1-≻s1_u_m2]" ) )
Size( F );
#! 35
HomStructure( F.s0, F.s0_u_m1 );
#! |1|
HomStructure( F.s1, F.s1_u_m2 );
#! |1|
HomStructure( F.m0_x_s1, F.m0 );
#! |1|
HomStructure( F.m1_x_s2, F.m1 );
#! |1|
C := F /
[ [ F.p011 * F.sm1 * F.i101, F.mc0 * F.sm0 * F.jc0 ],
[ F.p122 * F.sm2 * F.i212, F.mc1 * F.sm1 * F.jc1 ] ];
#! PathCategory( FinQuiver( "q(m0,s0,m1,s1,m2,s2,m0_x_s1,s0_u_m1,m1_x_s2,s1_u_m2)
#! [sm0:s0-≻m0,sm1:s1-≻m1,sm2:s2-≻m2,
#! p011:m0_x_s1-≻s1,
#! i101:m1-≻s0_u_m1,
#! p122:m1_x_s2-≻s2,
#! i212:m2-≻s1_u_m2,
#! mc0:m0_x_s1-≻s0,jc0:m0-≻s0_u_m1,
#! mc1:m1_x_s2-≻s1,jc1:m1-≻s1_u_m2]" ) )
#! / [ p011⋅sm1⋅i101 = mc0⋅sm0⋅jc0, p122⋅sm2⋅i212 = mc1⋅sm1⋅jc1 ]
Size( C );
#! 33
P := PosetOfCategory( F );;
Size( P );
#! 33
digraphF := DigraphOfPoset( P );;
digraphF!.vertexlabels := List( SetOfObjects( F ), String );
#Splash( DotVertexLabelledDigraph( digraphF ) );
PSh := PreSheaves( P );;
digraphPSh := DigraphOfPoset( PSh );;
#Splash( DotVertexLabelledDigraph( digraphPSh ) );
presheaves := SetOfObjects( PSh );;
Y := YonedaEmbeddingOfSourceCategory( PSh );
digraphP := DigraphOfPoset( P );;
digraphP!.vertexlabels := List( SetOfObjects( P ), o -> String( -1 + SafePosition( presheaves, Y( o ) ) ) );
#Splash( DotVertexLabelledDigraph( digraphP ) );
cocones := [ [ P.s0_u_m1, [ P.s0, P.m1 ] ],
[ P.s1_u_m2, [ P.s1, P.m2 ] ] ];
is_closed := F -> IsClosedPreSheafWRTCoproducts( PSh, F, cocones );
PShJ := FullSubcategoryByObjectMembershipFunction( PSh, is_closed );
digraphPShJ := DigraphOfPoset( PShJ );;
digraphPShJ!.vertexlabels := List( SetOfObjects( PShJ ), c -> String( -1 + SafePosition( presheaves, ObjectDatum( c ) ) ) );
#Splash( DotVertexLabelledDigraph( digraphPShJ ) );

#! @EndExample
71 changes: 71 additions & 0 deletions Locales/examples/FreeBooleanAlgebra.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#! @Chunk FreeBooleanAlgebra

#! Construct the free boolean algebra on two generators with its $2^(2^2)$ elements
#! in two steps.

#! @Example
LoadPackage( "FunctorCategories", false );
#! true
pq := FinQuiver( "quiver(p,q)" );
#! FinQuiver( "quiver(p,q)[]" )
F := PathCategory( pq );
#! PathCategory( FinQuiver( "quiver(p,q)[]" ) )
P := PosetOfCategory( F );
#! PosetOfCategory( PathCategory( FinQuiver( "quiver(p,q)[]" ) ) )
Length( SetOfObjects( P ) );
#! 2
Dist := FreeDistributiveCompletion( P );
#! FreeDistributiveCompletion(
#! PosetOfCategory( PathCategory( FinQuiver( "quiver(p,q)[]" ) ) ) )
Display( Dist );
#! A CAP category with name FreeDistributiveCompletion(
#! PosetOfCategory( PathCategory( FinQuiver( "quiver(p,q)[]" ) ) ) ):
#!
#! 54 primitive operations were used to derive 250 operations for this category
#! which algorithmically
#! * IsFiniteCategory
#! * IsEquippedWithHomomorphismStructure
#! * IsDistributiveLattice
#! and not yet algorithmically
#! * IsBiHeytingAlgebra
Length( SetOfObjects( Dist ) );
#! 6
digraphDist := DigraphOfPoset( Dist );;
#Splash( DotVertexLabelledDigraph( digraphDist ) );
DiffbCSL := MeetSemilatticeOfSingleDifferences( Dist );
#! MeetSemilatticeOfSingleDifferences( FreeDistributiveCompletion(
#! PosetOfCategory( PathCategory( FinQuiver( "quiver(p,q)[]" ) ) ) ) )
Length( SetOfObjects( DiffbCSL ) );
#! 13
digraphDiffbCSL := DigraphOfPoset( DiffbCSL );;
#Splash( DotVertexLabelledDigraph( digraphDiffbCSL ) );
PSh := PreSheaves( DiffbCSL );
#! PreSheaves( MeetSemilatticeOfSingleDifferences( FreeDistributiveCompletion(
#! PosetOfCategory( PathCategory( FinQuiver( "quiver(p,q)[]" ) ) ) ) ),
#! IntervalCategory )
presheaves := SetOfObjects( PSh );;
Length( presheaves );
#! 85
#digraphPSh := DigraphOfPoset( PSh );;
#Splash( DotVertexLabelledDigraph( digraphPSh ) );
cocones := [ [ 0, [ ] ],
[ 3, [ 5, 7 ] ],
[ 2, [ 5, 9 ] ],
[ 6, [ 7, 10 ] ],
[ 8, [ 9, 10 ] ],
[ 12, [ 7, 9 ] ],
[ 4, [ 3, 2, 12 ] ],
[ 11, [ 6, 8, 12 ] ],
[ 1, [ 4, 11 ] ] ];;
is_closed := F -> IsClosedPreSheafWRTCoproductsByIndices( PSh, F, cocones : offset := 1 );
PShJ := FullSubcategoryByObjectMembershipFunction( PSh, is_closed );
#! FullSubcategoryByObjectMembershipFunction( PreSheaves(
#! MeetSemilatticeOfSingleDifferences( FreeDistributiveCompletion(
#! PosetOfCategory( PathCategory( FinQuiver( "quiver(p,q)[]" ) ) ) ) ),
#! IntervalCategory ), ObjectMembershipFunction )
digraphPShJ := DigraphOfPoset( PShJ );;
digraphPShJ!.vertexlabels := List( SetOfObjects( PShJ ), c -> String( -1 + SafePosition( presheaves, ObjectDatum( c ) ) ) );
Length( SetOfObjects( PShJ ) );
#! 16
#Splash( DotVertexLabelledDigraph( digraphPShJ ) );
#! @EndExample
30 changes: 30 additions & 0 deletions Locales/gap/Proset.gi
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,36 @@ InstallOtherMethod( Size,

end );

##
InstallOtherMethod( CapFunctor,
"for a thin category, two lists, and the interval category",
[ IsThinCategory and IsFiniteCategory, IsList, IsList, IsIntervalCategory ],

function( P, imgs_of_objs, imgs_of_gmors, interval_category )
local F;

F := CapFunctor( Concatenation( "Functor from ", Name( P ), " -> ", Name( interval_category ) ), P, interval_category );

Check warning on line 86 in Locales/gap/Proset.gi

View check run for this annotation

Codecov / codecov/patch

Locales/gap/Proset.gi#L86

Added line #L86 was not covered by tests

AddObjectFunction( F,

Check warning on line 88 in Locales/gap/Proset.gi

View check run for this annotation

Codecov / codecov/patch

Locales/gap/Proset.gi#L88

Added line #L88 was not covered by tests
function ( obj )

return imgs_of_objs[SafeUniquePositionProperty( SetOfObjects( P ), o -> IsEqualForObjects( P, o, obj ) )];

Check warning on line 91 in Locales/gap/Proset.gi

View check run for this annotation

Codecov / codecov/patch

Locales/gap/Proset.gi#L91

Added line #L91 was not covered by tests

end );

Check warning on line 93 in Locales/gap/Proset.gi

View check run for this annotation

Codecov / codecov/patch

Locales/gap/Proset.gi#L93

Added line #L93 was not covered by tests

AddMorphismFunction( F,

Check warning on line 95 in Locales/gap/Proset.gi

View check run for this annotation

Codecov / codecov/patch

Locales/gap/Proset.gi#L95

Added line #L95 was not covered by tests
function ( F_s, mor, F_t )

return UniqueMorphism( interval_category,

Check warning on line 98 in Locales/gap/Proset.gi

View check run for this annotation

Codecov / codecov/patch

Locales/gap/Proset.gi#L98

Added line #L98 was not covered by tests
F_s,
F_t );

Check warning on line 100 in Locales/gap/Proset.gi

View check run for this annotation

Codecov / codecov/patch

Locales/gap/Proset.gi#L100

Added line #L100 was not covered by tests

end );

Check warning on line 102 in Locales/gap/Proset.gi

View check run for this annotation

Codecov / codecov/patch

Locales/gap/Proset.gi#L102

Added line #L102 was not covered by tests

return F;

Check warning on line 104 in Locales/gap/Proset.gi

View check run for this annotation

Codecov / codecov/patch

Locales/gap/Proset.gi#L104

Added line #L104 was not covered by tests

end );

##
InstallMethod( Display,
"for an object in a proset",
Expand Down

0 comments on commit 1032cff

Please sign in to comment.