From 4b9fec1ae83c5f59a531089cbfee802c7ad0acab Mon Sep 17 00:00:00 2001 From: Mohamed Barakat Date: Fri, 24 Feb 2023 14:43:05 +0100 Subject: [PATCH] first implementation of the standard category --- PackageInfo.g | 11 +- examples/.gitkeep | 1 - examples/StandardCategory.g | 89 ++++++++++++ gap/StandardCategory.gd | 72 ++++++++++ gap/StandardCategory.gi | 272 ++++++++++++++++++++++++++++++++++++ gap/obsolete.g | 43 ++++++ 6 files changed, 482 insertions(+), 6 deletions(-) delete mode 100644 examples/.gitkeep create mode 100644 examples/StandardCategory.g create mode 100644 gap/obsolete.g diff --git a/PackageInfo.g b/PackageInfo.g index 6c2a713..7b44b67 100644 --- a/PackageInfo.g +++ b/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "HeckeCategories", Subtitle := "Categorification of Hecke algebras", -Version := "2023.02-01", +Version := "2023.02-02", Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ), License := "GPL-2.0-or-later", @@ -103,10 +103,11 @@ PackageDoc := rec( Dependencies := rec( GAP := ">= 4.12.1", NeededOtherPackages := [ - [ "CAP", ">= 2023.02-09" ], - [ "MonoidalCategories", ">= 2023.02-04" ], - [ "FreydCategoriesForCAP", ">= 2023.02-01" ], - ], + [ "RingsForHomalg", ">= 2023.02-02" ], + [ "CAP", ">= 2023.02-09" ], + [ "MonoidalCategories", ">= 2023.02-04" ], + [ "FreydCategoriesForCAP", ">= 2023.02-01" ], + ], SuggestedOtherPackages := [ ], ExternalConditions := [ ], ), diff --git a/examples/.gitkeep b/examples/.gitkeep deleted file mode 100644 index 8b13789..0000000 --- a/examples/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/examples/StandardCategory.g b/examples/StandardCategory.g new file mode 100644 index 0000000..85749ab --- /dev/null +++ b/examples/StandardCategory.g @@ -0,0 +1,89 @@ +#! @Chunk StandardCategory + +#! @Example +LoadPackage( "HeckeCategories" ); +#! true +W := Group( [[0,1,0],[1,0,0],[0,0,1]], [[1,0,0],[0,0,1],[0,1,0]] ); +#! Group([ [ [ 0, 1, 0 ], [ 1, 0, 0 ], [ 0, 0, 1 ] ], +#! [ [ 1, 0, 0 ], [ 0, 0, 1 ], [ 0, 1, 0 ] ] ]) +k := HomalgFieldOfRationalsInSingular( ); +#! Q +Std := StandardCategory( W, k ); +#! StandardCategory( W, Q ) +Display( Std ); +#! A CAP category with name StandardCategory( W, Q ): +#! +#! 20 primitive operations were used to derive 79 operations for this category +#! which algorithmically +#! * IsEquippedWithHomomorphismStructure +#! * IsLinearCategoryOverCommutativeRing +#! * IsMonoidalCategory +#! and furthermore mathematically +#! * IsStrictMonoidalCategory +R := UnderlyingRing( Std ); +#! Q[a1,a2,a3] +ExportVariables( R ); +#! [ a1, a2, a3 ] +x := [[0,1,0],[1,0,0],[0,0,1]]; +#! [ [ 0, 1, 0 ], [ 1, 0, 0 ], [ 0, 0, 1 ] ] +rx := x / Std; +#! +IsWellDefined( rx ); +#! true +Display( rx ); +#! [ [ 0, 1, 0 ], +#! [ 1, 0, 0 ], +#! [ 0, 0, 1 ] ] +y := [[1,0,0],[0,0,1],[0,1,0]]; +#! [ [ 1, 0, 0 ], [ 0, 0, 1 ], [ 0, 1, 0 ] ] +ry := y / Std; +#! +rx = ry; +#! false +z := [ [ 0, 1, 0 ], [ 1, 0, 0 ], [ 0, 0, 2 ] ]; +#! [ [ 0, 1, 0 ], [ 1, 0, 0 ], [ 0, 0, 2 ] ] +IsWellDefined( z / Std ); +#! false +rxy := TensorProduct( rx, ry ); +#! +Display( rxy ); +#! [ [ 0, 0, 1 ], +#! [ 1, 0, 0 ], +#! [ 0, 1, 0 ] ] +id_x := IdentityMorphism( rx ); +#! +Display( id_x ); +#! 1 +phi_x := MorphismConstructor( rx, a1 * a2, rx ); +#! +IsWellDefined( phi_x ); +#! true +Display( phi_x ); +#! a1*a2 +IsOne( phi_x ); +#! false +psi_x := MorphismConstructor( rx, a2 * a1, rx ); +#! +phi_x = psi_x; +#! true +Display( PreCompose( phi_x, psi_x ) ); +#! a1^2*a2^2 +phi_y := MorphismConstructor( ry, a2 * a3, ry ); +#! +phi_x = phi_y; +#! false +zeta_xy := ZeroMorphism( rx, ry ); +#! +Display( zeta_xy ); +#! 0 +zeta_xy = MorphismConstructor( rx, a1*a2, ry ); +#! true +eta_x := a3 * phi_x; +#! +Display( eta_x ); +#! a1*a2*a3 +chi_xy := TensorProduct( phi_x, phi_y ); +#! +Display( chi_xy ); +#! a1^2*a2*a3 +#! @EndExample diff --git a/gap/StandardCategory.gd b/gap/StandardCategory.gd index 4fc09d3..0f88d5d 100644 --- a/gap/StandardCategory.gd +++ b/gap/StandardCategory.gd @@ -6,3 +6,75 @@ #! @Chapter The standard category +#################################### +# +#! @Section GAP categories +# +#################################### + +#! @Description +#! The ⪆ category of standard categories. +DeclareCategory( "IsStandardCategory", + IsCapCategory ); + +#! @Description +#! The ⪆ category of cells in a standard category. +DeclareCategory( "IsCellInStandardCategory", + IsCapCategoryCell ); + +#! @Description +#! The ⪆ category of objects in a standard category. +DeclareCategory( "IsObjectInStandardCategory", + IsCellInStandardCategory and IsCapCategoryObject ); + +#! @Description +#! The ⪆ category of morphisms in a standard category. +DeclareCategory( "IsMorphismInStandardCategory", + IsCellInStandardCategory and IsCapCategoryMorphism ); + +#################################### +# +#! @Section Constructors +# +#################################### + +#! @Description +#! Return the standard category over the commutative base ring k. +#! @Arguments W, k +DeclareOperation( "StandardCategory", + [ IsGroup, IsHomalgRing ] ); +#! @InsertChunk StandardCategory + +#################################### +# +#! @Section Attributes +# +#################################### + +#! +DeclareAttribute( "UnderlyingMatrixGroup", + IsStandardCategory ); + +#! +DeclareAttribute( "UnderlyingRing", + IsStandardCategory ); + +CapJitAddTypeSignature( "UnderlyingRing", [ IsStandardCategory ], IsHomalgRing ); + +#! +DeclareAttribute( "UnderlyingTwistingRingMap", + IsStandardCategory ); + +CapJitAddTypeSignature( "UnderlyingTwistingRingMap", [ IsStandardCategory ], IsHomalgRingMap ); + +#! +DeclareAttribute( "MatrixGroupElement", + IsObjectInStandardCategory ); + +CapJitAddTypeSignature( "MatrixGroupElement", [ IsObjectInStandardCategory ], IsMatrixGroup ); + +#! +DeclareAttribute( "UnderlyingRingElement", + IsMorphismInStandardCategory ); + +CapJitAddTypeSignature( "UnderlyingRingElement", [ IsMorphismInStandardCategory ], IsHomalgRingElement ); diff --git a/gap/StandardCategory.gi b/gap/StandardCategory.gi index edf5106..ca34fd1 100644 --- a/gap/StandardCategory.gi +++ b/gap/StandardCategory.gi @@ -4,3 +4,275 @@ # Implementations # +InstallMethodWithCache( StandardCategory, + "for a matrix group and a homalg ring", + [ IsMatrixGroup, IsHomalgRing ], + + function( W, k ) + local d, vars_a, R, phi, name, Std, V; + + d := Rank( One( W ) ); + + vars_a := Concatenation( "a1..", String( d ) ); + + R := k[vars_a]; + + phi := + function( w ) + + return RingMap( w * Indeterminates( R ), R, R ); + + end; + + if HasName( W ) then + name := Name( W ); + else + name := "W"; + fi; + + name := Concatenation( "StandardCategory( ", name, ", ", RingName( k ), " )" ); + + Std := CreateCapCategory( name, + IsStandardCategory, + IsObjectInStandardCategory, + IsMorphismInStandardCategory, + IsCapCategoryTwoCell ); + + SetUnderlyingMatrixGroup( Std, W ); + SetUnderlyingRing( Std, R ); + SetUnderlyingTwistingRingMap( Std, phi ); + + Std!.category_as_first_argument := true; + + V := CategoryOfRows( R ); + + SetIsAbCategory( Std, true ); + SetIsLinearCategoryOverCommutativeRing( Std, true ); + SetCommutativeRingOfLinearCategory( Std, R ); + + SetRangeCategoryOfHomomorphismStructure( Std, V ); + SetIsEquippedWithHomomorphismStructure( Std, true ); + + SetIsStrictMonoidalCategory( Std, true ); + + AddObjectConstructor( Std, + function( cat, w ) + + return CreateCapCategoryObjectWithAttributes( cat, + MatrixGroupElement, w ); + + end ); + + AddObjectDatum( Std, + function( cat, obj ) + + return MatrixGroupElement( obj ); + + end ); + + AddMorphismConstructor( Std, + function( cat, source, ring_element, range ) + + return CreateCapCategoryMorphismWithAttributes( cat, + source, + range, + UnderlyingRingElement, ring_element ); + + end ); + + AddMorphismDatum( Std, + function( cat, obj ) + + return UnderlyingRingElement( obj ); + + end ); + + AddIsWellDefinedForObjects( Std, + function( cat, obj ) + + return ObjectDatum( cat, obj ) in UnderlyingMatrixGroup( cat ); + + end ); + + AddIsWellDefinedForMorphisms( Std, + function( cat, mor ) + + return MorphismDatum( cat, mor ) in UnderlyingRing( cat ); + + end ); + + AddIsEqualForObjects( Std, + function( cat, rx, ry ) + + return ObjectDatum( cat, rx ) = ObjectDatum( cat, ry ); + + end ); + + AddIsEqualForMorphisms( Std, + function( cat, mor_pre, mor_post ) + + return MorphismDatum( cat, mor_pre ) = MorphismDatum( cat, mor_post ); + + end ); + + AddIsCongruentForMorphisms( Std, + function( cat, mor_pre, mor_post ) + + if IsEndomorphism( cat, mor_pre ) then + return MorphismDatum( cat, mor_pre ) = MorphismDatum( cat, mor_post ); + fi; + + return true; + + end ); + + AddPreCompose( Std, + function( cat, mor_pre, mor_post ) + + return MorphismConstructor( cat, + Source( mor_pre ), + MorphismDatum( cat, mor_pre ) * MorphismDatum( cat, mor_post ), + Range( mor_post ) ); + + end ); + + AddIdentityMorphism( Std, + function( cat, rx ) + + return MorphismConstructor( cat, + rx, + One( UnderlyingRing( cat ) ), + rx ); + + end ); + + AddAdditionForMorphisms( Std, + function( cat, mor1, mor2 ) + + return MorphismConstructor( cat, + Source( mor1 ), + MorphismDatum( cat, mor1 ) + MorphismDatum( cat, mor2 ), + Range( mor1 ) ); + + end ); + + AddAdditiveInverseForMorphisms( Std, + function( cat, mor ) + + return MorphismConstructor( cat, + Source( mor ), + -MorphismDatum( cat, mor ), + Range( mor ) ); + + end ); + + AddZeroMorphism( Std, + function( cat, rx, ry ) + + return MorphismConstructor( cat, + rx, + Zero( UnderlyingRing( cat ) ), + ry ); + + end ); + + AddMultiplyWithElementOfCommutativeRingForMorphisms( Std, + function( cat, f, mor ) + + return MorphismConstructor( cat, + Source( mor ), + f * MorphismDatum( cat, mor ), + Range( mor ) ); + + end ); + + AddTensorUnit( Std, + function( cat ) + + return ObjectConstructor( cat, One( UnderlyingMatrixGroup( cat ) ) ); + + end ); + + AddTensorProductOnObjects( Std, + function( cat, rx, ry ) + + return ObjectConstructor( cat, + ObjectDatum( cat, rx ) * ObjectDatum( cat, ry ) ); + + end ); + + AddTensorProductOnMorphisms( Std, + function( cat, mor1, mor2 ) + local phi_x; + + phi_x := UnderlyingTwistingRingMap( cat )( ObjectDatum( cat, Range( mor1 ) ) ); + + return MorphismConstructor( cat, + TensorProductOnObjects( cat, Source( mor1 ), Source( mor2 ) ), + MorphismDatum( cat, mor1 ) * Pullback( phi_x, MorphismDatum( cat, mor2 ) ), + TensorProductOnObjects( cat, Range( mor1 ), Source( mor2 ) ) ); + + end ); + + AddBasisOfExternalHom( Std, + function( cat, rx, ry ) + + if IsEqualForObjects( cat, rx, ry ) then + return [ IdentityMorphism( cat, rx ) ]; + fi; + + return [ ]; + + end ); + + AddCoefficientsOfMorphism( Std, + function( cat, mor ) + + if IsEqualForObjects( cat, Source( mor ), Range( mor ) ) then + return [ MorphismDatum( cat, mor ) ]; + fi; + + return [ ]; + + end ); + + Std!.compiler_hints := + rec( category_attribute_names := + [ "UnderlyingMatrixGroup", + "UnderlyingRing", + "UnderlyingTwistingRingMap", + ] ); + + Finalize( Std ); + + return Std; + +end ); + +#################################### +# +# View, Print, and Display methods: +# +#################################### + +## +InstallMethod( Display, + "for an object in a standard category", + [ IsObjectInStandardCategory ], + + function( obj ) + + Display( ObjectDatum( obj ) ); + +end ); + +## +InstallMethod( Display, + "for a morphism in a standard category", + [ IsMorphismInStandardCategory ], + + function( obj ) + + Print( MorphismDatum( obj ), "\n" ); + +end ); diff --git a/gap/obsolete.g b/gap/obsolete.g new file mode 100644 index 0000000..157329e --- /dev/null +++ b/gap/obsolete.g @@ -0,0 +1,43 @@ +#! +DeclareAttribute( "UnderlyingEnvelopingRing", + IsStandardCategory ); + +CapJitAddTypeSignature( "UnderlyingEnvelopingRing", [ IsStandardCategory ], IsHomalgRing ); + +#! +DeclareAttribute( "UnderlyingEnvelopingTwistingRingMap", + IsStandardCategory ); + +CapJitAddTypeSignature( "UnderlyingEnvelopingTwistingRingMap", [ IsStandardCategory ], IsHomalgRingMap ); + +vars_b, Re, phi_Re_R, + vars_b := Concatenation( "b1..", String( d ) ); + + Re := R[vars_b]; + + phi_Re_R := + function( w ) + local vars_a, phi; + + vars_a := Indeterminates( R ); + + phi := Concatenation( vars_a, w * vars_a ); + + return RingMap( phi, Re, R ); + + end; + + SetUnderlyingEnvelopingRing( Std, Re ); + SetUnderlyingEnvelopingTwistingRingMap( Std, phi_Re_R ); + + "UnderlyingEnvelopingRing", + "UnderlyingEnvelopingTwistingRingMap", + + +Re := UnderlyingEnvelopingRing( Std ); +#! Q[a1,a2,a3][b1,b2,b3] + +eta_x := "a1*b1+a2*b3" / Re * phi_x; +#! +Display( eta_x ); +#! a1^2*a2^2+a1*a2^2*a3