Skip to content

Commit ab3dc26

Browse files
Merge pull request #253 from mohamed-barakat/SingletonMorphismPrecompiled
precompiled SingletonMorphismWithGivenPowerObject to optimal code 🎉
2 parents 99c2853 + b27dfb7 commit ab3dc26

File tree

7 files changed

+87
-2
lines changed

7 files changed

+87
-2
lines changed

PackageInfo.g

Lines changed: 2 additions & 2 deletions
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 := "2024.03-01",
13+
Version := "2024.03-02",
1414

1515
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)( ),
1616
License := "GPL-2.0-or-later",
@@ -100,7 +100,7 @@ Dependencies := rec(
100100
NeededOtherPackages := [
101101
[ "CAP", ">= 2023.12-05" ],
102102
[ "CartesianCategories", ">= 2024.02-02" ],
103-
[ "Toposes", ">= 2024.02-02" ],
103+
[ "Toposes", ">= 2024.03-04" ],
104104
],
105105
SuggestedOtherPackages := [ ],
106106
ExternalConditions := [ ],

doc/Doc.autodoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
@Subsection Lift
5959
@InsertChunk Lift
6060

61+
@Subsection Singleton morphism
62+
@InsertChunk SingletonMorphism
63+
6164
@Subsection Topos properties
6265
@InsertChunk Topos
6366

@@ -133,6 +136,9 @@
133136
@Subsection Skeletal Colift
134137
@InsertChunk SkeletalColift
135138

139+
@Subsection Skeletal singleton morphism
140+
@InsertChunk SkeletalSingletonMorphism
141+
136142
@Subsection Skeletal topos properties
137143
@InsertChunk SkeletalTopos
138144

examples/PrecompileCategoryOfSkeletalFinSetsWithMorphismsGivenByLists.g

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ list_of_operations :=
3232
"CoimageProjection",
3333
"IsHomSetInhabited",
3434
"TruthMorphismOfImplies",
35+
"SingletonMorphismWithGivenPowerObject",
3536
#"HasPushoutComplement",
3637
"PushoutComplement",
3738
] ) );;

examples/SingletonMorphism.g

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#! @Chunk SingletonMorphism
2+
3+
#! @Example
4+
LoadPackage( "FinSetsForCAP" );
5+
#! true
6+
a := FinSet( [ 1, 2, 3 ] );
7+
#! <An object in FinSets>
8+
sa := SingletonMorphism( a );
9+
#! <A monomorphism in FinSets>
10+
sa = LowerSegmentOfRelation( a, a, CartesianDiagonal( a, 2 ) );
11+
#! true
12+
sa = UpperSegmentOfRelation( a, a, CartesianDiagonal( a, 2 ) );
13+
#! true
14+
#! @EndExample
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#! @Chunk SkeletalSingletonMorphism
2+
3+
#! @Example
4+
LoadPackage( "FinSetsForCAP" );
5+
#! true
6+
a := FinSet( 3 );
7+
#! |3|
8+
sa := SingletonMorphism( a );;
9+
Display( sa );
10+
#! { 0, 1, 2 } ⱶ[ 1, 2, 4 ]→ { 0,..., 7 }
11+
sa = LowerSegmentOfRelation( a, a, CartesianDiagonal( a, 2 ) );
12+
#! true
13+
sa = UpperSegmentOfRelation( a, a, CartesianDiagonal( a, 2 ) );
14+
#! true
15+
#! @EndExample

gap/CompilerLogic.gi

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,3 +506,37 @@ CapJitAddLogicTemplate(
506506
dst_template := "q * GeometricSumDiff1( q, a ) + a * i * GeometricSum( q, a )",
507507
)
508508
);
509+
510+
CapJitAddLogicTemplate(
511+
rec(
512+
variable_names := [ "length", "value", "func" ],
513+
src_template := "List( ListWithIdenticalEntries( length, value ), func )",
514+
dst_template := "ListWithIdenticalEntries( length, func( value ) )",
515+
)
516+
);
517+
518+
CapJitAddLogicTemplate(
519+
rec(
520+
variable_names := [ "length", "value" ],
521+
src_template := "Length( ListWithIdenticalEntries( length, value ) )",
522+
dst_template := "length",
523+
)
524+
);
525+
526+
CapJitAddLogicTemplate(
527+
rec(
528+
variable_names := [ "length", "number" ],
529+
variable_filters := [ IsBigInt, IsBigInt ],
530+
src_template := "Product( ListWithIdenticalEntries( length, number ) )",
531+
dst_template := "number ^ length",
532+
)
533+
);
534+
535+
CapJitAddLogicTemplate(
536+
rec(
537+
variable_names := [ "j", "a", "b" ],
538+
variable_filters := [ IsBigInt, IsBigInt, IsBigInt ],
539+
src_template := "Sum( List( [ 0 .. a - 1 ], k -> List( [ 0 .. a ^ 2 - 1 ], function( x ) if x in List( [ 0 .. a - 1 ], i -> i + i * a ) then return BigInt( 1 ); else return BigInt( 0 ); fi; end )[1 + k + j * a] * b ^ k ) )",
540+
dst_template := "b ^ j",
541+
)
542+
);

gap/precompiled_categories/SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled.gi

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,21 @@ end
943943

944944
, 19464 : IsPrecompiledDerivation := true );
945945

946+
##
947+
AddSingletonMorphismWithGivenPowerObject( cat,
948+
949+
########
950+
function ( cat_1, a_1, Pa_1 )
951+
local hoisted_1_1;
952+
hoisted_1_1 := BigInt( 2 );
953+
return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, Pa_1, AsList, List( [ 0 .. Length( a_1 ) - 1 ], function ( i_2 )
954+
return hoisted_1_1 ^ i_2;
955+
end ) );
956+
end
957+
########
958+
959+
, 605 : IsPrecompiledDerivation := true );
960+
946961
##
947962
AddSomeInjectiveObject( cat,
948963

0 commit comments

Comments
 (0)