diff --git a/examples/PrecompileCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions.g b/examples/PrecompileCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions.g
new file mode 100644
index 00000000..bedded47
--- /dev/null
+++ b/examples/PrecompileCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions.g
@@ -0,0 +1,55 @@
+#! @Chapter Precompilation
+
+#! @Section Precompiling the category of skeletal finite sets
+
+#! @Example
+
+#! #@if ValueOption( "no_precompiled_code" ) <> true
+
+LoadPackage( "FinSetsForCAP", false );
+#! true
+LoadPackage( "CompilerForCAP", false );
+#! true
+
+ReadPackageOnce( "FinSetsForCAP", "gap/CompilerLogic.gi" );
+#! true
+
+category_constructor :=
+ {} -> CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions( );;
+given_arguments := [ ];;
+compiled_category_name :=
+ "CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctionsPrecompiled";;
+package_name := "FinSetsForCAP";;
+primitive_operations :=
+ ListPrimitivelyInstalledOperationsOfCategory(
+ category_constructor( : no_precompiled_code := true ) );;
+list_of_operations :=
+ SortedList( Concatenation( primitive_operations, [
+ #"HasPushoutComplement",
+ "PushoutComplement",
+ ] ) );;
+
+CapJitPrecompileCategoryAndCompareResult(
+ category_constructor,
+ given_arguments,
+ package_name,
+ compiled_category_name
+ : operations := list_of_operations,
+ number_of_objectified_objects_in_data_structure_of_object := 1,
+ number_of_objectified_morphisms_in_data_structure_of_object := 0,
+ number_of_objectified_objects_in_data_structure_of_morphism := 2,
+ number_of_objectified_morphisms_in_data_structure_of_morphism := 1
+);;
+
+CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctionsPrecompiled( );
+#! SkeletalFinSets
+
+cat := CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions( );
+#! SkeletalFinSets
+
+cat!.precompiled_functions_added;
+#! true
+
+#! #@fi
+
+#! @EndExample
diff --git a/examples/PrecompileCategoryOfSkeletalFinSetsWithMorphismsGivenByLists.g b/examples/PrecompileCategoryOfSkeletalFinSetsWithMorphismsGivenByLists.g
index 900c6e35..5e2ae6a4 100644
--- a/examples/PrecompileCategoryOfSkeletalFinSetsWithMorphismsGivenByLists.g
+++ b/examples/PrecompileCategoryOfSkeletalFinSetsWithMorphismsGivenByLists.g
@@ -11,10 +11,11 @@ LoadPackage( "FinSetsForCAP", false );
LoadPackage( "CompilerForCAP", false );
#! true
-ReadPackage( "FinSetsForCAP", "gap/CompilerLogic.gi" );
+ReadPackageOnce( "FinSetsForCAP", "gap/CompilerLogic.gi" );
#! true
-category_constructor := {} -> CategoryOfSkeletalFinSets( );;
+category_constructor :=
+ {} -> CategoryOfSkeletalFinSetsWithMorphismsGivenByLists( );;
given_arguments := [ ];;
compiled_category_name :=
"CategoryOfSkeletalFinSetsWithMorphismsGivenByListsPrecompiled";;
@@ -43,7 +44,7 @@ CapJitPrecompileCategoryAndCompareResult(
CategoryOfSkeletalFinSetsWithMorphismsGivenByListsPrecompiled( );
#! SkeletalFinSets
-cat := CategoryOfSkeletalFinSets( );
+cat := CategoryOfSkeletalFinSetsWithMorphismsGivenByLists( );
#! SkeletalFinSets
cat!.precompiled_functions_added;
diff --git a/examples/SkeletalWellDefined.g b/examples/SkeletalWellDefined.g
index 506574aa..6f53fa83 100644
--- a/examples/SkeletalWellDefined.g
+++ b/examples/SkeletalWellDefined.g
@@ -7,10 +7,6 @@ s := FinSet( 7 );
#! |7|
t := FinSet( 4 );
#! |4|
-psi := MapOfFinSets( s, [ 0, 2, 1, 2, 1, 3 ], t );
-#! |7| → |4|
-IsWellDefined( psi );
-#! false
psi := MapOfFinSets( s, [ 0, 2, 1, 2, 1, 3, -2 ], t );
#! |7| → |4|
IsWellDefined( psi );
diff --git a/gap/CompilerLogic.gi b/gap/CompilerLogic.gi
index 3de50c7c..c23dc45d 100644
--- a/gap/CompilerLogic.gi
+++ b/gap/CompilerLogic.gi
@@ -85,10 +85,121 @@ CapJitAddLogicFunction( function ( tree )
end );
+## list{[ ]} => [ ]
+CapJitAddLogicFunction( function ( tree )
+ local pre_func;
+
+ Info( InfoCapJit, 1, "####" );
+ Info( InfoCapJit, 1, "Apply logic for extracting the empty sublist of a given list" );
+
+ pre_func :=
+ function ( tree, additional_arguments )
+ local args;
+
+ if CapJitIsCallToGlobalFunction( tree, "{}" ) then
+
+ args := tree.args;
+
+ if args.2.type = "EXPR_LIST" and args.2.list.length = 0 and IsBound( args.1.data_type ) then
+
+ return rec( type := "EXPR_LIST", list := AsSyntaxTreeList( [ ] ), data_type := args.1.data_type );
+
+ fi;
+
+ fi;
+
+ return tree;
+
+ end;
+
+ return CapJitIterateOverTree( tree, pre_func, CapJitResultFuncCombineChildren, ReturnTrue, true );
+
+end );
+
+## [ entry1, ... ]{[ ]} => [ ]
+CapJitAddLogicFunction( function ( tree )
+ local pre_func;
+
+ Info( InfoCapJit, 1, "####" );
+ Info( InfoCapJit, 1, "Apply logic for extracting the empty sublist of a given list" );
+
+ pre_func :=
+ function ( tree, additional_arguments )
+ local args, is_big_int, values;
+
+ if CapJitIsCallToGlobalFunction( tree, "{}" ) then
+
+ args := tree.args;
+
+ if args.2.type = "EXPR_LIST" and args.2.list.length = 0 then
+
+ if IsBound( args.1.list ) and IsBound( args.1.list.1 ) then
+
+ if IsBound( args.1.list.1.data_type ) then
+ return rec( type := "EXPR_LIST", list := AsSyntaxTreeList( [ ] ), data_type := args.1.list.1.data_type );
+ elif IsBound( args.1.list.1.funcref ) and IsBound( args.1.list.1.funcref.data_type ) then
+ return rec( type := "EXPR_LIST", list := AsSyntaxTreeList( [ ] ), data_type := args.1.list.1.funcref.data_type.signature[2] );
+ elif IsBound( args.1.list.1.funcref ) and CapJitIsCallToGlobalFunction( args.1.list.1, "Length" ) then
+ return rec( type := "EXPR_LIST", list := AsSyntaxTreeList( [ ] ), data_type := rec( filter := IsInt ) );
+ fi;
+
+ elif CapJitIsCallToGlobalFunction( args.1, "ListWithIdenticalEntries" ) then
+
+ return rec( type := "EXPR_LIST", list := AsSyntaxTreeList( [ ] ), data_type := args.1.args.2.funcref.data_type.signature[2] );
+
+ fi;
+
+ fi;
+
+ fi;
+
+ return tree;
+
+ end;
+
+ return CapJitIterateOverTree( tree, pre_func, CapJitResultFuncCombineChildren, ReturnTrue, true );
+
+end );
+
+## Product( [ ] ) => BigInt( 1 ) and Product( [ ], func ) => BigInt( 1 )
+CapJitAddLogicFunction( function ( tree )
+ local pre_func;
+
+ Info( InfoCapJit, 1, "####" );
+ Info( InfoCapJit, 1, "Apply logic for computing the empty product of an empty list of integers" );
+
+ pre_func :=
+ function ( tree, additional_arguments )
+ local args, is_big_int, values;
+
+ if CapJitIsCallToGlobalFunction( tree, "Product" ) then
+
+ args := tree.args;
+
+ if args.1.type = "EXPR_LIST" and args.1.list.length = 0 and IsBound( args.1.data_type ) then
+
+ return rec( type := "EXPR_FUNCCALL",
+ funcref := rec(
+ gvar := "BigInt",
+ type := "EXPR_REF_GVAR" ),
+ args := rec( 1 := rec( type := "EXPR_INT", value := 1 ), length := 1, type := "SYNTAX_TREE_LIST" ) );
+
+ fi;
+
+ fi;
+
+ return tree;
+
+ end;
+
+ return CapJitIterateOverTree( tree, pre_func, CapJitResultFuncCombineChildren, ReturnTrue, true );
+
+end );
+
## Teach CompilerForCAP about the input type of the function so it can correctly type the function,
## that can be done with the following code (adapted from the existing List type signature):
##
-CapJitAddTypeSignature( "List", [ IsSkeletalFiniteSet, IsFunction ], function ( args, func_stack )
+CapJitAddTypeSignature( "List", [ IsObjectInCategoryOfSkeletalFinSets, IsFunction ], function ( args, func_stack )
args := ShallowCopy( args );
@@ -105,11 +216,20 @@ CapJitAddTypeSignature( "List", [ IsSkeletalFiniteSet, IsFunction ], function (
end );
+##
+CapJitAddLogicTemplate(
+ rec(
+ variable_names := [ "list" ],
+ src_template := "List( list, ID_FUNC )",
+ dst_template := "list",
+ )
+);
+
##
CapJitAddLogicTemplate(
rec(
variable_names := [ "M", "func" ],
- variable_filters := [ IsSkeletalFiniteSet, IsObject ],
+ variable_filters := [ IsObjectInCategoryOfSkeletalFinSets, IsObject ],
src_template := "List( M, func )",
dst_template := "List( [ 0 .. Length( M ) - 1 ], func )",
)
@@ -262,9 +382,10 @@ CapJitAddLogicTemplate(
CapJitAddLogicTemplate(
rec(
- variable_names := [ "list" ],
- src_template := "list{[ ]}",
- dst_template := "[ ]",
+ variable_names := [ "number1", "number2" ],
+ variable_filters := [ IsBigInt, IsBigInt ],
+ src_template := "REM_INT( REM_INT( number1, number2 ), number2 )",
+ dst_template := "REM_INT( number1, number2 )",
)
);
@@ -284,22 +405,6 @@ CapJitAddLogicTemplate(
)
);
-CapJitAddLogicTemplate(
- rec(
- variable_names := [ ],
- src_template := "Product( [ ] )",
- dst_template := "BigInt( 1 )",
- )
-);
-
-CapJitAddLogicTemplate(
- rec(
- variable_names := [ "func" ],
- src_template := "Product( [ ], func )",
- dst_template := "BigInt( 1 )",
- )
-);
-
CapJitAddLogicTemplate(
rec(
variable_names := [ "entry" ],
@@ -340,6 +445,14 @@ CapJitAddLogicTemplate(
)
);
+CapJitAddLogicTemplate(
+ rec(
+ variable_names := [ "entry" ],
+ src_template := "ListWithIdenticalEntries( BigInt( 1 ), entry )",
+ dst_template := "[ entry ]",
+ )
+);
+
CapJitAddLogicTemplate(
rec(
variable_names := [ "length", "constant", "pos" ],
@@ -425,3 +538,56 @@ CapJitAddLogicTemplate(
dst_template := "entry in list",
)
);
+
+CapJitAddLogicTemplate(
+ rec(
+ variable_names := [ "map" ],
+ variable_filters := [ IsMorphismInCategoryOfSkeletalFinSets ],
+ src_template := "List( [ 0 .. Length( Source( map ) ) - 1 ], i -> AsList( map )[1 + i] )",
+ dst_template := "AsList( map )",
+ )
+);
+
+CapJitAddLogicTemplate(
+ rec(
+ variable_names := [ "map" ],
+ variable_filters := [ IsMorphismInCategoryOfSkeletalFinSets ],
+ src_template := "AsList( map ){[ 1 .. Length( Source( map ) ) ]}",
+ dst_template := "AsList( map )",
+ )
+);
+
+CapJitAddLogicTemplate(
+ rec(
+ variable_names := [ "list", "number" ],
+ variable_filters := [ IsList, IsBigInt ],
+ src_template := "List( [ 0 .. number - 1 ], i -> list[1 + i] )",
+ dst_template := "list{[ 1 .. number ]}",
+ )
+);
+
+CapJitAddLogicTemplate(
+ rec(
+ variable_names := [ "length", "offset" ],
+ variable_filters := [ IsBigInt, IsBigInt ],
+ src_template := "List( [ 0 .. length - 1 ], i -> offset + i )",
+ dst_template := "[ offset .. offset + length - 1 ]",
+ )
+);
+
+CapJitAddLogicTemplate(
+ rec(
+ variable_names := [ "length" ],
+ variable_filters := [ IsBigInt ],
+ src_template := "Length( [ 0 .. length - 1 ] )",
+ dst_template := "length",
+ )
+);
+
+CapJitAddLogicTemplate(
+ rec(
+ variable_names := [ "list", "index", "x" ],
+ src_template := "List( list, map -> ( i -> AsList( map )[1 + i] ) )[index]( x )",
+ dst_template := "List( list, AsList )[index][1 + x]",
+ )
+);
diff --git a/gap/Julia.gi b/gap/Julia.gi
index ef267855..8b1e5439 100644
--- a/gap/Julia.gi
+++ b/gap/Julia.gi
@@ -33,7 +33,7 @@ end );
##
InstallMethod( MapOfFinSets,
- [ IsSkeletalFiniteSet, IsJuliaObject, IsSkeletalFiniteSet ],
+ [ IsObjectInCategoryOfSkeletalFinSets, IsJuliaObject, IsObjectInCategoryOfSkeletalFinSets ],
function ( source, graph, range )
diff --git a/gap/SkeletalFinSets.gd b/gap/SkeletalFinSets.gd
index 17fe2819..75a314d8 100644
--- a/gap/SkeletalFinSets.gd
+++ b/gap/SkeletalFinSets.gd
@@ -19,16 +19,37 @@ DeclareCategory( "IsCategoryOfSkeletalFinSets",
#! The GAP category of objects in the category
#! of skeletal finite sets.
#! @Arguments object
-DeclareCategory( "IsSkeletalFiniteSet",
+DeclareCategory( "IsObjectInCategoryOfSkeletalFinSets",
IsCapCategoryObject );
#! @Description
#! The GAP category of morphisms in the category
#! of skeletal finite sets.
#! @Arguments object
-DeclareCategory( "IsSkeletalFiniteSetMap",
+DeclareCategory( "IsMorphismInCategoryOfSkeletalFinSets",
IsCapCategoryMorphism );
+#! @Description
+#! The GAP category of categories
+#! of skeletal finite sets with morphisms given by functions.
+#! @Arguments object
+DeclareCategory( "IsCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions",
+ IsCategoryOfSkeletalFinSets );
+
+#! @Description
+#! The GAP category of objects in the category
+#! of skeletal finite sets with morphisms given by functions.
+#! @Arguments object
+DeclareCategory( "IsObjectInCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions",
+ IsObjectInCategoryOfSkeletalFinSets );
+
+#! @Description
+#! The GAP category of morphisms in the category
+#! of skeletal finite sets with morphisms given by functions.
+#! @Arguments object
+DeclareCategory( "IsMorphismInCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions",
+ IsMorphismInCategoryOfSkeletalFinSets );
+
#! @Section Attributes
#! @Description
@@ -37,9 +58,9 @@ DeclareCategory( "IsSkeletalFiniteSetMap",
#! @Arguments M
#! @Returns an integer
DeclareAttribute( "Length",
- IsSkeletalFiniteSet );
+ IsObjectInCategoryOfSkeletalFinSets );
-CapJitAddTypeSignature( "Length", [ IsSkeletalFiniteSet ], IsBigInt );
+CapJitAddTypeSignature( "Length", [ IsObjectInCategoryOfSkeletalFinSets ], IsBigInt );
#! @Description
#! The list associated to a skeletal finite set, i.e.,
@@ -47,18 +68,28 @@ CapJitAddTypeSignature( "Length", [ IsSkeletalFiniteSet ], IsBigInt );
#! @Arguments M
#! @Returns a list
DeclareAttribute( "AsList",
- IsSkeletalFiniteSet );
+ IsObjectInCategoryOfSkeletalFinSets );
-CapJitAddTypeSignature( "AsList", [ IsSkeletalFiniteSet ], rec( filter := IsList, element_type := rec( filter := IsBigInt ) ) );
+CapJitAddTypeSignature( "AsList", [ IsObjectInCategoryOfSkeletalFinSets ], rec( filter := IsList, element_type := rec( filter := IsBigInt ) ) );
#! @Description
-#! The graph defining the skeletal finite set morphism phi, see .
+#! The function defining the skeletal finite set morphism phi, see .
#! @Arguments phi
-#! @Returns a list
-DeclareAttribute( "AsList",
- IsSkeletalFiniteSetMap );
+#! @Returns a function
+DeclareAttribute( "AsFunc",
+ IsMorphismInCategoryOfSkeletalFinSets );
+
+BindGlobal( "SkeletalFinSets_func_type",
+ rec( filter := IsFunction, signature := [ [ rec( filter := IsBigInt ) ], rec( filter := IsBigInt ) ] ) );
+
+CapJitAddTypeSignature( "AsFunc", [ IsMorphismInCategoryOfSkeletalFinSets ], SkeletalFinSets_func_type );
-CapJitAddTypeSignature( "AsList", [ IsSkeletalFiniteSetMap ], rec( filter := IsList, element_type := rec( filter := IsBigInt ) ) );
+#! @Description
+#! The list of images defining the skeletal finite set morphism phi, see .
+#! @Arguments phi
+#! @Returns a list
+DeclareAttribute( "ListOfImages",
+ IsMorphismInCategoryOfSkeletalFinSets );
#! @Section Constructors
@@ -72,6 +103,16 @@ DeclareOperation( "CategoryOfSkeletalFinSets", [ ] );
#! It is automatically created while loading this package.
DeclareGlobalName( "SkeletalFinSets" );
+#! @Description
+#! Construct a category of skeletal finite sets with maps given by functions.
+#! @Returns a &CAP; category
+DeclareOperation( "CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions", [ ] );
+
+#! @Description
+#! The default instance of the category of skeletal finite sets given by functions.
+#! It is automatically created while loading this package.
+DeclareGlobalName( "SkeletalFinSetsWithMorphismsGivenByFunctions" );
+
#! @Description
#! Construct a skeletal finite set residing in
#! the default instance of the category of skeletal finite sets SkeletalFinSets
@@ -92,13 +133,12 @@ KeyDependentOperation( "FinSet", IsCategoryOfSkeletalFinSets, IsBigInt, ReturnTr
#! @Description
#! Construct a map $\phi:$s$\to$t of the skeletal finite sets s and t,
-#! i.e., a morphism in the &CAP; category of s, where G
-#! is a list of integers in t describing the graph of $\phi$.
-#! @Arguments s, G, t
+#! i.e., a morphism in the &CAP; category of s, where f
+#! is a function with values in t describing the graph of $\phi$.
+#! @Arguments s, f, t
#! @Returns a &CAP; morphism
DeclareOperation( "MapOfFinSets",
- [ IsSkeletalFiniteSet, IsList, IsSkeletalFiniteSet ] );
-#! @InsertChunk SkeletalMapOfFinSets
+ [ IsObjectInCategoryOfSkeletalFinSets, IsFunction, IsObjectInCategoryOfSkeletalFinSets ] );
#! @Section Tools
@@ -107,7 +147,7 @@ DeclareOperation( "MapOfFinSets",
#! @Arguments s, f
#! @Returns a list
DeclareOperation( "ListOp",
- [ IsSkeletalFiniteSet, IsFunction ] );
+ [ IsObjectInCategoryOfSkeletalFinSets, IsFunction ] );
#! @Description
#! Construct the embedding $\iota:$s$\to$t of the finite sets s and t,
@@ -115,34 +155,34 @@ DeclareOperation( "ListOp",
#! @Arguments s, t
#! @Returns a &CAP; morphism
DeclareOperation( "EmbeddingOfFinSets",
- [ IsSkeletalFiniteSet, IsSkeletalFiniteSet ] );
+ [ IsObjectInCategoryOfSkeletalFinSets, IsObjectInCategoryOfSkeletalFinSets ] );
#! @Description
#! Compute the Preimage of t under the morphism phi.
#! @Arguments phi, t
#! @Returns a &CAP; object
DeclareOperation( "Preimage",
- [ IsSkeletalFiniteSetMap, IsList ] );
+ [ IsMorphismInCategoryOfSkeletalFinSets, IsList ] );
#! @Description
#! Compute the image of s_ under the morphism phi.
#! @Arguments phi, s_
#! @Returns a &CAP; object
DeclareOperation( "ImageObject",
- [ IsSkeletalFiniteSetMap, IsSkeletalFiniteSet ] );
+ [ IsMorphismInCategoryOfSkeletalFinSets, IsObjectInCategoryOfSkeletalFinSets ] );
#! @Description
#! Returns the image of L[1] under the map phi assuming L[1] is a nonnegative integer smaller than Length( Source( phi ) ).
#! @Arguments phi, L
#! @Returns a list
# DeclareOperation( "CallFuncList",
-# [ IsSkeletalFiniteSetMap, IsList ] );
+# [ IsMorphismInCategoryOfSkeletalFinSets, IsList ] );
# Technical functions
DeclareGlobalFunction( "INSTALL_FUNCTIONS_FOR_SKELETAL_FIN_SETS" );
DeclareGlobalFunction( "SKELETAL_FIN_SETS_ExplicitCoequalizer" );
-CapJitAddTypeSignature( "SKELETAL_FIN_SETS_ExplicitCoequalizer", [ IsSkeletalFiniteSet, IsList ], rec( filter := IsList, element_type := rec( filter := IsList, element_type := rec( filter := IsBigInt ) ) ) );
+CapJitAddTypeSignature( "SKELETAL_FIN_SETS_ExplicitCoequalizer", [ IsObjectInCategoryOfSkeletalFinSets, IsList ], rec( filter := IsList, element_type := rec( filter := IsList, element_type := rec( filter := IsBigInt ) ) ) );
DeclareGlobalFunction( "SKELETAL_FIN_SETS_IsMonomorphism" );
CapJitAddTypeSignature( "SKELETAL_FIN_SETS_IsMonomorphism", [ IsList, IsBigInt ], IsBool );
diff --git a/gap/SkeletalFinSets.gi b/gap/SkeletalFinSets.gi
index 159bcd51..3fea8774 100644
--- a/gap/SkeletalFinSets.gi
+++ b/gap/SkeletalFinSets.gi
@@ -5,17 +5,21 @@
#
##
-InstallMethod( CategoryOfSkeletalFinSets,
- [ ],
-
+InstallMethod( CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions,
+ "for no input",
+ [ ],
+
function ( )
local cat;
- cat := CreateCapCategoryWithDataTypes(
- "SkeletalFinSets", IsCategoryOfSkeletalFinSets,
- IsSkeletalFiniteSet, IsSkeletalFiniteSetMap, IsCapCategoryTwoCell,
- IsBigInt, rec( filter := IsList, element_type := rec( filter := IsBigInt ) ), fail
- );
+ cat := CreateCapCategoryWithDataTypes( "SkeletalFinSets",
+ IsCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions,
+ IsObjectInCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions,
+ IsMorphismInCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions,
+ IsCapCategoryTwoCell,
+ IsBigInt,
+ SkeletalFinSets_func_type,
+ fail );
cat!.category_as_first_argument := true;
@@ -40,7 +44,7 @@ InstallMethod( CategoryOfSkeletalFinSets,
if ValueOption( "no_precompiled_code" ) <> true then
- ADD_FUNCTIONS_FOR_CategoryOfSkeletalFinSetsWithMorphismsGivenByListsPrecompiled( cat );
+ ADD_FUNCTIONS_FOR_CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctionsPrecompiled( cat );
fi;
@@ -51,7 +55,7 @@ InstallMethod( CategoryOfSkeletalFinSets,
end );
##
-InstallMethodForCompilerForCAP( FinSetOp,
+InstallMethod( FinSetOp,
[ IsCategoryOfSkeletalFinSets, IsBigInt ],
function ( cat, n )
@@ -63,7 +67,7 @@ end );
##
InstallMethod( AsList,
"for a CAP skeletal finite set",
- [ IsSkeletalFiniteSet ],
+ [ IsObjectInCategoryOfSkeletalFinSets ],
function ( s )
@@ -74,7 +78,7 @@ end );
##
InstallMethod( ListOp,
"for a CAP skeletal finite set and a function",
- [ IsSkeletalFiniteSet, IsFunction ],
+ [ IsObjectInCategoryOfSkeletalFinSets, IsFunction ],
function ( s, f )
@@ -84,32 +88,66 @@ end );
## Morphisms
+##
+InstallOtherMethodForCompilerForCAP( ListOfImages,
+ "for a category of skeletal finite sets and a CAP map of skeletal finite sets",
+ [ IsCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions, IsMorphismInCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions ],
+
+ function ( cat, map )
+
+ return List( [ 0 .. Length( Source( map ) ) - 1 ], AsFunc( map ) );
+
+end );
+
+##
+InstallMethod( AsList,
+ "for a CAP map of skeletal finite sets",
+ [ IsMorphismInCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions ],
+
+ function ( map )
+ local L;
+
+ L := ListOfImages( CapCategory( map ), map );
+
+ if Length( L ) > 1 and First( L ) + 1 = L[2] and First( L ) < Last( L ) then
+ ConvertToRangeRep( L );
+ fi;
+
+ return L;
+
+end );
+
##
InstallMethod( MapOfFinSets,
- "for two CAP skeletal finite sets and a list",
- [ IsSkeletalFiniteSet, IsList, IsSkeletalFiniteSet ],
+ "for two CAP skeletal finite sets and a function",
+ [ IsObjectInCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions, IsFunction, IsObjectInCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions ],
- function ( s, G, t )
+ function ( s, f, t )
- return MapOfFinSets( CapCategory( s ), s, G, t );
+ return MorphismConstructor( CapCategory( s ), s, f, t );
end );
##
-InstallOtherMethodForCompilerForCAP( MapOfFinSets,
- "for a category of skeletal finite sets, two CAP skeletal finite sets and a list",
- [ IsCategoryOfSkeletalFinSets, IsSkeletalFiniteSet, IsList, IsSkeletalFiniteSet ],
+InstallOtherMethod( MapOfFinSets,
+ "for two CAP skeletal finite sets and a list",
+ [ IsObjectInCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions, IsList, IsObjectInCategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions ],
- function ( cat, s, G, t )
+ function ( s, G, t )
+ local f;
+
+ f := CapJitTypedExpression(
+ i -> G[1 + i],
+ cat -> SkeletalFinSets_func_type );
- return MorphismConstructor( cat, s, G, t );
+ return MapOfFinSets( s, f, t );
end );
##
InstallMethod( EmbeddingOfFinSets,
"for two CAP skeletal finite sets",
- [ IsSkeletalFiniteSet, IsSkeletalFiniteSet ],
+ [ IsObjectInCategoryOfSkeletalFinSets, IsObjectInCategoryOfSkeletalFinSets ],
function ( s, t )
local iota;
@@ -126,23 +164,23 @@ end );
##
InstallMethod( Preimage,
"for a CAP map of skeletal finite sets and a CAP skeletal finite set",
- [ IsSkeletalFiniteSetMap, IsList ],
+ [ IsMorphismInCategoryOfSkeletalFinSets, IsList ],
function ( phi, t )
- local S;
+ local S, f;
S := AsList( Source( phi ) );
- phi := AsList( phi );
+ f := AsFunc( phi );
- return Filtered( S, i -> phi[1 + i] in t );
+ return Filtered( S, i -> f( i ) in t );
end );
##
InstallMethod( ImageObject,
"for a CAP map of skeletal finite sets and a CAP skeletal finite set",
- [ IsSkeletalFiniteSetMap, IsSkeletalFiniteSet ],
+ [ IsMorphismInCategoryOfSkeletalFinSets, IsObjectInCategoryOfSkeletalFinSets ],
function ( phi, s_ )
return ImageObject( PreCompose( EmbeddingOfFinSets( s_, Source( phi ) ), phi ) );
@@ -152,14 +190,14 @@ end );
##
InstallMethod( CallFuncList,
"for a CAP map of skeletal finite sets and a list",
- [ IsSkeletalFiniteSetMap, IsList ],
+ [ IsMorphismInCategoryOfSkeletalFinSets, IsList ],
function ( phi, L )
local x;
x := L[1];
- return AsList( phi )[1 + x];
+ return AsFunc( phi )( x );
end );
@@ -264,13 +302,13 @@ end );
##
AddMorphismConstructor( SkeletalFinSets,
- function ( cat, source, images, range )
+ function ( cat, source, func, range )
local map;
map := CreateCapCategoryMorphismWithAttributes( cat,
- source,
- range,
- AsList, images );
+ source,
+ range,
+ AsFunc, func );
#% CAP_JIT_DROP_NEXT_STATEMENT
Assert( 4, IsWellDefined( map ) );
@@ -283,7 +321,7 @@ end );
AddMorphismDatum( SkeletalFinSets,
function ( cat, map )
- return AsList( map );
+ return AsFunc( map );
end );
@@ -302,20 +340,22 @@ end );
##
AddIsWellDefinedForMorphisms( SkeletalFinSets,
function ( cat, mor )
- local s, rel, t;
+ local s, f, t;
s := Length( Source( mor ) );
- rel := AsList( mor );
+ f := AsFunc( mor );
t := Length( Range( mor ) );
## For CompilerForCAP we need if-elif-else with the same structure
- if not ForAll( rel, a -> IsBigInt( a ) and a >= 0 ) then
- return false;
- elif s <> Length( rel ) then
- return false;
- elif not ForAll( rel, a -> a < t ) then
+ if not ForAll( [ 0 .. s - 1 ],
+ function( x )
+ local fx;
+ fx := f( x );
+ return IsBigInt( fx ) and fx >= 0 and fx < t;
+ end ) then
+
return false;
else
return true;
@@ -326,8 +366,12 @@ end );
##
AddIsEqualForMorphisms( SkeletalFinSets,
function ( cat, mor1, mor2 )
+ local f1, f2;
+
+ f1 := AsFunc( mor1 );
+ f2 := AsFunc( mor2 );
- return AsList( mor1 ) = AsList( mor2 );
+ return ForAll( [ 0 .. Length( Source( mor1 ) ) - 1 ], x -> f1( x ) = f2( x ) );
end );
@@ -342,25 +386,32 @@ end );
##
AddIdentityMorphism( SkeletalFinSets,
function ( cat, n )
+ local f;
- return MapOfFinSets( cat, n, [ 0 .. Length( n ) - 1 ], n );
+ f := CapJitTypedExpression(
+ IdFunc,
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, n, f, n );
end );
##
AddPreCompose( SkeletalFinSets,
function ( cat, map_pre, map_post )
- local s, t, im_pre, im_post, cmp;
+ local s, t, pre, post, pre_post;
s := Source( map_pre );
t := Range( map_post );
- im_pre := AsList( map_pre );
- im_post := AsList( map_post );
+ pre := AsFunc( map_pre );
+ post := AsFunc( map_post );
- cmp := List( s, i -> im_post[1 + im_pre[1 + i]] );
+ pre_post := CapJitTypedExpression(
+ i -> post( pre( i ) ),
+ cat -> SkeletalFinSets_func_type );
- return MapOfFinSets( cat, s, cmp, t );
+ return MorphismConstructor( cat, s, pre_post, t );
end );
@@ -368,7 +419,7 @@ end );
AddImageObject( SkeletalFinSets,
function ( cat, phi )
- return FinSet( cat, BigInt( Length( Set( AsList( phi ) ) ) ) );
+ return ObjectConstructor( cat, BigInt( Length( Set( ListOfImages( cat, phi ) ) ) ) );
end );
@@ -378,7 +429,7 @@ AddIsEpimorphism( SkeletalFinSets,
function ( cat, phi )
local imgs, t;
- imgs := AsList( phi );
+ imgs := ListOfImages( cat, phi );
t := Length( Range( phi ) );
@@ -399,7 +450,7 @@ AddIsMonomorphism( SkeletalFinSets,
function ( cat, phi )
local imgs, t;
- imgs := AsList( phi );
+ imgs := ListOfImages( cat, phi );
t := Length( Range( phi ) );
@@ -422,8 +473,8 @@ AddIsLiftable( SkeletalFinSets,
function ( cat, f, g )
local ff, gg, fff;
- ff := AsList( f );
- gg := AsList( g );
+ ff := ListOfImages( cat, f );
+ gg := ListOfImages( cat, g );
if 100 * Length( ff ) < Length( gg ) then
fff := Set( ff );
@@ -438,15 +489,19 @@ end );
##
AddLift( SkeletalFinSets,
function ( cat, f, g )
- local S, T, gg, ff;
+ local S, T, gg, ff, chi;
S := Source( f );
T := Source( g );
- gg := AsList( g );
- ff := AsList( f );
+ gg := ListOfImages( cat, g );
+ ff := AsFunc( f );
+
+ chi := CapJitTypedExpression(
+ x -> -1 + BigInt( SafePosition( gg, ff( x ) ) ),
+ cat -> SkeletalFinSets_func_type );
- return MapOfFinSets( cat, S, List( S, x -> -1 + BigInt( SafePosition( gg, ff[1 + x] ) ) ), T );
+ return MorphismConstructor( cat, S, chi, T );
end );
@@ -456,8 +511,8 @@ AddIsColiftable( SkeletalFinSets,
function ( cat, f, g )
local ff, gg;
- ff := AsList( f );
- gg := AsList( g );
+ ff := ListOfImages( cat, f );
+ gg := ListOfImages( cat, g );
return ForAll( Set( ff ), i -> Length( Set( gg{Positions( ff, i )} ) ) = 1 );
@@ -466,15 +521,15 @@ end );
##
AddColift( SkeletalFinSets,
function ( cat, f, g )
- local S, T, ff, gg, chi;
+ local S, T, ff, gg, c, chi;
S := Range( f );
T := Range( g );
- ff := AsList( f );
- gg := AsList( g );
+ ff := ListOfImages( cat, f );
+ gg := ListOfImages( cat, g );
- chi :=
+ c :=
function ( y )
if not y in ff then
return BigInt( 0 );
@@ -482,32 +537,45 @@ AddColift( SkeletalFinSets,
return gg[SafePosition( ff, y )];
end;
- return MapOfFinSets( cat, S, List( S, y -> chi(y) ), T );
+ chi := CapJitTypedExpression(
+ c,
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, S, chi, T );
end );
##
AddImageEmbeddingWithGivenImageObject( SkeletalFinSets,
function ( cat, phi, image )
+ local images, f;
+
+ images := Set( ListOfImages( cat, phi ) );
+
+ f := CapJitTypedExpression(
+ i -> images[1 + i],
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, image, f, Range( phi ) );
- return MapOfFinSets( cat, image, Set( AsList( phi ) ), Range( phi ) );
-
end );
##
AddCoastrictionToImageWithGivenImageObject( SkeletalFinSets,
function ( cat, phi, image_object )
- local G, images, s, L, l, pi;
+ local G, images, s, f, l, pi;
- G := AsList( phi );
+ G := ListOfImages( cat, phi );
images := Set( G );
s := Source( phi );
- L := List( s, i -> -1 + BigInt( SafePosition( images, G[1 + i] ) ) );
+ f := CapJitTypedExpression(
+ i -> -1 + BigInt( SafePosition( images, G[1 + i] ) ),
+ cat -> SkeletalFinSets_func_type );
- pi := MapOfFinSets( cat, s, L, image_object );
+ pi := MorphismConstructor( cat, s, f, image_object );
#% CAP_JIT_DROP_NEXT_STATEMENT
Assert( 3, IsEpimorphism( cat, pi ) );
@@ -531,15 +599,22 @@ end );
AddTerminalObject( SkeletalFinSets,
function ( cat )
- return FinSet( cat, BigInt( 1 ) );
+ return ObjectConstructor( cat, BigInt( 1 ) );
end );
##
AddUniversalMorphismIntoTerminalObjectWithGivenTerminalObject( SkeletalFinSets,
function ( cat, m, t )
+ local zero, f;
- return MapOfFinSets( cat, m, ListWithIdenticalEntries( Length( m ), BigInt( 0 ) ), t );
+ zero := BigInt( 0 );
+
+ f := CapJitTypedExpression(
+ i -> zero,
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, m, f, t );
end );
@@ -547,14 +622,14 @@ end );
AddDirectProduct( SkeletalFinSets,
function ( cat, L )
- return FinSet( cat, Product( List( L, Length ) ) );
+ return ObjectConstructor( cat, Product( List( L, Length ) ) );
end );
##
AddProjectionInFactorOfDirectProductWithGivenDirectProduct( SkeletalFinSets,
function ( cat, D, k, P )
- local T, l, a;
+ local T, l, a, f;
T := D[k];
@@ -562,14 +637,18 @@ AddProjectionInFactorOfDirectProductWithGivenDirectProduct( SkeletalFinSets,
a := Product( List( D{[ 1 .. k - 1 ]}, Length ) );
- return MapOfFinSets( cat, P, List( P, i -> RemInt( QuoInt( i, a ), l ) ), T );
+ f := CapJitTypedExpression(
+ i -> RemInt( QuoInt( i, a ), l ),
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, P, f, T );
end );
##
AddUniversalMorphismIntoDirectProductWithGivenDirectProduct( SkeletalFinSets,
function ( cat, D, T, tau, P )
- local l, d, dd, taus;
+ local l, d, dd, taus, f;
l := Length( D );
@@ -577,51 +656,63 @@ AddUniversalMorphismIntoDirectProductWithGivenDirectProduct( SkeletalFinSets,
dd := List( [ 0 .. l - 1 ], j -> Product( d{[ 1 .. j ]} ) );
- taus := List( tau, AsList );
+ taus := List( tau, AsFunc );
+
+ f := CapJitTypedExpression(
+ # if l = 0, then Sum( [ 0 .. l - 1 ], j -> ... ) = 0 ∈ TerminalObject = P
+ i -> Sum( [ 0 .. l - 1 ], j -> dd[1 + j] * taus[1 + j]( i ) ),
+ cat -> SkeletalFinSets_func_type );
- # if l = 0, then Sum( [ 0 .. l - 1 ], j -> ... ) = 0 ∈ TerminalObject = P
- return MapOfFinSets( cat, T, List( T, i -> Sum( [ 0 .. l - 1 ], j -> taus[1 + j][1 + i] * dd[1 + j] ) ), P );
+ return MorphismConstructor( cat, T, f, P );
end );
##
AddEqualizer( SkeletalFinSets,
function ( cat, s, D )
- local D2, Eq;
+ local funcs, Eq;
- D2 := List( D, AsList );
+ funcs := List( D, AsFunc );
- Eq := Filtered( [ 0 .. Length( s ) - 1 ], x -> ForAll( [ 1 .. Length( D ) - 1 ], j -> D2[j][1 + x] = D2[j + 1][1 + x] ) );
+ Eq := Filtered( [ 0 .. Length( s ) - 1 ], i -> ForAll( [ 1 .. Length( D ) - 1 ], j -> funcs[j]( i ) = funcs[j + 1]( i ) ) );
- return FinSet( cat, Length( Eq ) );
+ return ObjectConstructor( cat, Length( Eq ) );
end );
##
AddEmbeddingOfEqualizerWithGivenEqualizer( SkeletalFinSets,
function ( cat, s, D, E )
- local D2, Eq;
+ local funcs, Eq, f;
- D2 := List( D, AsList );
+ funcs := List( D, AsFunc );
- Eq := Filtered( [ 0 .. Length( s ) - 1 ], x -> ForAll( [ 1 .. Length( D ) - 1 ], j -> D2[j][1 + x] = D2[j + 1][1 + x] ) );
+ Eq := Filtered( [ 0 .. Length( s ) - 1 ], x -> ForAll( [ 1 .. Length( D ) - 1 ], j -> funcs[j]( x ) = funcs[j + 1]( x ) ) );
- return MapOfFinSets( cat, E, Eq, s );
+ f := CapJitTypedExpression(
+ i -> Eq[1 + i],
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, E, f, s );
end );
##
AddUniversalMorphismIntoEqualizerWithGivenEqualizer( SkeletalFinSets,
function ( cat, s, D, test_object, tau, E )
- local D2, Eq, t;
+ local funcs, Eq, t, f;
+
+ funcs := List( D, AsFunc );
- D2 := List( D, AsList );
+ Eq := Filtered( [ 0 .. Length( s ) - 1 ], x -> ForAll( [ 1 .. Length( D ) - 1 ], j -> funcs[j]( x ) = funcs[j + 1]( x ) ) );
- Eq := Filtered( [ 0 .. Length( s ) - 1 ], x -> ForAll( [ 1 .. Length( D ) - 1 ], j -> D2[j][1 + x] = D2[j + 1][1 + x] ) );
+ t := AsFunc( tau );
- t := AsList( tau );
+ f := CapJitTypedExpression(
+ x -> -1 + BigInt( SafePosition( Eq, t( x ) ) ),
+ cat -> SkeletalFinSets_func_type );
- return MapOfFinSets( cat, test_object, List( test_object, x -> -1 + BigInt( SafePosition( Eq, t[1 + x] ) ) ), E );
+ return MorphismConstructor( cat, test_object, f, E );
end );
@@ -640,15 +731,20 @@ end );
AddInitialObject( SkeletalFinSets,
function ( cat )
- return FinSet( cat, BigInt( 0 ) );
+ return ObjectConstructor( cat, BigInt( 0 ) );
end );
##
AddUniversalMorphismFromInitialObjectWithGivenInitialObject( SkeletalFinSets,
function ( cat, m, I )
+ local f;
+
+ f := CapJitTypedExpression(
+ IdFunc,
+ cat -> SkeletalFinSets_func_type );
- return MapOfFinSets( cat, I, [ ], m );
+ return MorphismConstructor( cat, I, f, m );
end );
@@ -691,8 +787,13 @@ end );
##
AddMonomorphismIntoSomeInjectiveObjectWithGivenSomeInjectiveObject( SkeletalFinSets,
function ( cat, M, injective_object )
+ local f;
- return MapOfFinSets( cat, M, [ 0 .. Length( M ) - 1 ], injective_object );
+ f := CapJitTypedExpression(
+ IdFunc,
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, M, f, injective_object );
end );
@@ -700,14 +801,14 @@ end );
AddCoproduct( SkeletalFinSets,
function ( cat, L )
- return FinSet( cat, Sum( List( L, Length ) ) );
+ return ObjectConstructor( cat, Sum( List( L, Length ) ) );
end );
##
AddInjectionOfCofactorOfCoproductWithGivenCoproduct( SkeletalFinSets,
function ( cat, L, i, coproduct )
- local O, sum, s;
+ local O, sum, s, f;
O := L{[ 1 .. i - 1 ]};
@@ -715,18 +816,41 @@ AddInjectionOfCofactorOfCoproductWithGivenCoproduct( SkeletalFinSets,
s := L[i];
- return MapOfFinSets( cat, s, [ sum .. sum + Length( s ) - 1 ], coproduct );
+ f := CapJitTypedExpression(
+ i -> sum + i,
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, s, f, coproduct );
end );
##
AddUniversalMorphismFromCoproductWithGivenCoproduct( SkeletalFinSets,
function ( cat, L, test_object, tau, S )
- local concat;
+ local sources, sums, funcs, interval, c, f;
- concat := Concatenation( List( tau, AsList ) );
+ sources := List( tau, map -> Length( Source( map ) ) );
+
+ ## FIXME: make a functional loop if possible
+ sums := List( [ 0 .. Length( tau ) ], k -> Sum( sources{[ 1 .. k ]} ) );
+
+ funcs := List( tau, AsFunc );
+
+ interval := [ 1 .. Length( tau ) ];
+
+ c :=
+ function( i )
+ local p;
+ ## FIXME: PositionSorted
+ p := SafePositionProperty( interval, k -> i < sums[k + 1] );
+ return funcs[p]( i - sums[p] );
+ end;
- return MapOfFinSets( cat, S, concat, test_object );
+ f := CapJitTypedExpression(
+ c,
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, S, f, test_object );
end );
@@ -734,31 +858,39 @@ end );
AddCoequalizer( SkeletalFinSets,
function ( cat, s, D )
- return FinSet( cat, BigInt( Length( SKELETAL_FIN_SETS_ExplicitCoequalizer( s, D ) ) ) );
+ return ObjectConstructor( cat, BigInt( Length( SKELETAL_FIN_SETS_ExplicitCoequalizer( s, D ) ) ) );
end );
##
AddProjectionOntoCoequalizerWithGivenCoequalizer( SkeletalFinSets,
function ( cat, s, D, C )
- local Cq, cmp;
+ local Cq, f;
Cq := SKELETAL_FIN_SETS_ExplicitCoequalizer( s, D );
- cmp := List( s, x -> -1 + BigInt( SafeUniquePositionProperty( Cq, c -> x in c ) ) );
+ f := CapJitTypedExpression(
+ i -> -1 + BigInt( SafeUniquePositionProperty( Cq, c -> i in c ) ),
+ cat -> SkeletalFinSets_func_type );
- return MapOfFinSets( cat, s, cmp, C );
+ return MorphismConstructor( cat, s, f, C );
end );
##
AddUniversalMorphismFromCoequalizerWithGivenCoequalizer( SkeletalFinSets,
function ( cat, s, D, test_object, tau, C )
- local Cq;
+ local Cq, func, f;
Cq := SKELETAL_FIN_SETS_ExplicitCoequalizer( s, D );
- return MapOfFinSets( cat, C, List( Cq, x -> tau( x[1] ) ), Range( tau ) );
+ func := AsFunc( tau );
+
+ f := CapJitTypedExpression(
+ i -> func( Cq[1 + i][1] ),
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, C, f, Range( tau ) );
end );
@@ -799,13 +931,17 @@ end );
##
AddCartesianBraidingInverseWithGivenDirectProducts( SkeletalFinSets,
function ( cat, MN, M, N, NM )
- local m, n;
+ local m, n, f;
m := Length( M );
n := Length( N );
- return MapOfFinSets( cat, MN, List( MN , i -> RemInt( i, n ) * m + QuoInt( i, n ) ), NM );
+ f := CapJitTypedExpression(
+ i -> RemInt( i, n ) * m + QuoInt( i, n ),
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, MN, f, NM );
end );
@@ -817,42 +953,47 @@ AddExponentialOnObjects( SkeletalFinSets,
m := Length( M );
n := Length( N );
- return FinSet( cat, n ^ m );
+ return ObjectConstructor( cat, n ^ m );
end );
## InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism
AddCartesianLambdaElimination( SkeletalFinSets,
function ( cat, M, N, intro )
- local m, n, v;
+ local m, n, v, f;
m := Length( M );
n := Length( N );
- v := AsList( intro )[1];
+ v := AsFunc( intro )( 0 );
+
+ f := CapJitTypedExpression(
+ i -> RemInt( QuoInt( v, n^i ), n ),
+ cat -> SkeletalFinSets_func_type );
- return MapOfFinSets( cat,
- M,
- List( [ 0 .. m - 1 ], i -> RemInt( QuoInt( v, n^i ), n ) ),
- N );
+ return MorphismConstructor( cat, M, f, N );
end );
## InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure
AddCartesianLambdaIntroduction( SkeletalFinSets,
function ( cat, map )
- local M, m, N, n, images;
+ local M, m, N, n, func, f;
M := Source( map );
m := Length( M );
N := Range( map );
n := Length( N );
- images := AsList( map );
+ func := AsFunc( map );
- return MapOfFinSets( cat,
+ f := CapJitTypedExpression(
+ i -> Sum( List( [ 0 .. m - 1 ], k -> func( k ) * n^k ) ),
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat,
TerminalObject( cat ),
- [ Sum( List( [ 0 .. m - 1 ], k -> images[1 + k] * n^k ) ) ],
+ f,
ExponentialOnObjects( cat, M, N ) );
end );
@@ -864,38 +1005,49 @@ AddExactCoverWithGlobalElements( SkeletalFinSets,
T := TerminalObject( cat );
- return List( [ 0 .. Length( A ) - 1 ], i -> MapOfFinSets( cat, T, [ i ], A ) );
+ return List( [ 0 .. Length( A ) - 1 ], j ->
+ MorphismConstructor( cat,
+ T,
+ CapJitTypedExpression(
+ i -> j,
+ cat -> SkeletalFinSets_func_type ),
+ A ) );
end );
##
AddExponentialOnMorphismsWithGivenExponentials( SkeletalFinSets,
function ( cat, S, alpha, beta, T )
- local M, N, MN, mors;
+ local M, N, D, MN, f;
M := Range( alpha );
N := Source( beta );
+ D := TerminalObject( cat );
+
MN := ExponentialOnObjects( cat, M, N );
-
- mors := ExactCoverWithGlobalElements( cat, MN );
-
- return MapOfFinSets( cat,
- S,
- List( mors, mor ->
- AsList( CartesianLambdaIntroduction( cat,
- PreComposeList(
- cat,
- [ alpha,
- CartesianLambdaElimination( cat,
- M,
- N,
- mor ),
- beta ] ) ) )[1 + 0] ),
- T );
-end, 1 + Sum( [ [ "ExponentialOnObjects", 1 ],
- [ "ExactCoverWithGlobalElements", 1 ],
+ f := CapJitTypedExpression(
+ i -> AsFunc( CartesianLambdaIntroduction( cat,
+ PreComposeList(
+ cat,
+ [ alpha,
+ CartesianLambdaElimination( cat,
+ M,
+ N,
+ MorphismConstructor( cat,
+ D,
+ CapJitTypedExpression(
+ j -> i,
+ cat -> SkeletalFinSets_func_type ),
+ MN ) ),
+ beta ] ) ) )( 0 ),
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, S, f, T );
+
+end, 1 + Sum( [ [ "TerminalObject", 1 ],
+ [ "ExponentialOnObjects", 1 ],
[ "PreComposeList", 2 ],
[ "CartesianLambdaElimination", 2 ],
[ "CartesianLambdaIntroduction", 2 ] ],
@@ -904,30 +1056,40 @@ end, 1 + Sum( [ [ "ExponentialOnObjects", 1 ],
##
AddCartesianEvaluationMorphismWithGivenSource( SkeletalFinSets,
function ( cat, M, N, HM_NxM )
- local m, n, exp;
+ local m, n, exp, f;
m := Length( M );
n := Length( N );
exp := n ^ m;
- return MapOfFinSets( cat, HM_NxM, List( [ 0 .. ( n^m * m ) - 1 ], i -> RemInt( QuoInt( i, n^QuoInt( i, exp ) ), n ) ), N );
+ f := CapJitTypedExpression(
+ i -> RemInt( QuoInt( i, n^QuoInt( i, exp ) ), n ),
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, HM_NxM, f, N );
end );
##
AddCartesianCoevaluationMorphismWithGivenRange( SkeletalFinSets,
function ( cat, M, N, HN_MxN )
- local m, n, mn;
+ local m, n, mn, f;
m := Length( M );
n := Length( N );
mn := m * n;
- #return MapOfFinSets( cat, M, List( [ 0 .. m - 1 ], i -> Sum( [ 0 .. n - 1 ], j -> ( i + m * j ) * (m*n)^j ) ), HN_MxN );
+ #f := CapJitTypedExpression(
+ # i -> Sum( [ 0 .. n - 1 ], j -> ( i + m * j ) * (m*n)^j ),
+ # cat -> SkeletalFinSets_func_type );
+
+ f := CapJitTypedExpression(
+ i -> i * GeometricSum( mn, n ) + m * mn * GeometricSumDiff1( mn, n ),
+ cat -> SkeletalFinSets_func_type );
- return MapOfFinSets( cat, M, List( [ 0 .. m - 1 ], i -> i * GeometricSum( mn, n ) + m * mn * GeometricSumDiff1( mn, n ) ), HN_MxN );
+ return MorphismConstructor( cat, M, f, HN_MxN );
end );
@@ -935,32 +1097,35 @@ end );
AddSubobjectClassifier( SkeletalFinSets,
function ( cat )
- return FinSet( cat, BigInt( 2 ) );
+ return ObjectConstructor( cat, BigInt( 2 ) );
end );
##
AddClassifyingMorphismOfSubobjectWithGivenSubobjectClassifier( SkeletalFinSets,
function ( cat, monomorphism, Omega )
- local range, images, chi;
+ local range, images, c, chi;
range := Range( monomorphism );
- images := AsList( monomorphism );
-
- chi := List( range,
- function ( x )
-
- if x in images then
- return BigInt( 1 );
- fi;
-
- return BigInt( 0 );
-
- end );
-
- return MapOfFinSets( cat, range, chi, Omega );
-
+ images := ListOfImages( cat, monomorphism );
+
+ c :=
+ function ( x )
+ if x in images then
+ return BigInt( 1 );
+ fi;
+
+ return BigInt( 0 );
+
+ end;
+
+ chi := CapJitTypedExpression(
+ c,
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( cat, range, chi, Omega );
+
end );
##
@@ -988,7 +1153,7 @@ end );
##
InstallMethod( String,
"for a CAP skeletal finite set",
- [ IsSkeletalFiniteSet ],
+ [ IsObjectInCategoryOfSkeletalFinSets ],
function ( s )
return Concatenation( "FinSet( SkeletalFinSets, ", String( Length( s ) ), " )" );
@@ -997,7 +1162,7 @@ end );
##
InstallMethod( String,
"for a CAP map of skeletal finite sets",
- [ IsSkeletalFiniteSetMap ],
+ [ IsMorphismInCategoryOfSkeletalFinSets ],
function ( phi )
return Concatenation( "MapOfFinSets( SkeletalFinSets, ", String( Source( phi ) ), ", ", String( AsList( phi ) ), ", ", String( Range( phi ) ), " )" );
@@ -1006,7 +1171,7 @@ end );
##
InstallMethod( ViewString,
"for a CAP skeletal finite set",
- [ IsSkeletalFiniteSet ],
+ [ IsObjectInCategoryOfSkeletalFinSets ],
function ( s )
return Concatenation( "|", String( Length( s ) ), "|" );
@@ -1015,7 +1180,7 @@ end );
##
InstallMethod( ViewString,
"for a CAP map of skeletal finite sets",
- [ IsSkeletalFiniteSetMap ],
+ [ IsMorphismInCategoryOfSkeletalFinSets ],
function ( phi )
local arrow;
@@ -1049,7 +1214,7 @@ end );
##
InstallMethod( PrintString,
"for a CAP skeletal finite set",
- [ IsSkeletalFiniteSet ],
+ [ IsObjectInCategoryOfSkeletalFinSets ],
function ( s )
local l, string;
@@ -1073,7 +1238,7 @@ end );
##
InstallMethod( PrintString,
"for a CAP map of skeletal finite sets",
- [ IsSkeletalFiniteSetMap ],
+ [ IsMorphismInCategoryOfSkeletalFinSets ],
function ( phi )
@@ -1087,7 +1252,7 @@ end );
##
InstallMethod( DisplayString,
"for a CAP skeletal finite set",
- [ IsSkeletalFiniteSet ],
+ [ IsObjectInCategoryOfSkeletalFinSets ],
function ( s )
@@ -1098,21 +1263,10 @@ end );
##
InstallMethod( DisplayString,
"for a CAP map of skeletal finite sets",
- [ IsSkeletalFiniteSetMap ],
+ [ IsMorphismInCategoryOfSkeletalFinSets ],
function ( phi )
return Concatenation( PrintString( phi ), "\n" );
end );
-
-##
-InstallOtherMethod( FinSet,
- "for a nonnegative integer",
- [ IsBigInt ],
-
- function ( n )
-
- return FinSet( SkeletalFinSets, n );
-
-end );
diff --git a/gap/SkeletalFinSetsEager.gd b/gap/SkeletalFinSetsEager.gd
new file mode 100644
index 00000000..785d3e31
--- /dev/null
+++ b/gap/SkeletalFinSetsEager.gd
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# FinSetsForCAP: The elementary topos of (skeletal) finite sets
+#
+# Declarations
+#
+
+#! @Chapter The category of skeletal finite sets with morphisms given by lists
+
+#! @Section GAP Categories
+
+#! @Description
+#! The GAP category of categories
+#! of skeletal finite sets with morphisms given by lists.
+#! @Arguments object
+DeclareCategory( "IsCategoryOfSkeletalFinSetsWithMorphismsGivenByLists",
+ IsCategoryOfSkeletalFinSets );
+
+#! @Description
+#! The GAP category of objects in the category
+#! of skeletal finite sets with morphisms given by lists.
+#! @Arguments object
+DeclareCategory( "IsObjectInCategoryOfSkeletalFinSetsWithMorphismsGivenByLists",
+ IsObjectInCategoryOfSkeletalFinSets );
+
+#! @Description
+#! The GAP category of morphisms in the category
+#! of skeletal finite sets with morphisms given by lists.
+#! @Arguments object
+DeclareCategory( "IsMorphismInCategoryOfSkeletalFinSetsWithMorphismsGivenByLists",
+ IsMorphismInCategoryOfSkeletalFinSets );
+
+#! @Section Attributes
+
+#! @Description
+#! The list of images defining the skeletal finite set morphism phi, see .
+#! @Arguments phi
+#! @Returns a list
+DeclareAttribute( "AsList",
+ IsMorphismInCategoryOfSkeletalFinSets );
+
+CapJitAddTypeSignature( "AsList", [ IsMorphismInCategoryOfSkeletalFinSetsWithMorphismsGivenByLists ],
+ rec( filter := IsList, element_type := rec( filter := IsBigInt ) ) );
+
+#! @Section Constructors
+
+#! @Description
+#! Construct a category of skeletal finite sets with maps given by lists.
+#! @Returns a &CAP; category
+DeclareOperation( "CategoryOfSkeletalFinSetsWithMorphismsGivenByLists", [ ] );
+
+#! @Description
+#! The default instance of the category of skeletal finite sets given by lists.
+#! It is automatically created while loading this package.
+DeclareGlobalName( "SkeletalFinSetsWithMorphismsGivenByLists" );
+
+#! @Description
+#! Construct a map $\phi:$s$\to$t of the skeletal finite sets s and t,
+#! i.e., a morphism in the &CAP; category of s, where list_of_images
+#! is a list of integers in t describing the images of $\phi$.
+#! @Arguments s, list_of_images, t
+#! @Returns a &CAP; morphism
+DeclareOperation( "MapOfFinSets",
+ [ IsObjectInCategoryOfSkeletalFinSets, IsList, IsObjectInCategoryOfSkeletalFinSets ] );
+#! @InsertChunk SkeletalMapOfFinSets
diff --git a/gap/SkeletalFinSetsEager.gi b/gap/SkeletalFinSetsEager.gi
new file mode 100644
index 00000000..4427ab63
--- /dev/null
+++ b/gap/SkeletalFinSetsEager.gi
@@ -0,0 +1,282 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# FinSetsForCAP: The elementary topos of (skeletal) finite sets
+#
+# Implementations
+#
+
+##
+InstallMethod( CategoryOfSkeletalFinSetsWithMorphismsGivenByLists,
+ "for no input",
+ [ ],
+
+ function ( )
+ local object_constructor, object_datum,
+ morphism_constructor, morphism_datum,
+ skeletal_finsets_with_morphisms_given_by_functions,
+ modeling_tower_object_constructor, modeling_tower_object_datum,
+ modeling_tower_morphism_constructor, modeling_tower_morphism_datum,
+ skeletal_finsets_with_morphisms_given_by_lists;
+
+ ##
+ object_constructor := function( cat, cardinality )
+
+ return CreateCapCategoryObjectWithAttributes( cat,
+ Length, cardinality );
+
+ end;
+
+ ##
+ object_datum := { cat, obj } -> Length( obj );
+
+ ##
+ morphism_constructor := function( cat, source, list_of_images, range )
+
+ return CreateCapCategoryMorphismWithAttributes( cat,
+ source,
+ range,
+ AsList, list_of_images );
+
+ end;
+
+ ##
+ morphism_datum := { cat, mor } -> AsList( mor );
+
+ ## building the categorical tower:
+ skeletal_finsets_with_morphisms_given_by_functions :=
+ CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions( : FinalizeCategory := true );
+
+ ## from the raw object data to the object in the modeling category
+ modeling_tower_object_constructor :=
+ function( cat, cardinality )
+ local skeletal_finsets_with_morphisms_given_by_functions;
+
+ skeletal_finsets_with_morphisms_given_by_functions := ModelingCategory( cat );
+
+ return ObjectConstructor( skeletal_finsets_with_morphisms_given_by_functions,
+ cardinality );
+
+ end;
+
+ ## from the object in the modeling category to the raw object data
+ modeling_tower_object_datum := { cat, obj } -> Length( obj );
+
+ ## from the raw morphism data to the morphism in the modeling category
+ modeling_tower_morphism_constructor :=
+ function( cat, source, list_of_images, range )
+ local skeletal_finsets_with_morphisms_given_by_functions, f;
+
+ skeletal_finsets_with_morphisms_given_by_functions := ModelingCategory( cat );
+
+ f := CapJitTypedExpression(
+ i -> list_of_images[1 + i],
+ cat -> SkeletalFinSets_func_type );
+
+ return MorphismConstructor( skeletal_finsets_with_morphisms_given_by_functions,
+ source,
+ f,
+ range );
+
+ end;
+
+ ## from the morphism in the modeling category to the raw morphism data
+ modeling_tower_morphism_datum :=
+ function( cat, mor )
+
+ return List( [ 0 .. Length( Source( mor ) ) - 1 ], AsFunc( mor ) );
+
+ end;
+
+ skeletal_finsets_with_morphisms_given_by_lists :=
+ ReinterpretationOfCategory( skeletal_finsets_with_morphisms_given_by_functions,
+ rec( name := "SkeletalFinSets",
+ category_filter := IsCategoryOfSkeletalFinSetsWithMorphismsGivenByLists,
+ category_object_filter := IsObjectInCategoryOfSkeletalFinSetsWithMorphismsGivenByLists,
+ category_morphism_filter := IsMorphismInCategoryOfSkeletalFinSetsWithMorphismsGivenByLists,
+ object_constructor := object_constructor,
+ object_datum := object_datum,
+ morphism_constructor := morphism_constructor,
+ morphism_datum := morphism_datum,
+ modeling_tower_object_constructor := modeling_tower_object_constructor,
+ modeling_tower_object_datum := modeling_tower_object_datum,
+ modeling_tower_morphism_constructor := modeling_tower_morphism_constructor,
+ modeling_tower_morphism_datum := modeling_tower_morphism_datum,
+ only_primitive_operations := true,
+ ) : FinalizeCategory := false );
+
+ # this is a workhorse category -> no logic and caching only via IsIdenticalObj
+ CapCategorySwitchLogicOff( skeletal_finsets_with_morphisms_given_by_lists );
+
+ SetRangeCategoryOfHomomorphismStructure( skeletal_finsets_with_morphisms_given_by_lists, skeletal_finsets_with_morphisms_given_by_lists );
+ SetIsEquippedWithHomomorphismStructure( skeletal_finsets_with_morphisms_given_by_lists, true );
+
+ ##
+ AddIsEqualForMorphisms( skeletal_finsets_with_morphisms_given_by_lists,
+ function ( cat, mor1, mor2 )
+
+ return AsList( mor1 ) = AsList( mor2 );
+
+ end );
+
+ ## the function SKELETAL_FIN_SETS_IsEpimorphism
+ ## has linear runtime complexity
+ AddIsEpimorphism( skeletal_finsets_with_morphisms_given_by_lists,
+ function ( cat, phi )
+ local imgs, t;
+
+ imgs := AsList( phi );
+
+ t := Length( Range( phi ) );
+
+ ## we do not have a linear purely functional test (yet),
+ ## the following linear runtime function works with side effects,
+ ## so we hide it from the compiler
+
+ return not (false in SKELETAL_FIN_SETS_IsEpimorphism( imgs, t ));
+
+ end );
+
+ ##
+ AddIsMonomorphism( skeletal_finsets_with_morphisms_given_by_lists,
+ function ( cat, phi )
+ local imgs, t;
+
+ imgs := AsList( phi );
+
+ t := Length( Range( phi ) );
+
+ ## we do not have a linear purely functional test (yet),
+ ## the following linear runtime function works with side effects,
+ ## so we hide it from the compiler
+
+ return SKELETAL_FIN_SETS_IsMonomorphism( imgs, t );
+
+ end );
+
+ ##
+ AddUniversalMorphismFromCoproductWithGivenCoproduct( skeletal_finsets_with_morphisms_given_by_lists,
+ function ( cat, L, test_object, tau, S )
+ local concat;
+
+ concat := Concatenation( List( tau, AsList ) );
+
+ return MorphismConstructor( cat, S, concat, test_object );
+
+ end );
+
+ ##
+ AddCoequalizer( skeletal_finsets_with_morphisms_given_by_lists,
+ function ( cat, s, D )
+
+ return ObjectConstructor( cat, BigInt( Length( SKELETAL_FIN_SETS_ExplicitCoequalizer( s, D ) ) ) );
+
+ end );
+
+ ##
+ AddProjectionOntoCoequalizerWithGivenCoequalizer( skeletal_finsets_with_morphisms_given_by_lists,
+ function ( cat, s, D, C )
+ local Cq, cmp;
+
+ Cq := SKELETAL_FIN_SETS_ExplicitCoequalizer( s, D );
+
+ cmp := List( s, x -> -1 + BigInt( SafeUniquePositionProperty( Cq, c -> x in c ) ) );
+
+ return MorphismConstructor( cat, s, cmp, C );
+
+ end );
+
+ ##
+ AddUniversalMorphismFromCoequalizerWithGivenCoequalizer( skeletal_finsets_with_morphisms_given_by_lists,
+ function ( cat, s, D, test_object, tau, C )
+ local Cq;
+
+ Cq := SKELETAL_FIN_SETS_ExplicitCoequalizer( s, D );
+
+ return MorphismConstructor( cat, C, List( Cq, x -> tau( x[1] ) ), Range( tau ) );
+
+ end );
+
+ ##
+ AddExactCoverWithGlobalElements( skeletal_finsets_with_morphisms_given_by_lists,
+ function ( cat, A )
+ local T;
+
+ T := TerminalObject( cat );
+
+ return List( [ 0 .. Length( A ) - 1 ], i ->
+ MorphismConstructor( cat,
+ T,
+ [ i ],
+ A ) );
+
+ end );
+
+ ##
+ AddMorphismsOfExternalHom( skeletal_finsets_with_morphisms_given_by_lists,
+ function ( cat, A, B )
+ local hom_A_B, mors;
+
+ hom_A_B := ExponentialOnObjects( cat, A, B );
+
+ mors := ExactCoverWithGlobalElements( cat, hom_A_B );
+
+ return List( mors,
+ mor -> CartesianLambdaElimination( cat,
+ A,
+ B,
+ mor ) );
+
+ end, 1 + Sum( [ [ "ExponentialOnObjects", 1 ],
+ [ "ExactCoverWithGlobalElements", 1 ],
+ [ "CartesianLambdaElimination", 2 ] ],
+ e -> e[2] * CurrentOperationWeight( skeletal_finsets_with_morphisms_given_by_lists!.derivations_weight_list, e[1] ) ) );
+
+ if ValueOption( "no_precompiled_code" ) <> true then
+
+ ADD_FUNCTIONS_FOR_CategoryOfSkeletalFinSetsWithMorphismsGivenByListsPrecompiled( skeletal_finsets_with_morphisms_given_by_lists );
+
+ fi;
+
+ Finalize( skeletal_finsets_with_morphisms_given_by_lists );
+
+ return skeletal_finsets_with_morphisms_given_by_lists;
+
+end );
+
+##
+InstallMethod( CategoryOfSkeletalFinSets, "for no input", [ ], CategoryOfSkeletalFinSetsWithMorphismsGivenByLists );
+
+##
+InstallOtherMethod( FinSet,
+ "for a nonnegative integer",
+ [ IsBigInt ],
+
+ function ( n )
+
+ return FinSet( SkeletalFinSets, n );
+
+end );
+
+##
+InstallMethod( MapOfFinSets,
+ "for two CAP skeletal finite sets and a list",
+ [ IsObjectInCategoryOfSkeletalFinSetsWithMorphismsGivenByLists, IsList, IsObjectInCategoryOfSkeletalFinSetsWithMorphismsGivenByLists ],
+
+ function ( s, list_of_images, t )
+
+ return MorphismConstructor( CapCategory( s ), s, list_of_images, t );
+
+end );
+
+##
+InstallMethod( AsFunc,
+ "for a CAP map of skeletal finite sets",
+ [ IsMorphismInCategoryOfSkeletalFinSetsWithMorphismsGivenByLists ],
+
+ function ( map )
+ local images;
+
+ images := AsList( map );
+
+ return i -> images[1 + i];
+
+end );
diff --git a/gap/init.gi b/gap/init.gi
index 333d2e59..b2f33d1b 100644
--- a/gap/init.gi
+++ b/gap/init.gi
@@ -10,7 +10,13 @@ BindGlobal( "init_FinSetsForCAP", function ( )
BindGlobal( "FinSets", CategoryOfFinSets( ) );
##
- BindGlobal( "SkeletalFinSets", CategoryOfSkeletalFinSets( ) );
+ BindGlobal( "SkeletalFinSetsWithMorphismsGivenByFunctions", CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions( ) );
+
+ ##
+ BindGlobal( "SkeletalFinSetsWithMorphismsGivenByLists", CategoryOfSkeletalFinSetsWithMorphismsGivenByLists( ) );
+
+ ##
+ BindGlobal( "SkeletalFinSets", SkeletalFinSetsWithMorphismsGivenByLists );
end );
diff --git a/gap/precompiled_categories/CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctionsPrecompiled.gi b/gap/precompiled_categories/CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctionsPrecompiled.gi
new file mode 100644
index 00000000..77ced12f
--- /dev/null
+++ b/gap/precompiled_categories/CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctionsPrecompiled.gi
@@ -0,0 +1,1016 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# FinSetsForCAP: The elementary topos of (skeletal) finite sets
+#
+# Implementations
+#
+BindGlobal( "ADD_FUNCTIONS_FOR_CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctionsPrecompiled", function ( cat )
+
+ ##
+ AddCartesianBraidingInverseWithGivenDirectProducts( cat,
+
+########
+function ( cat_1, s_1, a_1, b_1, r_1 )
+ local deduped_1_1, hoisted_2_1;
+ hoisted_2_1 := Length( a_1 );
+ deduped_1_1 := Length( b_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, r_1, AsFunc, function ( i_2 )
+ return REM_INT( i_2, deduped_1_1 ) * hoisted_2_1 + QUO_INT( i_2, deduped_1_1 );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddCartesianCoevaluationMorphismWithGivenRange( cat,
+
+########
+function ( cat_1, a_1, b_1, r_1 )
+ local hoisted_1_1, hoisted_2_1, deduped_3_1, deduped_4_1, deduped_5_1;
+ deduped_5_1 := Length( b_1 );
+ deduped_4_1 := Length( a_1 );
+ deduped_3_1 := deduped_4_1 * deduped_5_1;
+ hoisted_2_1 := deduped_4_1 * deduped_3_1 * GeometricSumDiff1( deduped_3_1, deduped_5_1 );
+ hoisted_1_1 := GeometricSum( deduped_3_1, deduped_5_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, r_1, AsFunc, function ( i_2 )
+ return i_2 * hoisted_1_1 + hoisted_2_1;
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddCartesianEvaluationMorphismWithGivenSource( cat,
+
+########
+function ( cat_1, a_1, b_1, s_1 )
+ local hoisted_1_1, deduped_3_1;
+ deduped_3_1 := Length( b_1 );
+ hoisted_1_1 := deduped_3_1 ^ Length( a_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, b_1, AsFunc, function ( i_2 )
+ return REM_INT( QUO_INT( i_2, deduped_3_1 ^ QUO_INT( i_2, hoisted_1_1 ) ), deduped_3_1 );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddCartesianLambdaElimination( cat,
+
+########
+function ( cat_1, a_1, b_1, alpha_1 )
+ local deduped_1_1, hoisted_2_1;
+ hoisted_2_1 := AsFunc( alpha_1 )( 0 );
+ deduped_1_1 := Length( b_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, b_1, AsFunc, function ( i_2 )
+ return REM_INT( QUO_INT( hoisted_2_1, deduped_1_1 ^ i_2 ), deduped_1_1 );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddCartesianLambdaIntroduction( cat,
+
+########
+function ( cat_1, alpha_1 )
+ local hoisted_1_1, hoisted_3_1, deduped_4_1, deduped_5_1;
+ deduped_5_1 := Length( Source( alpha_1 ) );
+ deduped_4_1 := Length( Range( alpha_1 ) );
+ hoisted_1_1 := AsFunc( alpha_1 );
+ hoisted_3_1 := Sum( List( [ 0 .. deduped_5_1 - 1 ], function ( k_2 )
+ return hoisted_1_1( k_2 ) * deduped_4_1 ^ k_2;
+ end ) );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( 1 ) ), CreateCapCategoryObjectWithAttributes( cat_1, Length, deduped_4_1 ^ deduped_5_1 ), AsFunc, function ( i_2 )
+ return hoisted_3_1;
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddCartesianLeftUnitorInverseWithGivenDirectProduct( cat,
+
+########
+function ( cat_1, a_1, r_1 )
+ return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, a_1, AsFunc, ID_FUNC );
+end
+########
+
+ , 100 );
+
+ ##
+ AddCartesianLeftUnitorWithGivenDirectProduct( cat,
+
+########
+function ( cat_1, a_1, s_1 )
+ return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, a_1, AsFunc, ID_FUNC );
+end
+########
+
+ , 100 );
+
+ ##
+ AddCartesianRightUnitorInverseWithGivenDirectProduct( cat,
+
+########
+function ( cat_1, a_1, r_1 )
+ return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, a_1, AsFunc, ID_FUNC );
+end
+########
+
+ , 100 );
+
+ ##
+ AddCartesianRightUnitorWithGivenDirectProduct( cat,
+
+########
+function ( cat_1, a_1, s_1 )
+ return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, a_1, AsFunc, ID_FUNC );
+end
+########
+
+ , 100 );
+
+ ##
+ AddClassifyingMorphismOfSubobjectWithGivenSubobjectClassifier( cat,
+
+########
+function ( cat_1, alpha_1, Omega_1 )
+ local hoisted_1_1, hoisted_2_1;
+ hoisted_2_1 := BigInt( 1 );
+ hoisted_1_1 := List( [ 0 .. Length( Source( alpha_1 ) ) - 1 ], AsFunc( alpha_1 ) );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, Range( alpha_1 ), Omega_1, AsFunc, function ( x_2 )
+ if x_2 in hoisted_1_1 then
+ return hoisted_2_1;
+ else
+ return BigInt( 0 );
+ fi;
+ return;
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddCoastrictionToImageWithGivenImageObject( cat,
+
+########
+function ( cat_1, alpha_1, I_1 )
+ local hoisted_2_1, deduped_3_1, deduped_4_1;
+ deduped_4_1 := Source( alpha_1 );
+ deduped_3_1 := List( [ 0 .. Length( deduped_4_1 ) - 1 ], AsFunc( alpha_1 ) );
+ hoisted_2_1 := SSortedList( deduped_3_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, deduped_4_1, I_1, AsFunc, function ( i_2 )
+ return -1 + BigInt( SafePosition( hoisted_2_1, deduped_3_1[(1 + i_2)] ) );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddCoequalizer( cat,
+
+########
+function ( cat_1, arg2_1, arg3_1 )
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( Length( SKELETAL_FIN_SETS_ExplicitCoequalizer( arg2_1, arg3_1 ) ) ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddColift( cat,
+
+########
+function ( cat_1, alpha_1, beta_1 )
+ local deduped_1_1, hoisted_2_1, hoisted_3_1;
+ hoisted_3_1 := List( [ 0 .. Length( Source( beta_1 ) ) - 1 ], AsFunc( beta_1 ) );
+ hoisted_2_1 := BigInt( 0 );
+ deduped_1_1 := List( [ 0 .. Length( Source( alpha_1 ) ) - 1 ], AsFunc( alpha_1 ) );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, Range( alpha_1 ), Range( beta_1 ), AsFunc, function ( y_2 )
+ if not y_2 in deduped_1_1 then
+ return hoisted_2_1;
+ else
+ return hoisted_3_1[SafePosition( deduped_1_1, y_2 )];
+ fi;
+ return;
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddCoproduct( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, Sum( List( arg2_1, Length ) ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddDirectProduct( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, Product( List( arg2_1, Length ) ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddEmbeddingOfEqualizerWithGivenEqualizer( cat,
+
+########
+function ( cat_1, Y_1, morphisms_1, P_1 )
+ local deduped_1_1, hoisted_2_1, hoisted_3_1;
+ hoisted_2_1 := [ 1 .. Length( morphisms_1 ) - 1 ];
+ deduped_1_1 := List( morphisms_1, AsFunc );
+ hoisted_3_1 := Filtered( [ 0 .. Length( Y_1 ) - 1 ], function ( x_2 )
+ return ForAll( hoisted_2_1, function ( j_3 )
+ return deduped_1_1[j_3]( x_2 ) = deduped_1_1[j_3 + 1]( x_2 );
+ end );
+ end );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, P_1, Y_1, AsFunc, function ( i_2 )
+ return hoisted_3_1[1 + i_2];
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddEpimorphismFromSomeProjectiveObject( cat,
+
+########
+function ( cat_1, A_1 )
+ return CreateCapCategoryMorphismWithAttributes( cat_1, A_1, A_1, AsFunc, ID_FUNC );
+end
+########
+
+ , 100 );
+
+ ##
+ AddEqualizer( cat,
+
+########
+function ( cat_1, arg2_1, arg3_1 )
+ local deduped_1_1, hoisted_2_1;
+ hoisted_2_1 := [ 1 .. Length( arg3_1 ) - 1 ];
+ deduped_1_1 := List( arg3_1, AsFunc );
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, Length( Filtered( [ 0 .. Length( arg2_1 ) - 1 ], function ( i_2 )
+ return ForAll( hoisted_2_1, function ( j_3 )
+ return deduped_1_1[j_3]( i_2 ) = deduped_1_1[j_3 + 1]( i_2 );
+ end );
+ end ) ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddExactCoverWithGlobalElements( cat,
+
+########
+function ( cat_1, arg2_1 )
+ local hoisted_1_1;
+ hoisted_1_1 := CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( 1 ) );
+ return List( [ 0 .. Length( arg2_1 ) - 1 ], function ( j_2 )
+ return CreateCapCategoryMorphismWithAttributes( cat_1, hoisted_1_1, arg2_1, AsFunc, function ( i_3 )
+ return j_2;
+ end );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddExponentialOnMorphismsWithGivenExponentials( cat,
+
+########
+function ( cat_1, s_1, alpha_1, beta_1, r_1 )
+ local hoisted_1_1, deduped_2_1, hoisted_3_1, hoisted_4_1, hoisted_5_1;
+ hoisted_5_1 := [ 0 .. Length( Source( alpha_1 ) ) - 1 ];
+ hoisted_4_1 := Length( Range( beta_1 ) );
+ hoisted_3_1 := AsFunc( beta_1 );
+ deduped_2_1 := Length( Source( beta_1 ) );
+ hoisted_1_1 := AsFunc( alpha_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, r_1, AsFunc, function ( i_2 )
+ return Sum( List( hoisted_5_1, function ( k_3 )
+ return hoisted_3_1( REM_INT( QUO_INT( i_2, deduped_2_1 ^ hoisted_1_1( k_3 ) ), deduped_2_1 ) ) * hoisted_4_1 ^ k_3;
+ end ) );
+ end );
+end
+########
+
+ , 1003 );
+
+ ##
+ AddExponentialOnObjects( cat,
+
+########
+function ( cat_1, a_1, b_1 )
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, Length( b_1 ) ^ Length( a_1 ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddIdentityMorphism( cat,
+
+########
+function ( cat_1, a_1 )
+ return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, a_1, AsFunc, ID_FUNC );
+end
+########
+
+ , 100 );
+
+ ##
+ AddImageEmbeddingWithGivenImageObject( cat,
+
+########
+function ( cat_1, alpha_1, I_1 )
+ local hoisted_1_1;
+ hoisted_1_1 := SSortedList( List( [ 0 .. Length( Source( alpha_1 ) ) - 1 ], AsFunc( alpha_1 ) ) );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, I_1, Range( alpha_1 ), AsFunc, function ( i_2 )
+ return hoisted_1_1[1 + i_2];
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddImageObject( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( Length( SSortedList( List( [ 0 .. Length( Source( arg2_1 ) ) - 1 ], AsFunc( arg2_1 ) ) ) ) ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddInitialObject( cat,
+
+########
+function ( cat_1 )
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( 0 ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddInjectionOfCofactorOfCoproductWithGivenCoproduct( cat,
+
+########
+function ( cat_1, objects_1, k_1, P_1 )
+ local hoisted_1_1;
+ hoisted_1_1 := Sum( List( objects_1, Length ){[ 1 .. k_1 - 1 ]} );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, objects_1[k_1], P_1, AsFunc, function ( i_2 )
+ return hoisted_1_1 + i_2;
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsColiftable( cat,
+
+########
+function ( cat_1, arg2_1, arg3_1 )
+ local hoisted_2_1, deduped_3_1;
+ deduped_3_1 := List( [ 0 .. Length( Source( arg2_1 ) ) - 1 ], AsFunc( arg2_1 ) );
+ hoisted_2_1 := List( [ 0 .. Length( Source( arg3_1 ) ) - 1 ], AsFunc( arg3_1 ) );
+ return ForAll( SSortedList( deduped_3_1 ), function ( i_2 )
+ return Length( SSortedList( hoisted_2_1{Positions( deduped_3_1, i_2 )} ) ) = 1;
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsEpimorphism( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return not false in SKELETAL_FIN_SETS_IsEpimorphism( List( [ 0 .. Length( Source( arg2_1 ) ) - 1 ], AsFunc( arg2_1 ) ), Length( Range( arg2_1 ) ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsEqualForMorphisms( cat,
+
+########
+function ( cat_1, arg2_1, arg3_1 )
+ local hoisted_1_1, hoisted_2_1;
+ hoisted_2_1 := AsFunc( arg3_1 );
+ hoisted_1_1 := AsFunc( arg2_1 );
+ return ForAll( [ 0 .. Length( Source( arg2_1 ) ) - 1 ], function ( x_2 )
+ return hoisted_1_1( x_2 ) = hoisted_2_1( x_2 );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsEqualForObjects( cat,
+
+########
+function ( cat_1, arg2_1, arg3_1 )
+ return Length( arg2_1 ) = Length( arg3_1 );
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsHomSetInhabited( cat,
+
+########
+function ( cat_1, arg2_1, arg3_1 )
+ return Length( arg2_1 ) = 0 or Length( arg3_1 ) <> 0;
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsInitial( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return Length( arg2_1 ) = 0;
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsInjective( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return Length( arg2_1 ) <> 0;
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsLiftable( cat,
+
+########
+function ( cat_1, arg2_1, arg3_1 )
+ local hoisted_1_1, deduped_2_1, deduped_3_1, deduped_4_1;
+ deduped_4_1 := [ 0 .. Length( Source( arg3_1 ) ) - 1 ];
+ deduped_3_1 := [ 0 .. Length( Source( arg2_1 ) ) - 1 ];
+ deduped_2_1 := List( deduped_3_1, AsFunc( arg2_1 ) );
+ hoisted_1_1 := List( deduped_4_1, AsFunc( arg3_1 ) );
+ return ForAll( IdFunc( function ( )
+ if 100 * Length( deduped_3_1 ) < Length( deduped_4_1 ) then
+ return SSortedList( deduped_2_1 );
+ else
+ return deduped_2_1;
+ fi;
+ return;
+ end )( ), function ( y_2 )
+ return y_2 in hoisted_1_1;
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsMonomorphism( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return SKELETAL_FIN_SETS_IsMonomorphism( List( [ 0 .. Length( Source( arg2_1 ) ) - 1 ], AsFunc( arg2_1 ) ), Length( Range( arg2_1 ) ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsProjective( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return true;
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsSplitEpimorphism( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return not false in SKELETAL_FIN_SETS_IsEpimorphism( List( [ 0 .. Length( Source( arg2_1 ) ) - 1 ], AsFunc( arg2_1 ) ), Length( Range( arg2_1 ) ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsSplitMonomorphism( cat,
+
+########
+function ( cat_1, arg2_1 )
+ local deduped_1_1, deduped_2_1;
+ deduped_2_1 := Length( Source( arg2_1 ) );
+ deduped_1_1 := Length( Range( arg2_1 ) );
+ return deduped_1_1 = 0 or deduped_2_1 <> 0 and SKELETAL_FIN_SETS_IsMonomorphism( List( [ 0 .. deduped_2_1 - 1 ], AsFunc( arg2_1 ) ), deduped_1_1 );
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsTerminal( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return Length( arg2_1 ) = 1;
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsWellDefinedForMorphisms( cat,
+
+########
+function ( cat_1, arg2_1 )
+ local hoisted_1_1, hoisted_2_1;
+ hoisted_2_1 := Length( Range( arg2_1 ) );
+ hoisted_1_1 := AsFunc( arg2_1 );
+ if not ForAll( [ 0 .. Length( Source( arg2_1 ) ) - 1 ], function ( x_2 )
+ local deduped_1_2;
+ deduped_1_2 := hoisted_1_1( x_2 );
+ return (IsBigInt( deduped_1_2 ) and deduped_1_2 >= 0 and deduped_1_2 < hoisted_2_1);
+ end ) then
+ return false;
+ else
+ return true;
+ fi;
+ return;
+end
+########
+
+ , 100 );
+
+ ##
+ AddIsWellDefinedForObjects( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return Length( arg2_1 ) >= 0;
+end
+########
+
+ , 100 );
+
+ ##
+ AddLift( cat,
+
+########
+function ( cat_1, alpha_1, beta_1 )
+ local hoisted_1_1, hoisted_2_1, deduped_3_1;
+ deduped_3_1 := Source( beta_1 );
+ hoisted_2_1 := List( [ 0 .. Length( deduped_3_1 ) - 1 ], AsFunc( beta_1 ) );
+ hoisted_1_1 := AsFunc( alpha_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, Source( alpha_1 ), deduped_3_1, AsFunc, function ( x_2 )
+ return -1 + BigInt( SafePosition( hoisted_2_1, hoisted_1_1( x_2 ) ) );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddMonomorphismIntoSomeInjectiveObjectWithGivenSomeInjectiveObject( cat,
+
+########
+function ( cat_1, A_1, I_1 )
+ return CreateCapCategoryMorphismWithAttributes( cat_1, A_1, I_1, AsFunc, ID_FUNC );
+end
+########
+
+ , 100 );
+
+ ##
+ AddMorphismConstructor( cat,
+
+########
+function ( cat_1, arg2_1, arg3_1, arg4_1 )
+ return CreateCapCategoryMorphismWithAttributes( cat_1, arg2_1, arg4_1, AsFunc, arg3_1 );
+end
+########
+
+ , 100 );
+
+ ##
+ AddMorphismDatum( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return AsFunc( arg2_1 );
+end
+########
+
+ , 100 );
+
+ ##
+ AddMorphismsOfExternalHom( cat,
+
+########
+function ( cat_1, arg2_1, arg3_1 )
+ local deduped_2_1;
+ deduped_2_1 := Length( arg3_1 );
+ return List( [ 0 .. deduped_2_1 ^ Length( arg2_1 ) - 1 ], function ( logic_new_func_x_2 )
+ return CreateCapCategoryMorphismWithAttributes( cat_1, arg2_1, arg3_1, AsFunc, function ( i_3 )
+ return REM_INT( QUO_INT( logic_new_func_x_2, deduped_2_1 ^ i_3 ), deduped_2_1 );
+ end );
+ end );
+end
+########
+
+ , 401 );
+
+ ##
+ AddObjectConstructor( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, arg2_1 );
+end
+########
+
+ , 100 );
+
+ ##
+ AddObjectDatum( cat,
+
+########
+function ( cat_1, arg2_1 )
+ return Length( arg2_1 );
+end
+########
+
+ , 100 );
+
+ ##
+ AddPreCompose( cat,
+
+########
+function ( cat_1, alpha_1, beta_1 )
+ local hoisted_1_1, hoisted_2_1;
+ hoisted_2_1 := AsFunc( beta_1 );
+ hoisted_1_1 := AsFunc( alpha_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, Source( alpha_1 ), Range( beta_1 ), AsFunc, function ( i_2 )
+ return hoisted_2_1( hoisted_1_1( i_2 ) );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddProjectionInFactorOfDirectProductWithGivenDirectProduct( cat,
+
+########
+function ( cat_1, objects_1, k_1, P_1 )
+ local hoisted_1_1, hoisted_2_1, deduped_3_1;
+ deduped_3_1 := List( objects_1, Length );
+ hoisted_2_1 := deduped_3_1[k_1];
+ hoisted_1_1 := Product( deduped_3_1{[ 1 .. k_1 - 1 ]} );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, P_1, objects_1[k_1], AsFunc, function ( i_2 )
+ return REM_INT( QUO_INT( i_2, hoisted_1_1 ), hoisted_2_1 );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddProjectionOntoCoequalizerWithGivenCoequalizer( cat,
+
+########
+function ( cat_1, Y_1, morphisms_1, P_1 )
+ local hoisted_1_1;
+ hoisted_1_1 := SKELETAL_FIN_SETS_ExplicitCoequalizer( Y_1, morphisms_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, Y_1, P_1, AsFunc, function ( i_2 )
+ return -1 + BigInt( SafeUniquePositionProperty( hoisted_1_1, function ( c_3 )
+ return (i_2 in c_3);
+ end ) );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddPushoutComplement( cat,
+
+########
+function ( cat_1, l_1, m_1 )
+ local deduped_5_1, deduped_6_1, hoisted_8_1, hoisted_10_1, hoisted_15_1, hoisted_18_1, hoisted_19_1, deduped_22_1, deduped_23_1, deduped_24_1, deduped_25_1, deduped_26_1, deduped_27_1, deduped_28_1, deduped_29_1, deduped_30_1, deduped_31_1, deduped_32_1, deduped_33_1, deduped_34_1, deduped_35_1, deduped_36_1, deduped_37_1, deduped_38_1;
+ deduped_38_1 := BigInt( 3 );
+ deduped_37_1 := BigInt( 2 );
+ deduped_36_1 := BigInt( 1 );
+ deduped_35_1 := BigInt( 0 );
+ deduped_34_1 := Range( m_1 );
+ deduped_33_1 := Length( Source( l_1 ) );
+ deduped_32_1 := Length( Source( m_1 ) );
+ deduped_31_1 := Length( deduped_34_1 );
+ deduped_30_1 := Filtered( [ deduped_35_1, deduped_36_1, deduped_37_1, deduped_38_1 ], function ( x_2 )
+ return IdFunc( function ( )
+ if (x_2 = deduped_38_1) then
+ return deduped_36_1;
+ else
+ return deduped_35_1;
+ fi;
+ return;
+ end )( ) = REM_INT( x_2, deduped_37_1 );
+ end );
+ hoisted_10_1 := AsFunc( l_1 );
+ deduped_29_1 := Filtered( [ 0 .. deduped_32_1 * deduped_33_1 - 1 ], function ( i_2 )
+ return REM_INT( QUO_INT( i_2, deduped_36_1 ), deduped_32_1 ) = hoisted_10_1( REM_INT( QUO_INT( i_2, deduped_32_1 ), deduped_33_1 ) );
+ end );
+ deduped_28_1 := Filtered( [ 0 .. deduped_32_1 * deduped_32_1 - 1 ], function ( x_2 )
+ return REM_INT( QUO_INT( x_2, deduped_36_1 ), deduped_32_1 ) = REM_INT( QUO_INT( x_2, deduped_32_1 ), deduped_32_1 );
+ end );
+ deduped_27_1 := Length( deduped_29_1 );
+ deduped_26_1 := Filtered( [ 0 .. deduped_27_1 * deduped_33_1 - 1 ], function ( x_2 )
+ return REM_INT( QUO_INT( deduped_29_1[1 + REM_INT( QUO_INT( x_2, deduped_36_1 ), deduped_27_1 )], deduped_32_1 ), deduped_33_1 ) = REM_INT( QUO_INT( x_2, deduped_27_1 ), deduped_33_1 );
+ end );
+ deduped_6_1 := deduped_31_1 * deduped_35_1;
+ deduped_5_1 := AsFunc( m_1 );
+ deduped_25_1 := SSortedList( List( [ 0 .. Length( deduped_28_1 ) - 1 ], function ( i_2 )
+ return deduped_36_1 * deduped_5_1( REM_INT( QUO_INT( deduped_28_1[(1 + i_2)], deduped_36_1 ), deduped_32_1 ) ) + deduped_6_1;
+ end ) );
+ deduped_23_1 := SSortedList( List( [ 0 .. Length( deduped_26_1 ) - 1 ], function ( i_2 )
+ return deduped_36_1 * deduped_5_1( REM_INT( QUO_INT( deduped_29_1[(1 + REM_INT( QUO_INT( deduped_26_1[(1 + i_2)], deduped_36_1 ), deduped_27_1 ))], deduped_36_1 ), deduped_32_1 ) ) + deduped_6_1;
+ end ) );
+ hoisted_19_1 := [ deduped_35_1 ];
+ hoisted_18_1 := deduped_30_1{[ 1 .. Length( deduped_30_1 ) ]};
+ hoisted_15_1 := List( [ 0 .. BigInt( Length( deduped_23_1 ) ) - 1 ], function ( i_2 )
+ return deduped_23_1[1 + i_2];
+ end );
+ hoisted_8_1 := List( [ 0 .. BigInt( Length( deduped_25_1 ) ) - 1 ], function ( i_2 )
+ return deduped_25_1[1 + i_2];
+ end );
+ deduped_24_1 := Filtered( [ 0 .. deduped_31_1 - 1 ], function ( i_2 )
+ local deduped_1_2;
+ deduped_1_2 := REM_INT( QUO_INT( i_2, deduped_36_1 ), deduped_31_1 );
+ return IdFunc( function ( )
+ if (deduped_36_1 * IdFunc( function ( )
+ if (deduped_1_2 in hoisted_8_1) then
+ return deduped_36_1;
+ else
+ return deduped_35_1;
+ fi;
+ return;
+ end )( ) + deduped_37_1 * IdFunc( function ( )
+ if (deduped_1_2 in hoisted_15_1) then
+ return deduped_36_1;
+ else
+ return deduped_35_1;
+ fi;
+ return;
+ end )( ) in hoisted_18_1) then
+ return deduped_36_1;
+ else
+ return deduped_35_1;
+ fi;
+ return;
+ end )( ) = IdFunc( function ( )
+ if (REM_INT( QUO_INT( i_2, deduped_31_1 ), deduped_36_1 ) in hoisted_19_1) then
+ return deduped_36_1;
+ else
+ return deduped_35_1;
+ fi;
+ return;
+ end )( );
+ end );
+ deduped_22_1 := SSortedList( List( [ 0 .. Length( deduped_24_1 ) - 1 ], function ( i_2 )
+ return REM_INT( QUO_INT( deduped_24_1[1 + i_2], deduped_36_1 ), deduped_31_1 );
+ end ) );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( Length( deduped_22_1 ) ) ), deduped_34_1, AsFunc, function ( i_2 )
+ return deduped_22_1[1 + i_2];
+ end );
+end
+########
+
+ , 19767 : IsPrecompiledDerivation := true );
+
+ ##
+ AddSomeInjectiveObject( cat,
+
+########
+function ( cat_1, arg2_1 )
+ if Length( arg2_1 ) = 0 then
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( 1 ) );
+ else
+ return arg2_1;
+ fi;
+ return;
+end
+########
+
+ , 100 );
+
+ ##
+ AddSubobjectClassifier( cat,
+
+########
+function ( cat_1 )
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( 2 ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddTerminalObject( cat,
+
+########
+function ( cat_1 )
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( 1 ) );
+end
+########
+
+ , 100 );
+
+ ##
+ AddUniversalMorphismFromCoequalizerWithGivenCoequalizer( cat,
+
+########
+function ( cat_1, Y_1, morphisms_1, T_1, tau_1, P_1 )
+ local hoisted_1_1, hoisted_2_1;
+ hoisted_2_1 := AsFunc( tau_1 );
+ hoisted_1_1 := SKELETAL_FIN_SETS_ExplicitCoequalizer( Y_1, morphisms_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, P_1, Range( tau_1 ), AsFunc, function ( i_2 )
+ return hoisted_2_1( hoisted_1_1[1 + i_2][1] );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddUniversalMorphismFromCoproductWithGivenCoproduct( cat,
+
+########
+function ( cat_1, objects_1, T_1, tau_1, P_1 )
+ local hoisted_1_1, deduped_2_1, hoisted_3_1, hoisted_4_1, deduped_5_1;
+ deduped_5_1 := Length( tau_1 );
+ hoisted_4_1 := List( tau_1, AsFunc );
+ hoisted_3_1 := [ 1 .. deduped_5_1 ];
+ hoisted_1_1 := List( tau_1, function ( map_2 )
+ return Length( Source( map_2 ) );
+ end );
+ deduped_2_1 := List( [ 0 .. deduped_5_1 ], function ( k_2 )
+ return Sum( hoisted_1_1{[ 1 .. k_2 ]} );
+ end );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, P_1, T_1, AsFunc, function ( i_2 )
+ local deduped_1_2;
+ deduped_1_2 := SafePositionProperty( hoisted_3_1, function ( k_3 )
+ return i_2 < deduped_2_1[k_3 + 1];
+ end );
+ return hoisted_4_1[deduped_1_2]( i_2 - deduped_2_1[deduped_1_2] );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddUniversalMorphismFromInitialObjectWithGivenInitialObject( cat,
+
+########
+function ( cat_1, T_1, P_1 )
+ return CreateCapCategoryMorphismWithAttributes( cat_1, P_1, T_1, AsFunc, ID_FUNC );
+end
+########
+
+ , 100 );
+
+ ##
+ AddUniversalMorphismIntoDirectProductWithGivenDirectProduct( cat,
+
+########
+function ( cat_1, objects_1, T_1, tau_1, P_1 )
+ local hoisted_1_1, hoisted_2_1, hoisted_3_1, deduped_5_1;
+ deduped_5_1 := [ 0 .. Length( objects_1 ) - 1 ];
+ hoisted_3_1 := List( tau_1, AsFunc );
+ hoisted_1_1 := List( objects_1, Length );
+ hoisted_2_1 := List( deduped_5_1, function ( j_2 )
+ return Product( hoisted_1_1{[ 1 .. j_2 ]} );
+ end );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, T_1, P_1, AsFunc, function ( i_2 )
+ return Sum( deduped_5_1, function ( j_3 )
+ local deduped_1_3;
+ deduped_1_3 := 1 + j_3;
+ return hoisted_2_1[deduped_1_3] * hoisted_3_1[deduped_1_3]( i_2 );
+ end );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddUniversalMorphismIntoEqualizerWithGivenEqualizer( cat,
+
+########
+function ( cat_1, Y_1, morphisms_1, T_1, tau_1, P_1 )
+ local deduped_1_1, hoisted_2_1, hoisted_3_1, hoisted_4_1;
+ hoisted_2_1 := [ 1 .. Length( morphisms_1 ) - 1 ];
+ deduped_1_1 := List( morphisms_1, AsFunc );
+ hoisted_4_1 := Filtered( [ 0 .. Length( Y_1 ) - 1 ], function ( x_2 )
+ return ForAll( hoisted_2_1, function ( j_3 )
+ return deduped_1_1[j_3]( x_2 ) = deduped_1_1[j_3 + 1]( x_2 );
+ end );
+ end );
+ hoisted_3_1 := AsFunc( tau_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, T_1, P_1, AsFunc, function ( x_2 )
+ return -1 + BigInt( SafePosition( hoisted_4_1, hoisted_3_1( x_2 ) ) );
+ end );
+end
+########
+
+ , 100 );
+
+ ##
+ AddUniversalMorphismIntoTerminalObjectWithGivenTerminalObject( cat,
+
+########
+function ( cat_1, T_1, P_1 )
+ local hoisted_1_1;
+ hoisted_1_1 := BigInt( 0 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, T_1, P_1, AsFunc, function ( i_2 )
+ return hoisted_1_1;
+ end );
+end
+########
+
+ , 100 );
+
+ if IsBound( cat!.precompiled_functions_added ) then
+
+ # COVERAGE_IGNORE_NEXT_LINE
+ Error( "precompiled functions have already been added before" );
+
+ fi;
+
+ cat!.precompiled_functions_added := true;
+
+end );
+
+BindGlobal( "CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctionsPrecompiled", function ( )
+ local category_constructor, cat;
+
+ category_constructor :=
+
+
+ function ( )
+ return CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctions( );
+end;
+
+
+
+ cat := category_constructor( : FinalizeCategory := false, no_precompiled_code := true );
+
+ ADD_FUNCTIONS_FOR_CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctionsPrecompiled( cat );
+
+ Finalize( cat );
+
+ return cat;
+
+end );
diff --git a/gap/precompiled_categories/CategoryOfSkeletalFinSetsWithMorphismsGivenByListsPrecompiled.gi b/gap/precompiled_categories/CategoryOfSkeletalFinSetsWithMorphismsGivenByListsPrecompiled.gi
index 9fb24ecf..57679d6d 100644
--- a/gap/precompiled_categories/CategoryOfSkeletalFinSetsWithMorphismsGivenByListsPrecompiled.gi
+++ b/gap/precompiled_categories/CategoryOfSkeletalFinSetsWithMorphismsGivenByListsPrecompiled.gi
@@ -45,12 +45,11 @@ end
########
function ( cat_1, a_1, b_1, s_1 )
- local deduped_3_1, deduped_4_1, deduped_5_1;
- deduped_5_1 := Length( a_1 );
- deduped_4_1 := Length( b_1 );
- deduped_3_1 := deduped_4_1 ^ deduped_5_1;
- return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, b_1, AsList, List( [ 0 .. deduped_3_1 * deduped_5_1 - 1 ], function ( i_2 )
- return REM_INT( QUO_INT( i_2, deduped_4_1 ^ QUO_INT( i_2, deduped_3_1 ) ), deduped_4_1 );
+ local hoisted_1_1, deduped_3_1;
+ deduped_3_1 := Length( b_1 );
+ hoisted_1_1 := deduped_3_1 ^ Length( a_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, b_1, AsList, List( [ 0 .. Length( s_1 ) - 1 ], function ( i_2 )
+ return REM_INT( QUO_INT( i_2, deduped_3_1 ^ QUO_INT( i_2, hoisted_1_1 ) ), deduped_3_1 );
end ) );
end
########
@@ -95,7 +94,7 @@ end
########
function ( cat_1, a_1, r_1 )
- return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, a_1, AsList, [ 0 .. Length( a_1 ) - 1 ] );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, r_1, AsList, [ 0 .. Length( a_1 ) - 1 ] );
end
########
@@ -106,7 +105,7 @@ end
########
function ( cat_1, a_1, s_1 )
- return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, a_1, AsList, [ 0 .. Length( a_1 ) - 1 ] );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, a_1, AsList, [ 0 .. Length( a_1 ) - 1 ] );
end
########
@@ -117,7 +116,7 @@ end
########
function ( cat_1, a_1, r_1 )
- return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, a_1, AsList, [ 0 .. Length( a_1 ) - 1 ] );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, r_1, AsList, [ 0 .. Length( a_1 ) - 1 ] );
end
########
@@ -128,7 +127,7 @@ end
########
function ( cat_1, a_1, s_1 )
- return CreateCapCategoryMorphismWithAttributes( cat_1, a_1, a_1, AsList, [ 0 .. Length( a_1 ) - 1 ] );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, a_1, AsList, [ 0 .. Length( a_1 ) - 1 ] );
end
########
@@ -238,12 +237,12 @@ function ( cat_1, Y_1, morphisms_1, P_1 )
hoisted_2_1 := [ 1 .. Length( morphisms_1 ) - 1 ];
deduped_1_1 := List( morphisms_1, AsList );
return CreateCapCategoryMorphismWithAttributes( cat_1, P_1, Y_1, AsList, Filtered( [ 0 .. Length( Y_1 ) - 1 ], function ( x_2 )
- local deduped_1_2;
- deduped_1_2 := 1 + x_2;
- return ForAll( hoisted_2_1, function ( j_3 )
- return deduped_1_1[j_3][deduped_1_2] = deduped_1_1[j_3 + 1][deduped_1_2];
- end );
- end ) );
+ local deduped_1_2;
+ deduped_1_2 := 1 + x_2;
+ return ForAll( hoisted_2_1, function ( j_3 )
+ return deduped_1_1[j_3][deduped_1_2] = deduped_1_1[j_3 + 1][deduped_1_2];
+ end );
+ end ){[ 1 .. Length( P_1 ) ]} );
end
########
@@ -268,9 +267,9 @@ function ( cat_1, arg2_1, arg3_1 )
local deduped_1_1, hoisted_2_1;
hoisted_2_1 := [ 1 .. Length( arg3_1 ) - 1 ];
deduped_1_1 := List( arg3_1, AsList );
- return CreateCapCategoryObjectWithAttributes( cat_1, Length, Length( Filtered( [ 0 .. Length( arg2_1 ) - 1 ], function ( x_2 )
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, Length( Filtered( [ 0 .. Length( arg2_1 ) - 1 ], function ( i_2 )
local deduped_1_2;
- deduped_1_2 := 1 + x_2;
+ deduped_1_2 := 1 + i_2;
return ForAll( hoisted_2_1, function ( j_3 )
return deduped_1_1[j_3][deduped_1_2] = deduped_1_1[j_3 + 1][deduped_1_2];
end );
@@ -300,27 +299,21 @@ end
########
function ( cat_1, s_1, alpha_1, beta_1, r_1 )
- local hoisted_2_1, hoisted_3_1, hoisted_4_1, hoisted_5_1, hoisted_6_1, deduped_7_1, deduped_8_1;
- deduped_8_1 := Length( Range( alpha_1 ) );
- deduped_7_1 := Length( Source( beta_1 ) );
- hoisted_6_1 := [ 0 .. Length( Source( alpha_1 ) ) - 1 ];
- hoisted_5_1 := Length( Range( beta_1 ) );
- hoisted_4_1 := AsList( beta_1 );
- hoisted_3_1 := AsList( alpha_1 );
- hoisted_2_1 := [ 0 .. deduped_8_1 - 1 ];
- return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, r_1, AsList, List( [ 0 .. deduped_7_1 ^ deduped_8_1 - 1 ], function ( i_2 )
- local hoisted_1_2;
- hoisted_1_2 := List( hoisted_2_1, function ( i_3 )
- return REM_INT( QUO_INT( i_2, deduped_7_1 ^ i_3 ), deduped_7_1 );
- end );
- return Sum( List( hoisted_6_1, function ( k_3 )
- return hoisted_4_1[(1 + hoisted_1_2[(1 + hoisted_3_1[(1 + CAP_JIT_INCOMPLETE_LOGIC( k_3 ))])])] * hoisted_5_1 ^ k_3;
+ local hoisted_1_1, deduped_2_1, hoisted_3_1, hoisted_4_1, hoisted_5_1;
+ hoisted_5_1 := [ 0 .. Length( Source( alpha_1 ) ) - 1 ];
+ hoisted_4_1 := Length( Range( beta_1 ) );
+ hoisted_3_1 := AsList( beta_1 );
+ deduped_2_1 := Length( Source( beta_1 ) );
+ hoisted_1_1 := AsList( alpha_1 );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, s_1, r_1, AsList, List( [ 0 .. Length( s_1 ) - 1 ], function ( i_2 )
+ return Sum( List( hoisted_5_1, function ( k_3 )
+ return hoisted_3_1[(1 + REM_INT( QUO_INT( i_2, deduped_2_1 ^ hoisted_1_1[(1 + k_3)] ), deduped_2_1 ))] * hoisted_4_1 ^ k_3;
end ) );
end ) );
end
########
- , 1003 );
+ , 100 );
##
AddExponentialOnObjects( cat,
@@ -349,7 +342,7 @@ end
########
function ( cat_1, alpha_1, I_1 )
- return CreateCapCategoryMorphismWithAttributes( cat_1, I_1, Range( alpha_1 ), AsList, SSortedList( AsList( alpha_1 ) ) );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, I_1, Range( alpha_1 ), AsList, SSortedList( AsList( alpha_1 ) ){[ 1 .. Length( I_1 ) ]} );
end
########
@@ -478,18 +471,18 @@ end
########
function ( cat_1, arg2_1, arg3_1 )
- local deduped_2_1, deduped_3_1;
- deduped_3_1 := AsList( arg3_1 );
+ local hoisted_1_1, deduped_2_1;
deduped_2_1 := AsList( arg2_1 );
+ hoisted_1_1 := AsList( arg3_1 );
return ForAll( IdFunc( function ( )
- if 100 * Length( deduped_2_1 ) < Length( deduped_3_1 ) then
+ if 100 * Length( Source( arg2_1 ) ) < Length( Source( arg3_1 ) ) then
return SSortedList( deduped_2_1 );
else
return deduped_2_1;
fi;
return;
end )( ), function ( y_2 )
- return y_2 in deduped_3_1;
+ return y_2 in hoisted_1_1;
end );
end
########
@@ -558,17 +551,15 @@ end
########
function ( cat_1, arg2_1 )
- local hoisted_1_1, deduped_2_1;
- deduped_2_1 := AsList( arg2_1 );
- hoisted_1_1 := Length( Range( arg2_1 ) );
- if not ForAll( deduped_2_1, function ( a_2 )
- return (IsBigInt( a_2 ) and a_2 >= 0);
- end ) then
- return false;
- elif Length( Source( arg2_1 ) ) <> Length( deduped_2_1 ) then
- return false;
- elif not ForAll( deduped_2_1, function ( a_2 )
- return a_2 < hoisted_1_1;
+ local hoisted_1_1, hoisted_3_1, deduped_4_1;
+ deduped_4_1 := AsList( arg2_1 );
+ hoisted_3_1 := Length( Range( arg2_1 ) );
+ hoisted_1_1 := List( deduped_4_1, IsBigInt );
+ if not ForAll( [ 0 .. Length( Source( arg2_1 ) ) - 1 ], function ( x_2 )
+ local deduped_1_2, deduped_2_2;
+ deduped_2_2 := 1 + x_2;
+ deduped_1_2 := deduped_4_1[deduped_2_2];
+ return (hoisted_1_1[deduped_2_2] and deduped_1_2 >= 0 and deduped_1_2 < hoisted_3_1);
end ) then
return false;
else
@@ -738,77 +729,137 @@ end
########
function ( cat_1, l_1, m_1 )
- local deduped_3_1, deduped_5_1, hoisted_6_1, deduped_8_1, hoisted_10_1, hoisted_13_1, hoisted_15_1, hoisted_16_1, hoisted_17_1, hoisted_18_1, deduped_20_1, deduped_21_1, deduped_22_1, deduped_23_1, deduped_24_1, deduped_25_1, deduped_26_1, deduped_27_1, deduped_28_1, deduped_29_1, deduped_30_1, deduped_31_1, deduped_32_1, deduped_33_1, deduped_34_1, deduped_35_1, deduped_36_1;
- deduped_36_1 := BigInt( 1 );
- deduped_35_1 := BigInt( 0 );
- deduped_34_1 := Range( m_1 );
- deduped_33_1 := Length( Source( l_1 ) );
- deduped_32_1 := Length( Source( m_1 ) );
- deduped_31_1 := Length( deduped_34_1 );
- deduped_30_1 := [ 0 .. deduped_31_1 - 1 ];
- deduped_29_1 := [ 0 .. deduped_32_1 * deduped_33_1 - 1 ];
- deduped_28_1 := [ 0 .. deduped_32_1 * deduped_32_1 - 1 ];
- deduped_3_1 := List( deduped_28_1, function ( i_2 )
- return REM_INT( i_2, deduped_32_1 );
- end );
- deduped_27_1 := Filtered( deduped_28_1, function ( x_2 )
- return deduped_3_1[1 + x_2] = REM_INT( QUO_INT( CAP_JIT_INCOMPLETE_LOGIC( x_2 ), deduped_32_1 ), deduped_32_1 );
+ local deduped_3_1, hoisted_4_1, hoisted_5_1, deduped_6_1, deduped_7_1, hoisted_8_1, deduped_10_1, hoisted_12_1, deduped_13_1, hoisted_15_1, hoisted_16_1, hoisted_17_1, hoisted_18_1, hoisted_19_1, hoisted_20_1, hoisted_22_1, hoisted_23_1, deduped_24_1, hoisted_25_1, deduped_26_1, deduped_27_1, deduped_28_1, deduped_29_1, deduped_30_1, deduped_31_1, deduped_32_1, deduped_33_1, deduped_34_1, deduped_35_1, deduped_36_1, deduped_37_1, deduped_38_1, deduped_39_1, deduped_40_1, deduped_41_1, deduped_42_1, deduped_43_1, deduped_44_1, deduped_45_1, deduped_46_1, deduped_47_1, deduped_48_1, deduped_49_1, deduped_50_1, deduped_51_1, deduped_52_1, deduped_53_1, deduped_54_1, deduped_55_1, deduped_56_1, deduped_57_1;
+ deduped_57_1 := BigInt( 3 );
+ deduped_56_1 := BigInt( 2 );
+ deduped_55_1 := BigInt( 1 );
+ deduped_54_1 := BigInt( 0 );
+ deduped_53_1 := Range( m_1 );
+ deduped_52_1 := Length( Source( l_1 ) );
+ deduped_51_1 := Length( Source( m_1 ) );
+ deduped_50_1 := Length( deduped_53_1 );
+ deduped_49_1 := [ deduped_54_1, deduped_56_1, deduped_57_1 ]{[ 1, 2, 3 ]};
+ deduped_48_1 := [ 0 .. deduped_50_1 - 1 ];
+ deduped_47_1 := [ 0 .. deduped_51_1 * deduped_52_1 - 1 ];
+ deduped_46_1 := [ 0 .. deduped_51_1 * deduped_51_1 - 1 ];
+ deduped_3_1 := List( deduped_46_1, function ( i_2 )
+ return REM_INT( i_2, deduped_51_1 );
end );
- hoisted_10_1 := AsList( l_1 );
- deduped_8_1 := List( deduped_29_1, function ( i_2 )
- return REM_INT( i_2, deduped_32_1 );
+ deduped_45_1 := Filtered( deduped_46_1, function ( x_2 )
+ return deduped_3_1[1 + x_2] = REM_INT( QUO_INT( CAP_JIT_INCOMPLETE_LOGIC( x_2 ), deduped_51_1 ), deduped_51_1 );
end );
- deduped_26_1 := Filtered( deduped_29_1, function ( x_2 )
- return deduped_8_1[1 + x_2] = hoisted_10_1[1 + REM_INT( QUO_INT( CAP_JIT_INCOMPLETE_LOGIC( x_2 ), deduped_32_1 ), deduped_33_1 )];
+ deduped_44_1 := Length( deduped_45_1 );
+ deduped_43_1 := [ 1 .. deduped_44_1 ];
+ hoisted_12_1 := AsList( l_1 );
+ deduped_10_1 := List( deduped_47_1, function ( i_2 )
+ return REM_INT( i_2, deduped_51_1 );
end );
- deduped_25_1 := Length( deduped_26_1 );
- deduped_24_1 := [ 0 .. deduped_25_1 - 1 ];
- hoisted_13_1 := List( deduped_24_1, function ( i_2 )
- return REM_INT( QUO_INT( CAP_JIT_INCOMPLETE_LOGIC( deduped_26_1[1 + i_2] ), deduped_32_1 ), deduped_33_1 );
+ deduped_42_1 := Filtered( deduped_47_1, function ( x_2 )
+ return deduped_10_1[1 + x_2] = hoisted_12_1[1 + REM_INT( QUO_INT( CAP_JIT_INCOMPLETE_LOGIC( x_2 ), deduped_51_1 ), deduped_52_1 )];
end );
- deduped_23_1 := Filtered( [ 0 .. deduped_25_1 * deduped_33_1 - 1 ], function ( x_2 )
+ deduped_41_1 := [ 0 .. deduped_44_1 - 1 ];
+ deduped_40_1 := Length( deduped_42_1 );
+ deduped_39_1 := [ 1 .. deduped_40_1 ];
+ deduped_38_1 := [ 0 .. deduped_40_1 - 1 ];
+ deduped_7_1 := deduped_50_1 * deduped_54_1;
+ deduped_6_1 := AsList( m_1 );
+ hoisted_4_1 := deduped_45_1{deduped_43_1};
+ hoisted_5_1 := List( deduped_41_1, function ( i_2 )
+ return deduped_3_1[1 + hoisted_4_1[(1 + i_2)]];
+ end ){deduped_43_1};
+ deduped_37_1 := SSortedList( List( deduped_41_1, function ( i_2 )
+ return deduped_6_1[1 + hoisted_5_1[(1 + CAP_JIT_INCOMPLETE_LOGIC( i_2 ))]] + deduped_7_1;
+ end ) );
+ deduped_13_1 := deduped_42_1{deduped_39_1};
+ hoisted_15_1 := (List( deduped_38_1, function ( i_2 )
+ return REM_INT( QUO_INT( CAP_JIT_INCOMPLETE_LOGIC( deduped_13_1[1 + i_2] ), deduped_51_1 ), deduped_52_1 );
+ end ){deduped_39_1}){deduped_39_1};
+ deduped_36_1 := Filtered( [ 0 .. deduped_40_1 * deduped_52_1 - 1 ], function ( x_2 )
local deduped_1_2;
deduped_1_2 := CAP_JIT_INCOMPLETE_LOGIC( x_2 );
- return hoisted_13_1[1 + REM_INT( deduped_1_2, deduped_25_1 )] = REM_INT( QUO_INT( deduped_1_2, deduped_25_1 ), deduped_33_1 );
- end );
- hoisted_18_1 := [ deduped_36_1, deduped_35_1, deduped_36_1, deduped_36_1 ];
- hoisted_17_1 := BigInt( 2 );
- deduped_5_1 := AsList( m_1 );
- hoisted_15_1 := List( deduped_24_1, function ( i_2 )
- return deduped_5_1[1 + deduped_8_1[(1 + deduped_26_1[(1 + i_2)])]];
+ return hoisted_15_1[1 + REM_INT( deduped_1_2, deduped_40_1 )] = REM_INT( QUO_INT( deduped_1_2, deduped_40_1 ), deduped_52_1 );
end );
- hoisted_16_1 := List( [ 0 .. Length( deduped_23_1 ) - 1 ], function ( i_2 )
- return hoisted_15_1[1 + REM_INT( CAP_JIT_INCOMPLETE_LOGIC( deduped_23_1[(1 + i_2)] ), deduped_25_1 )];
+ deduped_34_1 := Length( deduped_36_1 );
+ deduped_33_1 := [ 1 .. deduped_34_1 ];
+ deduped_30_1 := [ 0 .. deduped_34_1 - 1 ];
+ hoisted_16_1 := List( deduped_38_1, function ( i_2 )
+ return deduped_10_1[1 + deduped_13_1[(1 + i_2)]];
+ end ){deduped_39_1};
+ hoisted_19_1 := List( deduped_38_1, function ( i_2 )
+ return deduped_6_1[1 + hoisted_16_1[(1 + i_2)]];
end );
- hoisted_6_1 := List( [ 0 .. Length( deduped_27_1 ) - 1 ], function ( i_2 )
- return deduped_5_1[1 + deduped_3_1[(1 + deduped_27_1[(1 + i_2)])]];
- end );
- deduped_22_1 := Filtered( deduped_30_1, function ( x_2 )
+ hoisted_17_1 := deduped_36_1{deduped_33_1};
+ hoisted_18_1 := List( deduped_30_1, function ( i_2 )
+ return REM_INT( CAP_JIT_INCOMPLETE_LOGIC( hoisted_17_1[1 + i_2] ), deduped_40_1 );
+ end ){deduped_33_1};
+ deduped_28_1 := SSortedList( List( deduped_30_1, function ( i_2 )
+ return hoisted_19_1[1 + hoisted_18_1[(1 + CAP_JIT_INCOMPLETE_LOGIC( i_2 ))]] + deduped_7_1;
+ end ) );
+ hoisted_22_1 := [ IdFunc( function ( )
+ if deduped_54_1 in deduped_49_1 then
+ return deduped_55_1;
+ else
+ return deduped_54_1;
+ fi;
+ return;
+ end )( ), IdFunc( function ( )
+ if deduped_55_1 in deduped_49_1 then
+ return deduped_55_1;
+ else
+ return deduped_54_1;
+ fi;
+ return;
+ end )( ), IdFunc( function ( )
+ if deduped_56_1 in deduped_49_1 then
+ return deduped_55_1;
+ else
+ return deduped_54_1;
+ fi;
+ return;
+ end )( ), IdFunc( function ( )
+ if deduped_57_1 in deduped_49_1 then
+ return deduped_55_1;
+ else
+ return deduped_54_1;
+ fi;
+ return;
+ end )( ) ];
+ hoisted_20_1 := deduped_28_1{[ 1 .. BigInt( Length( deduped_28_1 ) ) ]};
+ hoisted_8_1 := deduped_37_1{[ 1 .. BigInt( Length( deduped_37_1 ) ) ]};
+ deduped_35_1 := Filtered( deduped_48_1, function ( i_2 )
local deduped_1_2;
- deduped_1_2 := CAP_JIT_INCOMPLETE_LOGIC( REM_INT( CAP_JIT_INCOMPLETE_LOGIC( x_2 ), deduped_31_1 ) );
- return hoisted_18_1[1 + (IdFunc( function ( )
- if (deduped_1_2 in hoisted_6_1) then
- return deduped_36_1;
+ deduped_1_2 := CAP_JIT_INCOMPLETE_LOGIC( REM_INT( CAP_JIT_INCOMPLETE_LOGIC( i_2 ), deduped_50_1 ) );
+ return hoisted_22_1[1 + (IdFunc( function ( )
+ if (deduped_1_2 in hoisted_8_1) then
+ return deduped_55_1;
else
- return deduped_35_1;
+ return deduped_54_1;
fi;
return;
- end )( ) + IdFunc( function ( )
- if (deduped_1_2 in hoisted_16_1) then
- return deduped_36_1;
+ end )( ) + deduped_56_1 * IdFunc( function ( )
+ if (deduped_1_2 in hoisted_20_1) then
+ return deduped_55_1;
else
- return deduped_35_1;
+ return deduped_54_1;
fi;
return;
- end )( ) * hoisted_17_1)] = deduped_36_1;
+ end )( ))] = deduped_55_1;
end );
- deduped_20_1 := List( deduped_30_1, function ( i_2 )
- return REM_INT( i_2, deduped_31_1 );
+ deduped_32_1 := Length( deduped_35_1 );
+ deduped_31_1 := [ 1 .. deduped_32_1 ];
+ deduped_29_1 := [ 0 .. deduped_32_1 - 1 ];
+ deduped_24_1 := List( deduped_48_1, function ( i_2 )
+ return REM_INT( i_2, deduped_50_1 );
end );
- deduped_21_1 := SSortedList( List( [ 0 .. Length( deduped_22_1 ) - 1 ], function ( i_2 )
- return deduped_20_1[1 + deduped_20_1[(1 + deduped_22_1[(1 + i_2)])]];
+ hoisted_23_1 := deduped_35_1{deduped_31_1};
+ hoisted_25_1 := List( deduped_29_1, function ( i_2 )
+ return deduped_24_1[1 + hoisted_23_1[(1 + i_2)]];
+ end ){deduped_31_1};
+ deduped_27_1 := SSortedList( List( deduped_29_1, function ( i_2 )
+ return deduped_24_1[1 + hoisted_25_1[(1 + i_2)]];
end ) );
- return CreateCapCategoryMorphismWithAttributes( cat_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( Length( deduped_21_1 ) ) ), deduped_34_1, AsList, deduped_21_1 );
+ deduped_26_1 := BigInt( Length( deduped_27_1 ) );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, deduped_26_1 ), deduped_53_1, AsList, deduped_27_1{[ 1 .. deduped_26_1 ]} );
end
########
@@ -819,12 +870,16 @@ end
########
function ( cat_1, arg2_1 )
- if Length( arg2_1 ) = 0 then
- return CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( 1 ) );
- else
- return arg2_1;
- fi;
- return;
+ local deduped_1_1;
+ deduped_1_1 := Length( arg2_1 );
+ return CreateCapCategoryObjectWithAttributes( cat_1, Length, IdFunc( function ( )
+ if deduped_1_1 = 0 then
+ return BigInt( 1 );
+ else
+ return deduped_1_1;
+ fi;
+ return;
+ end )( ) );
end
########
@@ -881,7 +936,7 @@ end
########
function ( cat_1, T_1, P_1 )
- return CreateCapCategoryMorphismWithAttributes( cat_1, P_1, T_1, AsList, [ ] );
+ return CreateCapCategoryMorphismWithAttributes( cat_1, P_1, T_1, AsList, [ 0 .. Length( P_1 ) - 1 ] );
end
########
@@ -894,18 +949,18 @@ end
function ( cat_1, objects_1, T_1, tau_1, P_1 )
local hoisted_1_1, hoisted_2_1, hoisted_3_1, deduped_5_1;
deduped_5_1 := [ 0 .. Length( objects_1 ) - 1 ];
- hoisted_2_1 := List( objects_1, Length );
- hoisted_3_1 := List( deduped_5_1, function ( j_2 )
- return Product( hoisted_2_1{[ 1 .. j_2 ]} );
+ hoisted_3_1 := List( tau_1, AsList );
+ hoisted_1_1 := List( objects_1, Length );
+ hoisted_2_1 := List( deduped_5_1, function ( j_2 )
+ return Product( hoisted_1_1{[ 1 .. j_2 ]} );
end );
- hoisted_1_1 := List( tau_1, AsList );
return CreateCapCategoryMorphismWithAttributes( cat_1, T_1, P_1, AsList, List( [ 0 .. Length( T_1 ) - 1 ], function ( i_2 )
local hoisted_1_2;
hoisted_1_2 := 1 + i_2;
return Sum( deduped_5_1, function ( j_3 )
local deduped_1_3;
deduped_1_3 := 1 + j_3;
- return hoisted_1_1[deduped_1_3][hoisted_1_2] * hoisted_3_1[deduped_1_3];
+ return hoisted_2_1[deduped_1_3] * hoisted_3_1[deduped_1_3][hoisted_1_2];
end );
end ) );
end
@@ -966,7 +1021,7 @@ BindGlobal( "CategoryOfSkeletalFinSetsWithMorphismsGivenByListsPrecompiled", fun
function ( )
- return CategoryOfSkeletalFinSets( );
+ return CategoryOfSkeletalFinSetsWithMorphismsGivenByLists( );
end;
diff --git a/init.g b/init.g
index 8cffd4b3..52481bfe 100644
--- a/init.g
+++ b/init.g
@@ -10,6 +10,8 @@ ReadPackage( "FinSetsForCAP", "gap/FinSets.gd" );
ReadPackage( "FinSetsForCAP", "gap/SkeletalFinSets.gd" );
+ReadPackage( "FinSetsForCAP", "gap/SkeletalFinSetsEager.gd" );
+
#= comment for Julia
if IsPackageMarkedForLoading( "JuliaInterface", ">= 0.2" ) then
# COVERAGE_IGNORE_NEXT_LINE
diff --git a/read.g b/read.g
index ee84fd69..dc35118c 100644
--- a/read.g
+++ b/read.g
@@ -8,10 +8,14 @@ ReadPackage( "FinSetsForCAP", "gap/Tools.gi" );
ReadPackage( "FinSetsForCAP", "gap/precompiled_categories/CategoryOfSkeletalFinSetsWithMorphismsGivenByListsPrecompiled.gi" );
+ReadPackage( "FinSetsForCAP", "gap/precompiled_categories/CategoryOfSkeletalFinSetsWithMorphismsGivenByFunctionsPrecompiled.gi" );
+
ReadPackage( "FinSetsForCAP", "gap/FinSets.gi" );
ReadPackage( "FinSetsForCAP", "gap/SkeletalFinSets.gi" );
+ReadPackage( "FinSetsForCAP", "gap/SkeletalFinSetsEager.gi" );
+
#= comment for Julia
if IsPackageMarkedForLoading( "JuliaInterface", ">= 0.2" ) then
# COVERAGE_IGNORE_NEXT_LINE