diff --git a/MatricesForHomalg/PackageInfo.g b/MatricesForHomalg/PackageInfo.g index dcd2fb69f..c969ddd34 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-01", +Version := "2024.08-04", 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/Tools.gd b/MatricesForHomalg/gap/Tools.gd index eefb53223..4d763cb0a 100644 --- a/MatricesForHomalg/gap/Tools.gd +++ b/MatricesForHomalg/gap/Tools.gd @@ -235,7 +235,10 @@ DeclareOperation( "RingMapOntoSimplifiedOnceResidueClassRing", DeclareOperation( "RingMapOntoSimplifiedResidueClassRing", [ IsHomalgRing ] ); -DeclareOperation( "RingMapOntoSimplifiedResidueClassRingByLinearEquations", +DeclareOperation( "RingMapOntoSimplifiedOnceResidueClassRingUsingLinearEquations", + [ IsHomalgRing ] ); + +DeclareOperation( "RingMapOntoSimplifiedResidueClassRingUsingLinearEquations", [ IsHomalgRing ] ); ## This is a dummy declaration for a function actually installed diff --git a/MatricesForHomalg/gap/Tools.gi b/MatricesForHomalg/gap/Tools.gi index 4f85a3bfa..08646b72a 100644 --- a/MatricesForHomalg/gap/Tools.gi +++ b/MatricesForHomalg/gap/Tools.gi @@ -8155,14 +8155,13 @@ InstallMethod( RingMapOntoSimplifiedResidueClassRing, pi := RingMapOntoRewrittenResidueClassRing( R ); # replace pi: A -> R = A / I by pi: A -> R_1 := A_1 / I_1 while true do - + ## construct the surjective morphism psi: A_i -> A_{i+1} / I_{i+1} =: R_{i+1} psi := RingMapOntoSimplifiedOnceResidueClassRing( Range( pi ) ); if HasIsOne( psi ) and IsOne( psi ) then break; fi; - ## compose A -pi-> A_i / I_i -psi-> A_{i+1} / I_{i+1}, ## where we understand the above psi as the isomorphism psi: A_i / I_i -psi-> A_{i+1} / I_{i+1} @@ -8175,7 +8174,7 @@ InstallMethod( RingMapOntoSimplifiedResidueClassRing, end ); ## -InstallMethod( RingMapOntoSimplifiedResidueClassRingByLinearEquations, +InstallMethod( RingMapOntoSimplifiedOnceResidueClassRingUsingLinearEquations, "for a homalg ring", [ IsHomalgRing ], @@ -8186,16 +8185,14 @@ InstallMethod( RingMapOntoSimplifiedResidueClassRingByLinearEquations, if not HasAmbientRing( R ) then return id; + elif HasIsZero( R ) and IsZero( R ) then + return id; fi; ## R = A / I I := MatrixOfRelations( R ); - L := Filtered( EntriesOfHomalgMatrix( I ), e -> Degree( e ) = 1 ); - - if L = [ ] then - return id; - fi; + L := Filtered( EntriesOfHomalgMatrix( I ), e -> Degree( e ) <= 1 ); A := AmbientRing( R ); @@ -8203,13 +8200,17 @@ InstallMethod( RingMapOntoSimplifiedResidueClassRingByLinearEquations, L := BasisOfRows( L ); + if IsZero( L ) then + return id; + fi; + S := A / L; pi := RingMapOntoSimplifiedResidueClassRing( S ); P := Range( pi ); - Assert( 0, not HasAmbientRing( P ) ); + Assert( 0, ( HasIsZero( P ) and IsZero( P ) ) or not HasAmbientRing( P ) ); J := Pullback( pi, I ); @@ -8227,3 +8228,42 @@ InstallMethod( RingMapOntoSimplifiedResidueClassRingByLinearEquations, return epi; end ); + +## +InstallMethod( RingMapOntoSimplifiedResidueClassRingUsingLinearEquations, + "for a homalg ring", + [ IsHomalgRing ], + + function( R ) + local id, pi, psi; + + id := RingMap( R ); + + if not HasAmbientRing( R ) then + return id; + fi; + + # R = A / I + pi := RingMap( Indeterminates( R ), AmbientRing( R ), R ); + + SetIsMorphism( pi, true ); + SetIsEpimorphism( pi, true ); + + while true do + + ## construct the surjective morphism psi: A_i -> A_{i+1} / I_{i+1} =: R_{i+1} + psi := RingMapOntoSimplifiedOnceResidueClassRingUsingLinearEquations( Range( pi ) ); + + if ( HasIsOne( psi ) and IsOne( psi ) ) or ( HasIsZero( Range( psi ) ) and IsZero( Range( psi ) ) ) then + break; + fi; + + ## compose A -pi-> A_i / I_i -psi-> A_{i+1} / I_{i+1}, + ## where we understand the above psi as the isomorphism psi: A_i / I_i -psi-> A_{i+1} / I_{i+1} + pi := PreCompose( pi, psi ); + + od; + + return pi; + +end );