Skip to content

Commit

Permalink
LinearClosure can now use a custom CategoryOfRows as range of HomStru…
Browse files Browse the repository at this point in the history
…cture
  • Loading branch information
mohamed-barakat committed Nov 25, 2023
1 parent ca60eed commit 5a24a63
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 10 deletions.
2 changes: 1 addition & 1 deletion FreydCategoriesForCAP/PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "FreydCategoriesForCAP",
Subtitle := "Freyd categories - Formal (co)kernels for additive categories",
Version := "2023.11-02",
Version := "2023.11-03",
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
License := "GPL-2.0-or-later",

Expand Down
14 changes: 14 additions & 0 deletions FreydCategoriesForCAP/gap/LinearClosure.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ DeclareCategory( "IsLinearClosureMorphism",
DeclareCategory( "IsLinearClosure",
IsCapCategory );

DeclareGlobalFunction( "LINEAR_CLOSURE_CONSTRUCTOR_USING_CategoryOfRows" );

DeclareGlobalFunction( "LINEAR_CLOSURE_CONSTRUCTOR" );

DeclareGlobalFunction( "LINEAR_CLOSURE_MORPHISM_SIMPLIFY" );
Expand All @@ -33,12 +35,24 @@ DeclareGlobalFunction( "INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE" );
##
####################################

DeclareOperation( "TwistedLinearClosure",
[ IsCategoryOfRows, IsCapCategory, IsFunction, IsFunction ] );

DeclareOperation( "TwistedLinearClosure",
[ IsCategoryOfRows, IsCapCategory, IsFunction ] );

DeclareOperation( "TwistedLinearClosure",
[ IsHomalgRing, IsCapCategory, IsFunction, IsFunction ] );

DeclareOperation( "TwistedLinearClosure",
[ IsHomalgRing, IsCapCategory, IsFunction ] );

DeclareOperation( "LinearClosure",
[ IsCategoryOfRows, IsCapCategory ] );

DeclareOperation( "LinearClosure",
[ IsCategoryOfRows, IsCapCategory, IsFunction ] );

DeclareOperation( "LinearClosure",
[ IsHomalgRing, IsCapCategory ] );

Expand Down
87 changes: 78 additions & 9 deletions FreydCategoriesForCAP/gap/LinearClosure.gi
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
####################################

##
InstallGlobalFunction( LINEAR_CLOSURE_CONSTRUCTOR,
function( ring, underlying_category, arg... )
local name, category, is_finite, sorting_function, with_nf, cocycle;
InstallGlobalFunction( LINEAR_CLOSURE_CONSTRUCTOR_USING_CategoryOfRows,
function( rows, underlying_category, arg... ) ## rows = CategoryOfRows( ... )
local ring, name, category, is_finite, sorting_function, with_nf, cocycle;

ring := UnderlyingRing( rows );

if not ( HasIsCommutative( ring ) and IsCommutative( ring ) ) then

Expand Down Expand Up @@ -87,14 +89,26 @@ InstallGlobalFunction( LINEAR_CLOSURE_CONSTRUCTOR,

SetUnderlyingCategory( category, underlying_category );

INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE( category );
INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE( rows, category );

Finalize( category );

return category;

end );

##
InstallGlobalFunction( LINEAR_CLOSURE_CONSTRUCTOR,
function( ring, underlying_category, arg... )
local rows;

rows := CategoryOfRows( ring : overhead := false, FinalizeCategory := true );

return CallFuncList( LINEAR_CLOSURE_CONSTRUCTOR_USING_CategoryOfRows,
Concatenation( [ rows, underlying_category ], arg ) );

end );

## sorting_function:
## compares two morphisms alpha: a -> b, beta: a -> b
## such that, if we take the quotient by IsCongruentForMorphisms, we get a total ordering on morphisms
Expand Down Expand Up @@ -150,6 +164,59 @@ InstallMethod( TwistedLinearClosure,

end );

##
InstallMethod( LinearClosure,
[ IsCategoryOfRows, IsCapCategory, IsFunction ],
LINEAR_CLOSURE_CONSTRUCTOR_USING_CategoryOfRows );

##
InstallMethod( LinearClosure,
[ IsCategoryOfRows, IsCapCategory ],
LINEAR_CLOSURE_CONSTRUCTOR_USING_CategoryOfRows );

##
InstallMethod( TwistedLinearClosure,
[ IsCategoryOfRows, IsCapCategory, IsFunction ],
function( rows, category, cocycle )

return LINEAR_CLOSURE_CONSTRUCTOR_USING_CategoryOfRows( rows, category, cocycle, false );

end );

##
InstallMethod( TwistedLinearClosure,
[ IsCategoryOfRows, IsCapCategory, IsFunction, IsFunction ],
function( rows, category, cocycle, sorting_function )

return LINEAR_CLOSURE_CONSTRUCTOR_USING_CategoryOfRows( rows, category, cocycle, true, sorting_function );

end );

## Special cases for groups
##
InstallMethod( LinearClosure,
[ IsCategoryOfRows, IsGroupAsCategory ],
function( rows, group_as_category )
local compare_func;

compare_func := function( g, h ) return UnderlyingGroupElement( g ) < UnderlyingGroupElement( h ); end;;

return LinearClosure( rows, group_as_category, compare_func );

end );

##
InstallMethod( TwistedLinearClosure,
[ IsCategoryOfRows, IsGroupAsCategory, IsFunction ],
function( rows, category, cocycle )
local compare_func;

compare_func := function( g, h ) return UnderlyingGroupElement( g ) < UnderlyingGroupElement( h ); end;;

return LINEAR_CLOSURE_CONSTRUCTOR_USING_CategoryOfRows( rows, category, cocycle, true, compare_func );

end );

##
InstallMethodForCompilerForCAP( LinearClosureObject,
[ IsLinearClosure, IsCapCategoryObject ],
Expand Down Expand Up @@ -364,9 +431,13 @@ end );


InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
function( category )
local ring, underlying_category, sorting_function, mul_coeffs, mul_supp, with_nf,
equality_func, finsets, rows, t_obj, t_finsets, FunctorMor, FunctorObj, cocycle;
function( rows, category )
local ring, underlying_category, sorting_function, mul_coeffs, mul_supp, with_nf,
equality_func, finsets, t_obj, t_finsets, FunctorMor, FunctorObj, cocycle;

if not IsCategoryOfRows( rows ) then
Error( "the second argument `rows` must be a category of rows\n" );
fi;

ring := UnderlyingRing( category );

Expand Down Expand Up @@ -684,8 +755,6 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
then

finsets := RangeCategoryOfHomomorphismStructure( underlying_category );

rows := CategoryOfRows( ring : overhead := false, FinalizeCategory := true );

SetRangeCategoryOfHomomorphismStructure( category, rows );
SetIsEquippedWithHomomorphismStructure( category, true );
Expand Down

0 comments on commit 5a24a63

Please sign in to comment.