From 35d23004130e2248139ce7f51e7963b186f5fc3f Mon Sep 17 00:00:00 2001 From: Mohamed Barakat Date: Sat, 22 Jun 2024 22:03:16 +0200 Subject: [PATCH] fixed RingMapOnto* methods --- MatricesForHomalg/PackageInfo.g | 2 +- MatricesForHomalg/gap/Tools.gi | 36 ++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/MatricesForHomalg/PackageInfo.g b/MatricesForHomalg/PackageInfo.g index c969ddd34..62b2d88cc 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-04", +Version := "2024.08-05", 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.gi b/MatricesForHomalg/gap/Tools.gi index 08646b72a..9d03da160 100644 --- a/MatricesForHomalg/gap/Tools.gi +++ b/MatricesForHomalg/gap/Tools.gi @@ -8015,7 +8015,7 @@ InstallMethod( RingMapOntoRewrittenResidueClassRing, fi; ## R = A / I - I := MatrixOfRelations( R ); + I := BasisOfRows( MatrixOfRelations( R ) ); A := AmbientRing( R ); @@ -8047,7 +8047,9 @@ InstallMethod( RingMapOntoRewrittenResidueClassRing, zero_rows := ZeroRows( matrix - images ); ## create the standard subring S of A, i.e., the subring generated by the standard indeterminates - if Length( indets ) = Length( zero_rows ) and + if IsZero( DecideZeroRows( HomalgIdentityMatrix( 1, A ), I ) ) then + S := k / One( k ); + elif Length( indets ) = Length( zero_rows ) and IsIdenticalObj( k, CoefficientsRing( A ) ) then S := A; else @@ -8091,8 +8093,22 @@ InstallMethod( RingMapOntoSimplifiedOnceResidueClassRing, fi; ## R = A / I + A := AmbientRing( R ); + I := MatrixOfRelations( R ); + ## [ y_1, ..., y_{i-1}, y_i, y_{i+1}, ..., y_s ] + indets := ShallowCopy( Indeterminates( A ) ); + + if IsEmpty( indets ) and IsZero( DecideZeroRows( HomalgIdentityMatrix( 1, A ), I ) ) then + S := CoefficientsRing( A ) / 1; + SetIsZero( S, true ); + epi := RingMap( ListWithIdenticalEntries( Length( indets ), Zero( S ) ), A, S ); + SetIsMorphism( epi, true ); + SetIsEpimorphism( epi, true ); + return epi; + fi; + for i in [ 1 .. NumberRows( I ) ] do ## [ j, f/u ] where (u y_j - f) ∈ GB(I) img := IsolateIndeterminate( I[ i, 1 ] ); @@ -8102,14 +8118,12 @@ InstallMethod( RingMapOntoSimplifiedOnceResidueClassRing, od; if img = fail then - return id; + epi := RingMap( List( indets, a -> a / R ), A, R ); + SetIsMorphism( epi, true ); + SetIsEpimorphism( epi, true ); + return epi; fi; - A := AmbientRing( R ); - - ## [ y_1, ..., y_{i-1}, y_i, y_{i+1}, ..., y_s ] - indets := ShallowCopy( Indeterminates( A ) ); - new_indets := List( indets, String ); ## [ y_1, ..., y_{i-1}, y_{i+1}, ..., y_s ] @@ -8159,7 +8173,8 @@ InstallMethod( RingMapOntoSimplifiedResidueClassRing, ## 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 + if ( HasIsZero( Range( psi ) ) and IsZero( Range( psi ) ) ) or + Length( Indeterminates( Source( psi ) ) ) = Length( Indeterminates( Range( psi ) ) ) then break; fi; @@ -8254,7 +8269,8 @@ InstallMethod( RingMapOntoSimplifiedResidueClassRingUsingLinearEquations, ## 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 + if ( HasIsZero( Range( psi ) ) and IsZero( Range( psi ) ) ) or + Length( Indeterminates( Source( psi ) ) ) = Length( Indeterminates( Range( psi ) ) ) then break; fi;