diff --git a/MatricesForHomalg/PackageInfo.g b/MatricesForHomalg/PackageInfo.g index 62b2d88cc..526796c40 100644 --- a/MatricesForHomalg/PackageInfo.g +++ b/MatricesForHomalg/PackageInfo.g @@ -11,7 +11,7 @@ SetPackageInfo( rec( PackageName := "MatricesForHomalg", Subtitle := "Matrices for the homalg project", -Version := "2024.08-05", +Version := "2024.11-02", 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", diff --git a/MatricesForHomalg/gap/HomalgRing.gd b/MatricesForHomalg/gap/HomalgRing.gd index 6a5bdadad..63e657f9c 100644 --- a/MatricesForHomalg/gap/HomalgRing.gd +++ b/MatricesForHomalg/gap/HomalgRing.gd @@ -316,6 +316,32 @@ DeclareProperty( "IsLocalizedWeylRing", DeclareProperty( "IsExteriorRing", IsHomalgRing ); +## <#GAPDoc Label="IsShiftAlgebra"> +## +## +## true or false +## +## R is a ring for &homalg;. +## +## +## <#/GAPDoc> +## +DeclareProperty( "IsShiftAlgebra", + IsHomalgRing ); + +## <#GAPDoc Label="IsRationalShiftAlgebra"> +## +## +## true or false +## +## R is a ring for &homalg;. +## +## +## <#/GAPDoc> +## +DeclareProperty( "IsRationalShiftAlgebra", + IsHomalgRing ); + ## <#GAPDoc Label="IsPseudoDoubleShiftAlgebra"> ## ## @@ -1246,6 +1272,84 @@ DeclareAttribute( "RelativeIndeterminateAntiCommutingVariablesOfExteriorRing", DeclareAttribute( "IndeterminatesOfExteriorRing", IsHomalgRing ); +## <#GAPDoc Label="IndeterminateCoordinatesOfShiftAlgebra"> +## +## +## a list of &homalg; ring elements +## +## The list of indeterminate coordinates of the &homalg; shift algebra R. +## +## +## <#/GAPDoc> +## +DeclareAttribute( "IndeterminateCoordinatesOfShiftAlgebra", + IsHomalgRing ); + +## <#GAPDoc Label="ParametersOfRationalShiftAlgebra"> +## +## +## a list of &homalg; ring elements +## +## The list of indeterminate coordinates of the &homalg; shift algebra R. +## +## +## <#/GAPDoc> +## +DeclareAttribute( "ParametersOfRationalShiftAlgebra", + IsHomalgRing ); + +## <#GAPDoc Label="RelativeIndeterminateCoordinatesOfShiftAlgebra"> +## +## +## a list of &homalg; ring elements +## +## The list of relative indeterminate coordinates of the &homalg; shift algebra R. +## +## +## <#/GAPDoc> +## +DeclareAttribute( "RelativeIndeterminateCoordinatesOfShiftAlgebra", + IsHomalgRing ); + +## <#GAPDoc Label="RelativeParametersOfRationalShiftAlgebra"> +## +## +## a list of &homalg; ring elements +## +## The list of relative indeterminate coordinates of the &homalg; shift algebra R. +## +## +## <#/GAPDoc> +## +DeclareAttribute( "RelativeParametersOfRationalShiftAlgebra", + IsHomalgRing ); + +## <#GAPDoc Label="IndeterminateShiftsOfShiftAlgebra"> +## +## +## a list of &homalg; ring elements +## +## The list of indeterminate shifts of the &homalg; shift algebra R. +## +## +## <#/GAPDoc> +## +DeclareAttribute( "IndeterminateShiftsOfShiftAlgebra", + IsHomalgRing ); + +## <#GAPDoc Label="IndeterminateShiftsOfRationalShiftAlgebra"> +## +## +## a list of &homalg; ring elements +## +## The list of indeterminate shifts of the &homalg; shift algebra R. +## +## +## <#/GAPDoc> +## +DeclareAttribute( "IndeterminateShiftsOfRationalShiftAlgebra", + IsHomalgRing ); + ## <#GAPDoc Label="IndeterminateCoordinatesOfPseudoDoubleShiftAlgebra"> ## ## @@ -1706,6 +1810,12 @@ DeclareOperation( "KoszulDualRing", DeclareOperation( "KoszulDualRing", [ IsHomalgRing ] ); +DeclareOperation( "ShiftAlgebra", + [ IsHomalgRing, IsList ] ); + +DeclareOperation( "RationalShiftAlgebra", + [ IsHomalgRing, IsList ] ); + DeclareOperation( "PseudoDoubleShiftAlgebra", [ IsHomalgRing, IsList ] ); diff --git a/MatricesForHomalg/gap/HomalgRing.gi b/MatricesForHomalg/gap/HomalgRing.gi index 362b7af2b..dac68e244 100644 --- a/MatricesForHomalg/gap/HomalgRing.gi +++ b/MatricesForHomalg/gap/HomalgRing.gi @@ -103,6 +103,20 @@ InstallValue( CommonHomalgTableForRings, brackets := [ "{", "}" ]; + ## the pseudo shift algebra: + elif HasIndeterminateShiftsOfShiftAlgebra( R ) then + + var := IndeterminateShiftsOfShiftAlgebra( R ); + + brackets := [ "<", ">" ]; + + ## the pseudo shift algebra: + elif HasIndeterminateShiftsOfRationalShiftAlgebra( R ) then + + var := IndeterminateShiftsOfRationalShiftAlgebra( R ); + + brackets := [ "<", ">" ]; + ## the pseudo double-shift algebra: elif HasIndeterminateShiftsOfPseudoDoubleShiftAlgebra( R ) then @@ -574,6 +588,21 @@ InstallMethod( Indeterminates, end ); +## +InstallMethod( Indeterminates, + "for homalg rings", + [ IsHomalgRing and HasIndeterminateCoordinatesOfShiftAlgebra ], + + function( R ) + + return + Concatenation( + IndeterminateCoordinatesOfShiftAlgebra( R ), + IndeterminateShiftsOfShiftAlgebra( R ) + ); + +end ); + ## InstallMethod( Indeterminates, "for homalg rings", @@ -1364,6 +1393,144 @@ InstallMethod( SetRingProperties, end ); +## +InstallMethod( SetRingProperties, + "for homalg rings", + [ IsHomalgRing and IsShiftAlgebra, IsHomalgRing and IsFreePolynomialRing, IsList ], + + function( S, R, shift ) + local r, b, param, paramS, var, d; + + r := CoefficientsRing( R ); + + if HasBaseRing( R ) then + b := BaseRing( R ); + else + b := r; + fi; + + var := IndeterminatesOfPolynomialRing( R ); + var := List( var, a -> a / S ); + + d := Length( var ); + + if d > 0 then + SetIsFinite( S, false ); + fi; + + SetCoefficientsRing( S, r ); + + if HasRationalParameters( r ) then + param := RationalParameters( r ); + paramS := List( param, a -> a / S ); + Perform( [ 1 .. Length( param ) ], function( i ) SetName( paramS[i], Name( param[i] ) ); end ); + SetRationalParameters( S, paramS ); + fi; + + SetCharacteristic( S, Characteristic( R ) ); + + SetIsCommutative( S, shift = [ ] ); + + SetIndeterminateCoordinatesOfShiftAlgebra( S, var ); + + if HasRelativeIndeterminatesOfPolynomialRing( R ) then + SetRelativeIndeterminateCoordinatesOfShiftAlgebra( + S, RelativeIndeterminatesOfPolynomialRing( R ) ); + fi; + + SetIndeterminateShiftsOfShiftAlgebra( S, shift ); + + if d > 0 then + SetIsLeftArtinian( S, false ); + SetIsRightArtinian( S, false ); + fi; + + SetIsLeftNoetherian( S, true ); + SetIsRightNoetherian( S, true ); + + if HasIsIntegralDomain( r ) and IsIntegralDomain( r ) then + SetIsIntegralDomain( S, true ); + fi; + + if d > 0 then + SetIsLeftPrincipalIdealRing( S, false ); + SetIsRightPrincipalIdealRing( S, false ); + SetIsPrincipalIdealRing( S, false ); + fi; + + SetBasisAlgorithmRespectsPrincipalIdeals( S, true ); + +end ); + +## +InstallMethod( SetRingProperties, + "for homalg rings", + [ IsHomalgRing and IsRationalShiftAlgebra, IsHomalgRing and IsFreePolynomialRing, IsList ], + + function( S, R, shift ) + local r, b, param, paramS, var, d; + + r := CoefficientsRing( R ); + + if HasBaseRing( R ) then + b := BaseRing( R ); + else + b := r; + fi; + + var := IndeterminatesOfPolynomialRing( R ); + var := List( var, a -> a / S ); + + d := Length( var ); + + if d > 0 then + SetIsFinite( S, false ); + fi; + + SetCoefficientsRing( S, r ); + + if HasRationalParameters( r ) then + param := RationalParameters( r ); + paramS := List( param, a -> a / S ); + Perform( [ 1 .. Length( param ) ], function( i ) SetName( paramS[i], Name( param[i] ) ); end ); + SetRationalParameters( S, paramS ); + fi; + + SetCharacteristic( S, Characteristic( R ) ); + + SetIsCommutative( S, shift = [ ] ); + + SetParametersOfRationalShiftAlgebra( S, var ); + + if HasRelativeIndeterminatesOfPolynomialRing( R ) then + SetRelativeParametersOfRationalShiftAlgebra( + S, RelativeIndeterminatesOfPolynomialRing( R ) ); + fi; + + SetIndeterminateShiftsOfRationalShiftAlgebra( S, shift ); + + if d > 0 then + SetIsLeftArtinian( S, false ); + SetIsRightArtinian( S, false ); + fi; + + SetIsLeftNoetherian( S, true ); + SetIsRightNoetherian( S, true ); + + if HasIsIntegralDomain( r ) and IsIntegralDomain( r ) then + SetIsIntegralDomain( S, true ); + fi; + + if d > 0 then + SetIsLeftPrincipalIdealRing( S, false ); + SetIsRightPrincipalIdealRing( S, false ); + SetIsPrincipalIdealRing( S, false ); + fi; + + SetBasisAlgorithmRespectsPrincipalIdeals( S, true ); + +end ); + ## InstallMethod( SetRingProperties, "for homalg rings", diff --git a/MatricesForHomalg/gap/Tools.gi b/MatricesForHomalg/gap/Tools.gi index 9d03da160..3f6a7a795 100644 --- a/MatricesForHomalg/gap/Tools.gi +++ b/MatricesForHomalg/gap/Tools.gi @@ -3726,6 +3726,8 @@ InstallMethod( Coefficients, indets := RelativeIndeterminateAntiCommutingVariablesOfExteriorRing( R ); elif HasIndeterminateAntiCommutingVariablesOfExteriorRing( R ) then indets := IndeterminateAntiCommutingVariablesOfExteriorRing( R ); + elif HasIndeterminateShiftsOfShiftAlgebra( R ) then + indets := IndeterminateShiftsOfShiftAlgebra( R ); elif HasIndeterminateShiftsOfPseudoDoubleShiftAlgebra( R ) then indets := IndeterminateShiftsOfPseudoDoubleShiftAlgebra( R ); elif HasIndeterminateShiftsOfDoubleShiftAlgebra( R ) then @@ -3804,6 +3806,8 @@ InstallMethod( Coefficients, indets := RelativeIndeterminateAntiCommutingVariablesOfExteriorRing( R ); elif HasIndeterminateAntiCommutingVariablesOfExteriorRing( R ) then indets := IndeterminateAntiCommutingVariablesOfExteriorRing( R ); + elif HasIndeterminateShiftsOfShiftAlgebra( R ) then + indets := IndeterminateShiftsOfShiftAlgebra( R ); elif HasIndeterminateShiftsOfPseudoDoubleShiftAlgebra( R ) then indets := IndeterminateShiftsOfPseudoDoubleShiftAlgebra( R ); elif HasIndeterminateShiftsOfDoubleShiftAlgebra( R ) then diff --git a/RingsForHomalg/PackageInfo.g b/RingsForHomalg/PackageInfo.g index 53ae1c02d..5c53556c0 100644 --- a/RingsForHomalg/PackageInfo.g +++ b/RingsForHomalg/PackageInfo.g @@ -11,7 +11,7 @@ SetPackageInfo( rec( PackageName := "RingsForHomalg", Subtitle := "Dictionaries of external rings", -Version := "2024.06-01", +Version := "2024.11-02", 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", @@ -207,7 +207,7 @@ PackageDoc := rec( Dependencies := rec( GAP := ">= 4.12.1", NeededOtherPackages := [ - [ "MatricesForHomalg", ">= 2023.08-01" ], + [ "MatricesForHomalg", ">= 2024.11-02" ], [ "HomalgToCAS", ">= 2023.08-01" ], [ "GaussForHomalg", ">= 2023.08-01" ], [ "GAPDoc", ">= 1.0" ] diff --git a/RingsForHomalg/gap/MapleHomalg.gi b/RingsForHomalg/gap/MapleHomalg.gi index 912ad102d..daf8f79e9 100644 --- a/RingsForHomalg/gap/MapleHomalg.gi +++ b/RingsForHomalg/gap/MapleHomalg.gi @@ -1084,6 +1084,159 @@ InstallMethod( ExteriorRing, end ); +## +InstallMethod( RationalShiftAlgebra, + "for homalg rings in Singular", + [ IsHomalgExternalRingInMapleRep, IsList ], + + function( R, indets ) + local ar, r, var, shift, param, base, stream, display_color, switch, ext_obj, + alg, b, n, steps, d, Y, RP, Ds, S, B, T; + + ar := _PrepareInputForShiftAlgebra( R, indets ); + + r := ar[1]; + var := ar[2]; + shift := ar[3]; + param := ar[4]; + base := ar[5]; + + stream := homalgStream( R ); + + switch := ValueOption( "switch" ); + + b := Length( base ); + + n := Length( shift ); + + steps := ValueOption( "steps" ); + + if IsRat( steps ) then + steps := ListWithIdenticalEntries( n, steps ); + elif not ( IsList( steps ) and Length( steps ) = n and ForAll( steps, IsRat ) ) then + steps := ListWithIdenticalEntries( n, 1 ); + fi; + + Ds := shift; + + if IsIdenticalObj( switch, true ) then + + Error( "not supported in Maple\n" ); + + else + + if HasIsIntegersForHomalg( r ) and IsIntegersForHomalg( r ) then + + Error( "not supported in Maple\n" ); + + else + + ext_obj := ListN( Ds, var, {a,c} -> [ a, c ] ); + + if Set( steps ) = [ 1 ] then + ext_obj := List( ext_obj, a -> Concatenation( "`shift`=[", JoinStringsWithSeparator( a ), "], " ) ); + elif Set( steps ) = [ -1 ] then + ext_obj := List( ext_obj, a -> Concatenation( "`dual_shift`=[", JoinStringsWithSeparator( a ), "], " ) ); + else + Error( "these steps = ", steps, " are not yet supported\n" ); + fi; + + ext_obj := Concatenation( ext_obj ); + ext_obj := Concatenation( ext_obj, "characteristic=", String( Characteristic( R ) ), ", comm=[", JoinStringsWithSeparator( base ), "]" ); + + if base <> "" then + + else + + fi; + + fi; + + fi; + + ext_obj := Concatenation( [ "`OreModules/DefineOreAlgebra`(", ext_obj, ")" ] ); + + ext_obj := homalgSendBlocking( [ ext_obj ], R, "initialize" ); + + homalgSendBlocking( [ ext_obj, "[4] := [", JoinStringsWithSeparator( Ds ), "]" ], "need_command", "initialize" ); + + ## as we are not yet done we cannot call CreateHomalgExternalRing + ## to create a HomalgRing, and only then would homalgSendBlocking call stream.setring, + ## so till then we have to prevent the garbage collector from stepping in + stream.DeletePeriod_save := stream.DeletePeriod; + stream.DeletePeriod := false; + + Y := RingForHomalgInMapleUsingOreModules( ext_obj, R ); + + SetName( Y, + Concatenation( + Concatenation( RingName( r ), "(", JoinStringsWithSeparator( base ), ")(", JoinStringsWithSeparator( var ), ")" ), + "<", JoinStringsWithSeparator( shift ), ">" ) ); + + ## now it is safe to call the garbage collector + stream.DeletePeriod := stream.DeletePeriod_save; + Unbind( stream.DeletePeriod_save ); + + var := List( var , a -> HomalgExternalRingElement( a, Y ) ); + + Perform( var, Name ); + + shift := List( shift , a -> HomalgExternalRingElement( a, Y ) ); + + Perform( shift, Name ); + + SetIsRationalShiftAlgebra( Y, true ); + + SetBaseRing( Y, R ); + + SetRingProperties( Y, R, shift ); + + RP := homalgTable( Y ); + + if not ( HasIsFieldForHomalg( r ) and IsFieldForHomalg( r ) ) then + Unbind( RP!.IsUnit ); + Unbind( RP!.GetColumnIndependentUnitPositions ); + Unbind( RP!.GetRowIndependentUnitPositions ); + Unbind( RP!.GetUnitPosition ); + fi; + + if HasIsIntegersForHomalg( r ) and IsIntegersForHomalg( r ) then + RP!.IsUnit := RP!.IsUnit_Z; + RP!.GetColumnIndependentUnitPositions := RP!.GetColumnIndependentUnitPositions_Z; + RP!.GetRowIndependentUnitPositions := RP!.GetRowIndependentUnitPositions_Z; + RP!.GetUnitPosition := RP!.GetUnitPosition_Z; + RP!.PrimaryDecomposition := RP!.PrimaryDecomposition_Z; + RP!.RadicalSubobject := RP!.RadicalSubobject_Z; + RP!.RadicalDecomposition := RP!.RadicalDecomposition_Z; + Unbind( RP!.CoefficientsOfUnreducedNumeratorOfWeightedHilbertPoincareSeries ); + Unbind( RP!.MaximalDegreePart ); + fi; + + shift := List( shift, String ); + + ## the "commutative" shift algebra + S := R * shift; + + ## does not reduce elements instantaneously + ## S := HomalgQRingInSingular( AmbientRing( S ), RingRelations( S ) ); + + Y!.CommutativeShiftAlgebra := S; + + ## the Laurent algebra + B := BaseRing( R ); + + T := B * shift; + + Y!.LaurentAlgebra := T; + + #if not IsIdenticalObj( switch, true ) then + # P!.SwitchedPseudoShiftAlgebra := PseudoShiftAlgebra( R, indets : switch := true ); + #fi; + + return Y; + +end ); + ## InstallMethod( RationalPseudoDoubleShiftAlgebra, "for homalg rings in Singular", @@ -1106,7 +1259,6 @@ InstallMethod( RationalPseudoDoubleShiftAlgebra, switch := ValueOption( "switch" ); b := Length( base ); - n := b + Length( var ) + Length( shift ); n := Length( shift ) / 2; diff --git a/RingsForHomalg/gap/RingsForHomalg.gd b/RingsForHomalg/gap/RingsForHomalg.gd index e5d94ea6f..db158945a 100644 --- a/RingsForHomalg/gap/RingsForHomalg.gd +++ b/RingsForHomalg/gap/RingsForHomalg.gd @@ -20,6 +20,8 @@ DeclareGlobalFunction( "_PrepareInputForRingOfDerivations" ); DeclareGlobalFunction( "_PrepareInputForExteriorRing" ); +DeclareGlobalFunction( "_PrepareInputForShiftAlgebra" ); + DeclareGlobalFunction( "_PrepareInputForPseudoDoubleShiftAlgebra" ); # constructor methods: diff --git a/RingsForHomalg/gap/RingsForHomalg.gi b/RingsForHomalg/gap/RingsForHomalg.gi index 5bab74909..3fec8674a 100644 --- a/RingsForHomalg/gap/RingsForHomalg.gi +++ b/RingsForHomalg/gap/RingsForHomalg.gi @@ -195,6 +195,69 @@ InstallGlobalFunction( _PrepareInputForExteriorRing, end ); +## +InstallGlobalFunction( _PrepareInputForShiftAlgebra, + function( R, indets ) + local var, nr_var, shift, nr_shift, r, param, base; + + ## check whether the base ring is polynomial and then extract needed data + if IsFreePolynomialRing( R ) then + if HasRelativeIndeterminatesOfPolynomialRing( R ) then + var := RelativeIndeterminatesOfPolynomialRing( R ); + else + var := IndeterminatesOfPolynomialRing( R ); + fi; + nr_var := Length( var ); + else + Error( "the given ring is not a free polynomial ring" ); + fi; + + var := List( var, Name ); + + ## get the new indeterminates (the shifts) for the ring and save them in shift + if IsString( indets ) and indets <> "" then + shift := SplitString( indets, "," ); + elif indets <> [ ] and ForAll( indets, i -> IsString( i ) and i <> "" ) then + shift := indets; + else + Error( "either a non-empty list of indeterminates or a comma separated string of them must be provided as the second argument\n" ); + fi; + + nr_shift := Length( shift ); + + if nr_var <> nr_shift then + Error( "the number of indeterminates of the given polynomial ring is not equal to the number of specified shifts\n" ); + fi; + + if Intersection2( shift, var ) <> [ ] then + Error( "the following indeterminate(s) are already elements of the polynomial ring: ", Intersection2( shift, var ), "\n" ); + fi; + + if HasIndeterminatesOfPolynomialRing( R ) then + r := CoefficientsRing( R ); + else + r := R; + fi; + + if HasRationalParameters( r ) then + param := Concatenation( ",", JoinStringsWithSeparator( RationalParameters( r ) ) ); + else + param := ""; + fi; + + if HasBaseRing( R ) and HasCoefficientsRing( R ) and + not IsIdenticalObj( BaseRing( R ), CoefficientsRing( R ) ) and + HasIndeterminatesOfPolynomialRing( BaseRing( R ) ) then + base := IndeterminatesOfPolynomialRing( BaseRing( R ) ); + base := List( base, Name ); + else + base := ""; + fi; + + return [ r, var, shift, param, base ]; + +end ); + ## InstallGlobalFunction( _PrepareInputForPseudoDoubleShiftAlgebra, function( R, indets )