Skip to content

Commit

Permalink
Merge pull request #612 from mohamed-barakat/RingMapOntoSimplifiedOnc…
Browse files Browse the repository at this point in the history
…eResidueClassRingUsingLinearEquations

d&i RingMapOntoSimplifiedOnceResidueClassRingUsingLinearEquations
  • Loading branch information
mohamed-barakat authored Aug 25, 2024
2 parents 5d2e553 + 5fe52ea commit 3c67d56
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 11 deletions.
2 changes: 1 addition & 1 deletion MatricesForHomalg/PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down
5 changes: 4 additions & 1 deletion MatricesForHomalg/gap/Tools.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
58 changes: 49 additions & 9 deletions MatricesForHomalg/gap/Tools.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -8175,7 +8174,7 @@ InstallMethod( RingMapOntoSimplifiedResidueClassRing,
end );

##
InstallMethod( RingMapOntoSimplifiedResidueClassRingByLinearEquations,
InstallMethod( RingMapOntoSimplifiedOnceResidueClassRingUsingLinearEquations,
"for a homalg ring",
[ IsHomalgRing ],

Expand All @@ -8186,30 +8185,32 @@ 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 );

L := HomalgMatrix( L, Length( L ), 1, A );

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 );

Expand All @@ -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 );

0 comments on commit 3c67d56

Please sign in to comment.