Skip to content

Commit c50a7dd

Browse files
Merge pull request #69 from mohamed-barakat/compilation
start compilation
2 parents cad3d6d + 10535fd commit c50a7dd

7 files changed

Lines changed: 201 additions & 30 deletions

PackageInfo.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Dependencies := rec(
9999
GAP := ">= 4.13.0",
100100
NeededOtherPackages := [
101101
[ "GAPDoc", ">= 1.5" ],
102-
[ "CAP", ">= 2026.05-02" ],
102+
[ "CAP", ">= 2026.05-04" ],
103103
[ "GroupsAsCategoriesForCAP", ">= 2026.04-02" ],
104104
[ "FinSetsForCAP", ">= 2022.05-01" ],
105105
],

doc/Doc.autodoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
@Section Reconstruction Tools
2828
@Section Examples
2929

30+
@Chapter Precompilation
3031

3132
@Chapter Bibliography
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#! @Chapter Precompilation
2+
3+
#! @Section Precompiling the skeletal category of finite left G-sets
4+
5+
#! @Example
6+
7+
#! #@if ValueOption( "no_precompiled_code" ) <> true
8+
9+
LoadPackage( "FinGSetsForCAP", false );
10+
#! true
11+
LoadPackage( "CompilerForCAP", ">= 2026.05-01", false );
12+
#! true
13+
ReadPackageOnce( "FinSetsForCAP", "gap/CompilerLogic.gi" );
14+
#! true
15+
16+
category_constructor :=
17+
G -> SkeletalCategoryOfTransitiveLeftGSets(
18+
GROUP_AS_CATEGORY( G : FinalizeCategory := true ) );;
19+
C2 := CyclicGroup( 2 );; StructureDescription( C2 );; C2;
20+
#! C2
21+
given_arguments := [ C2 ];;
22+
compiled_category_name :=
23+
"SkeletalCategoryOfTransitiveLeftGSets_precompiled";;
24+
package_name := "FinGSetsForCAP";;
25+
#primitive_operations :=
26+
# ListPrimitivelyInstalledOperationsOfCategory(
27+
# category_constructor( given_arguments[1]
28+
# : no_precompiled_code := true ) );;
29+
list_of_operations :=
30+
#SortedList( Concatenation( primitive_operations,
31+
[ "SetOfObjectsOfCategory",
32+
"IsEqualForObjects",
33+
"IsWellDefinedForObjects",
34+
#"IsWellDefinedForMorphisms",
35+
];;
36+
#) );;
37+
38+
CapJitPrecompileCategoryAndCompareResult(
39+
category_constructor,
40+
given_arguments,
41+
package_name,
42+
compiled_category_name
43+
: operations := list_of_operations,
44+
number_of_objectified_objects_in_data_structure_of_object := 1,
45+
number_of_objectified_morphisms_in_data_structure_of_object := 0,
46+
number_of_objectified_objects_in_data_structure_of_morphism := 2,
47+
number_of_objectified_morphisms_in_data_structure_of_morphism := 1
48+
);;
49+
50+
SkeletalCategoryOfTransitiveLeftGSets_precompiled( C2 );
51+
#! SkeletalCategoryOfTransitiveLeftGSets( C2 ) with 2 objects
52+
53+
cat := SkeletalCategoryOfTransitiveLeftGSets( C2 );
54+
#! SkeletalCategoryOfTransitiveLeftGSets( C2 ) with 2 objects
55+
56+
cat!.precompiled_functions_added;
57+
#! true
58+
59+
#! #@fi
60+
61+
#! @EndExample

gap/SkeletalCategoryOfTransitiveLeftGSets.gd

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ DeclareAttribute( "SkeletalCategoryOfTransitiveLeftGSets",
6161
DeclareAttribute( "UnderlyingGroup",
6262
IsSkeletalCategoryOfTransitiveLeftGSets );
6363

64-
#CapJitAddTypeSignature( "UnderlyingGroup", [ IsSkeletalCategoryOfTransitiveLeftGSets ], function ( input_types )
65-
#
66-
# return CapJitDataTypeOfGroup( UnderlyingGroup( input_types[1].category ) );
67-
#
68-
#end );
64+
CapJitAddTypeSignature( "UnderlyingGroup", [ IsSkeletalCategoryOfTransitiveLeftGSets ], function ( input_types )
65+
66+
return CapJitDataTypeOfGroup( UnderlyingGroup( input_types[1].category ) );
67+
68+
end );
6969

7070
#! @Description
7171
#! The group $G$ underlying the skeletal category <A>C</A> of transitive left $G$-set, viewed as a category on one object.
@@ -103,19 +103,25 @@ CapJitAddTypeSignature( "NumberOfObjects", [ IsSkeletalCategoryOfTransitiveLeftG
103103
DeclareAttribute( "CardinalitiesOfObjects",
104104
IsSkeletalCategoryOfTransitiveLeftGSets );
105105

106-
#CapJitAddTypeSignature( "CardinalitiesOfObjects", [ IsSkeletalCategoryOfTransitiveLeftGSets ], function ( input_types )
107-
#
108-
# return CapJitDataTypeOfListOf( IsBigInt );
109-
#
110-
#end );
106+
CapJitAddTypeSignature( "CardinalitiesOfObjects", [ IsSkeletalCategoryOfTransitiveLeftGSets ], function ( input_types )
107+
108+
return CapJitDataTypeOfListOf( IsBigInt );
109+
110+
end );
111111

112112
#! @Description
113-
#! The number of objects of the skeletal category <A>C</A> of transitive left $G$-set.
113+
#! The list of subgroups up to conjugation of the underlying group.
114114
#! @Arguments C
115115
#! @Returns a positive integer
116116
DeclareAttribute( "RepresentativesOfSubgroupsUpToConjugation",
117117
IsSkeletalCategoryOfTransitiveLeftGSets );
118118

119+
CapJitAddTypeSignature( "RepresentativesOfSubgroupsUpToConjugation", [ IsSkeletalCategoryOfTransitiveLeftGSets ], function ( input_types )
120+
121+
return CapJitDataTypeOfListOf( CapJitDataTypeOfSubgroup( UnderlyingGroup( input_types[1].category ) ) );
122+
123+
end );
124+
119125
#! @Description
120126
#! The positive integer $i$ such that the transitive left $G$-set <A>Omega</A> $\cong U_i \backslash G$, i.e.,
121127
#! <C>ObjectNumber( TransitiveGSet( G, i ) ) = i</C>.
@@ -124,7 +130,13 @@ DeclareAttribute( "RepresentativesOfSubgroupsUpToConjugation",
124130
DeclareAttribute( "ObjectNumber",
125131
IsObjectInSkeletalCategoryOfTransitiveLeftGSets );
126132

127-
CapJitAddTypeSignature( "ObjectNumber", [ IsObjectInSkeletalCategoryOfTransitiveLeftGSets ], IsBigInt );
133+
CapJitAddTypeSignature( "ObjectNumber", [ IsObjectInSkeletalCategoryOfTransitiveLeftGSets ], function ( input_types )
134+
135+
Assert( 0, IsSkeletalCategoryOfTransitiveLeftGSets( input_types[1].category ) );
136+
137+
return ObjectDatumType( input_types[1].category );
138+
139+
end );
128140

129141
#! @Description
130142
#! The group elements $g \in G$ defining the morphism <A>phi</A>: $\cong U_s \backslash G \to U_t \backslash G$
@@ -134,13 +146,13 @@ CapJitAddTypeSignature( "ObjectNumber", [ IsObjectInSkeletalCategoryOfTransitive
134146
DeclareAttribute( "UnderlyingGroupElement",
135147
IsMorphismInSkeletalCategoryOfTransitiveLeftGSets );
136148

137-
#CapJitAddTypeSignature( "UnderlyingGroupElement", [ IsMorphismInSkeletalCategoryOfTransitiveLeftGSets ], function ( input_types )
138-
#
139-
# Assert( 0, IsSkeletalCategoryOfTransitiveLeftGSets( input_types[1].category ) );
140-
#
141-
# return CapJitDataTypeOfElementOfGroup( UnderlyingGroup( input_types[1].category ) );
142-
#
143-
#end );
149+
CapJitAddTypeSignature( "UnderlyingGroupElement", [ IsMorphismInSkeletalCategoryOfTransitiveLeftGSets ], function ( input_types )
150+
151+
Assert( 0, IsSkeletalCategoryOfTransitiveLeftGSets( input_types[1].category ) );
152+
153+
return MorphismDatumType( input_types[1].category );
154+
155+
end );
144156

145157
#! @Description
146158
#! The cardinality of the transitive left $G$-set <A>Omega</A>.

gap/SkeletalCategoryOfTransitiveLeftGSets.gi

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ InstallMethod( SkeletalCategoryOfTransitiveLeftGSets,
1515
[ "overhead", true ],
1616
],
1717
function ( CAP_NAMED_ARGUMENTS, group_as_category )
18-
local group, name_of_group, tom, u, name, SkeletalTransitiveGSets;
18+
local group, name_of_group, tom, u,
19+
name, category_filter, category_object_filter, category_morphism_filter,
20+
object_datum_type, morphism_datum_type,
21+
SkeletalTransitiveGSets;
1922

2023
group := UnderlyingGroup( group_as_category );
2124

@@ -34,14 +37,26 @@ InstallMethod( SkeletalCategoryOfTransitiveLeftGSets,
3437

3538
name := Concatenation( "SkeletalCategoryOfTransitiveLeftGSets( ", name_of_group, " ) with ", String( u ), " objects" );
3639

40+
##
41+
category_filter := IsSkeletalCategoryOfTransitiveLeftGSets;
42+
category_object_filter := IsObjectInSkeletalCategoryOfTransitiveLeftGSets;
43+
category_morphism_filter := IsMorphismInSkeletalCategoryOfTransitiveLeftGSets;
44+
45+
##
46+
object_datum_type := IsBigInt;
47+
48+
##
49+
morphism_datum_type := CapJitDataTypeOfElementOfGroup( group );
50+
3751
SkeletalTransitiveGSets :=
38-
CreateCapCategoryWithDataTypes( name,
39-
IsSkeletalCategoryOfTransitiveLeftGSets,
40-
IsObjectInSkeletalCategoryOfTransitiveLeftGSets,
41-
IsMorphismInSkeletalCategoryOfTransitiveLeftGSets,
52+
CreateCapCategoryWithDataTypes(
53+
name,
54+
category_filter,
55+
category_object_filter,
56+
category_morphism_filter,
4257
IsCapCategoryTwoCell,
43-
IsBigInt,
44-
IsMultiplicativeElementWithInverse,
58+
object_datum_type,
59+
morphism_datum_type,
4560
fail :
4661
overhead := CAP_NAMED_ARGUMENTS.overhead );
4762

@@ -215,7 +230,7 @@ InstallMethod( SkeletalCategoryOfTransitiveLeftGSets,
215230
function ( SkeletalTransitiveGSets, mor_pre, mor_post )
216231

217232
## we choose the left cosets in order for the embedding G ↪ SkeletalCategoryOfTransitiveLeftGSets( G ) to be covariant:
218-
## g: G/U → G/V, h: G/V → G/W, translates to UᵍV, VʰWUᵍVᵍʰW
233+
## g: G/U → G/V, h: G/V → G/W, translates to UᵍV, VʰWUᵍʰW
219234
return MorphismConstructor( SkeletalTransitiveGSets,
220235
Source( mor_pre ),
221236
UnderlyingGroupElement( mor_pre ) * UnderlyingGroupElement( mor_post ),
@@ -450,6 +465,12 @@ InstallMethod( SkeletalCategoryOfTransitiveLeftGSets,
450465

451466
end );
452467

468+
if CAP_NAMED_ARGUMENTS.no_precompiled_code <> true then
469+
470+
ADD_FUNCTIONS_FOR_SkeletalCategoryOfTransitiveLeftGSets_precompiled( SkeletalTransitiveGSets );
471+
472+
fi;
473+
453474
if CAP_NAMED_ARGUMENTS.FinalizeCategory then
454475
Finalize( SkeletalTransitiveGSets );
455476
fi;
@@ -494,13 +515,13 @@ InstallMethod( \.,
494515
end );
495516

496517
##
497-
InstallMethod( SetOfObjects,
518+
InstallMethodForCompilerForCAP( SetOfObjects,
498519
"for the skeletal category of transitive left G-sets",
499520
[ IsSkeletalCategoryOfTransitiveLeftGSets ],
500521

501522
function ( SkeletalTransitiveGSets )
502523

503-
return SetOfObjectsOfCategory( SkeletalTransitiveGSets );
524+
return SetOfObjectsAsUnresolvableAttribute( SkeletalTransitiveGSets );
504525

505526
end );
506527

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# SPDX-License-Identifier: GPL-2.0-or-later
2+
# FinGSetsForCAP: The (skeletal) elementary topos of finite G-sets
3+
#
4+
# Implementations
5+
#
6+
BindGlobal( "ADD_FUNCTIONS_FOR_SkeletalCategoryOfTransitiveLeftGSets_precompiled", function ( cat )
7+
8+
##
9+
AddSetOfObjectsOfCategory( cat,
10+
11+
########
12+
function ( cat_1 )
13+
return List( [ 1 .. NumberOfObjects( cat_1 ) ], function ( i_2 )
14+
return CreateCapCategoryObjectWithAttributes( cat_1, ObjectNumber, i_2 );
15+
end );
16+
end
17+
########
18+
19+
, 100 );
20+
21+
##
22+
AddIsEqualForObjects( cat,
23+
24+
########
25+
function ( cat_1, arg2_1, arg3_1 )
26+
return ObjectNumber( arg2_1 ) = ObjectNumber( arg3_1 );
27+
end
28+
########
29+
30+
, 100 );
31+
32+
##
33+
AddIsWellDefinedForObjects( cat,
34+
35+
########
36+
function ( cat_1, arg2_1 )
37+
return ObjectNumber( arg2_1 ) in [ 1 .. NumberOfObjects( cat_1 ) ];
38+
end
39+
########
40+
41+
, 100 );
42+
43+
if IsBound( cat!.precompiled_functions_added ) then
44+
45+
# COVERAGE_IGNORE_NEXT_LINE
46+
Error( "precompiled functions have already been added before" );
47+
48+
fi;
49+
50+
cat!.precompiled_functions_added := true;
51+
52+
end );
53+
54+
BindGlobal( "SkeletalCategoryOfTransitiveLeftGSets_precompiled", function ( G )
55+
local category_constructor, cat;
56+
57+
category_constructor :=
58+
59+
60+
function ( G )
61+
return SkeletalCategoryOfTransitiveLeftGSets( GROUP_AS_CATEGORY( G : FinalizeCategory := true ) );
62+
end;
63+
64+
65+
66+
cat := category_constructor( G : FinalizeCategory := false, no_precompiled_code := true );
67+
68+
ADD_FUNCTIONS_FOR_SkeletalCategoryOfTransitiveLeftGSets_precompiled( cat );
69+
70+
Finalize( cat );
71+
72+
return cat;
73+
74+
end );

read.g

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
ReadPackage( "FinGSetsForCAP", "gap/Tools.gi" );
88

9+
ReadPackage( "FinGSetsForCAP", "gap/precompiled_categories/SkeletalCategoryOfTransitiveLeftGSets_precompiled.gi" );
10+
911
ReadPackage( "FinGSetsForCAP", "gap/SkeletalCategoryOfTransitiveLeftGSets.gi" );
1012

1113
ReadPackage( "FinGSetsForCAP", "gap/SkeletalCategoryOfFiniteRightGSets.gi" );

0 commit comments

Comments
 (0)