Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Ind

### 12 Examples and Tests

#### 12.1 Adelman category basics for category of rows

gap> R := HomalgRingOfIntegers();;
gap> rows := CategoryOfRows( R );;
gap> obj1 := CategoryOfRowsObject( 1, rows );;
gap> obj2 := CategoryOfRowsObject( 2, rows );;
gap> id := IdentityMorphism( obj2 );;
gap> alpha := CategoryOfRowsMorphism( obj1, HomalgMatrix( [ [ 1, 2 ] ], 1, 2, R ), obj2 );;
gap> beta := CategoryOfRowsMorphism( obj2, HomalgMatrix( [ [ 1, 2 ], [ 3, 4 ] ], 2, 2, R ), obj2 );;
gap> gamma := CategoryOfRowsMorphism( obj2, HomalgMatrix( [ [ 1, 3 ], [ 3, 4 ] ], 2, 2, R ), obj2 );;
gap> obj1_a := AsAdelmanCategoryObject( obj1 );;
gap> obj2_a := AsAdelmanCategoryObject( obj2 );;
gap> m := AsAdelmanCategoryMorphism( beta );;
gap> n := AsAdelmanCategoryMorphism( gamma );;
gap> IsWellDefined( m );
true
gap> # backwards compatibility
> IsIdenticalObj( MorphismDatum( m ), beta );
true
gap> IsCongruentForMorphisms( PreCompose( m, n ), PreCompose( n, m ) );
false
gap> IsCongruentForMorphisms( SubtractionForMorphisms( m, m ), ZeroMorphism( obj2_a, obj2_a ) );
true
gap> IsCongruentForMorphisms( ZeroObjectFunctorial( adelman ),
>                          PreCompose( UniversalMorphismFromZeroObject( obj1_a), UniversalMorphismIntoZeroObject( obj1_a ) )
>                         );
true
gap> d := [ obj1_a, obj2_a ];;
gap> pi1 := ProjectionInFactorOfDirectSum( d, 1 );;
gap> pi2 := ProjectionInFactorOfDirectSum( d, 2 );;
gap> id := IdentityMorphism( DirectSum( d ) );;
gap> iota1 := InjectionOfCofactorOfDirectSum( d, 1 );;
gap> iota2 := InjectionOfCofactorOfDirectSum( d, 2 );;
gap> IsCongruentForMorphisms( PreCompose( pi1, iota1 ) + PreCompose( pi2, iota2 ), id );
true
gap> IsCongruentForMorphisms( UniversalMorphismIntoDirectSum( d, [ pi1, pi2 ] ), id );
true
gap> IsCongruentForMorphisms( UniversalMorphismFromDirectSum( d, [ iota1, iota2 ] ), id );
true
gap> c := CokernelProjection( m );;
gap> c2 := CokernelProjection( c );;
gap> IsCongruentForMorphisms( c2, ZeroMorphism( Source( c2 ), Range( c2 ) ) );
true
gap> IsWellDefined( CokernelProjection( m ) );
true
gap> IsCongruentForMorphisms( CokernelColift( m, CokernelProjection( m ) ), IdentityMorphism( CokernelObject( m ) ) );
true
gap> k := KernelEmbedding( c );;
gap> IsZeroForMorphisms( PreCompose( k, c ) );
true
gap> IsCongruentForMorphisms( KernelLift( m, KernelEmbedding( m ) ), IdentityMorphism( KernelObject( m ) ) );
true


#### 12.2 Adelman category basics for category of columns

gap> R := HomalgRingOfIntegers();;
gap> cols := CategoryOfColumns( R );;
gap> obj1 := CategoryOfColumnsObject( 1, cols );;
gap> obj2 := CategoryOfColumnsObject( 2, cols );;
gap> id := IdentityMorphism( obj2 );;
gap> alpha := CategoryOfColumnsMorphism( obj1, HomalgMatrix( [ [ 1 ], [ 2 ] ], 1, 2, R ), obj2 );;
gap> beta := CategoryOfColumnsMorphism( obj2, HomalgMatrix( [ [ 1, 3 ], [ 2, 4 ] ], 2, 2, R ), obj2 );;
gap> gamma := CategoryOfColumnsMorphism( obj2, HomalgMatrix( [ [ 1, 3 ], [ 3, 4 ] ], 2, 2, R ), obj2 );;
gap> obj1_a := AsAdelmanCategoryObject( obj1 );;
gap> obj2_a := AsAdelmanCategoryObject( obj2 );;
gap> m := AsAdelmanCategoryMorphism( beta );;
gap> n := AsAdelmanCategoryMorphism( gamma );;
gap> IsWellDefined( m );
true
gap> IsCongruentForMorphisms( PreCompose( m, n ), PreCompose( n, m ) );
false
gap> IsCongruentForMorphisms( SubtractionForMorphisms( m, m ), ZeroMorphism( obj2_a, obj2_a ) );
true
gap> IsCongruentForMorphisms( ZeroObjectFunctorial( adelman ),
>                          PreCompose( UniversalMorphismFromZeroObject( obj1_a), UniversalMorphismIntoZeroObject( obj1_a ) )
>                         );
true
gap> d := [ obj1_a, obj2_a ];;
gap> pi1 := ProjectionInFactorOfDirectSum( d, 1 );;
gap> pi2 := ProjectionInFactorOfDirectSum( d, 2 );;
gap> id := IdentityMorphism( DirectSum( d ) );;
gap> iota1 := InjectionOfCofactorOfDirectSum( d, 1 );;
gap> iota2 := InjectionOfCofactorOfDirectSum( d, 2 );;
gap> IsCongruentForMorphisms( PreCompose( pi1, iota1 ) + PreCompose( pi2, iota2 ), id );
true
gap> IsCongruentForMorphisms( UniversalMorphismIntoDirectSum( d, [ pi1, pi2 ] ), id );
true
gap> IsCongruentForMorphisms( UniversalMorphismFromDirectSum( d, [ iota1, iota2 ] ), id );
true
gap> c := CokernelProjection( m );;
gap> c2 := CokernelProjection( c );;
gap> IsCongruentForMorphisms( c2, ZeroMorphism( Source( c2 ), Range( c2 ) ) );
true
gap> IsWellDefined( CokernelProjection( m ) );
true
gap> IsCongruentForMorphisms( CokernelColift( m, CokernelProjection( m ) ), IdentityMorphism( CokernelObject( m ) ) );
true
gap> k := KernelEmbedding( c );;
gap> IsZeroForMorphisms( PreCompose( k, c ) );
true
gap> IsCongruentForMorphisms( KernelLift( m, KernelEmbedding( m ) ), IdentityMorphism( KernelObject( m ) ) );
true


#### 12.3 Basics based on category of rows

gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> LoadPackage( "RingsForHomalg", false );
true
gap> R := HomalgRingOfIntegers();;
gap> cat := CategoryOfRows( R );;
gap> obj1 := CategoryOfRowsObject( 1, cat );;
gap> obj2 := CategoryOfRowsObject( 2, cat );;
gap> IsIsomorphicForObjects( obj1, obj2 );
false
gap> IsIsomorphicForObjects( obj2, obj2 );
true
gap> IsIsomorphism( SomeIsomorphismBetweenObjects( obj2, obj2 ) );
true
gap> id := IdentityMorphism( obj2 );;
gap> alpha := CategoryOfRowsMorphism( obj1, HomalgMatrix( [ [ 1, 2 ] ], 1, 2, R ), obj2 );;
gap> beta := CategoryOfRowsMorphism( obj2, HomalgMatrix( [ [ 1, 2 ], [ 3, 4 ] ], 2, 2, R ), obj2 );;
gap> comp := PreCompose( alpha, beta );;
gap> IsZero( comp );;
gap> zero := ZeroMorphism( obj1, obj2 );;
gap> IsZero( zero );;
gap> ZeroObject( cat );;
gap> UniversalMorphismIntoZeroObject( obj2 );;
gap> UniversalMorphismFromZeroObject( obj1 );;
gap> IsCongruentForMorphisms(
>     SumOfMorphisms( obj1, [ alpha, alpha, alpha ], obj2 ),
>     AdditionForMorphisms( alpha, AdditionForMorphisms( alpha, alpha ) )
> );
true
gap> IsCongruentForMorphisms(
>     SumOfMorphisms( obj1, [ ], obj2 ),
>     ZeroMorphism( obj1, obj2 )
> );
true
gap> DirectSum( obj1, obj2 );;
gap> DirectSumFunctorial( [ alpha, beta, id ] );;
gap> proj := ProjectionInFactorOfDirectSum( [ obj2, obj1, obj2 ], 2 );;
gap> IsZero( ComponentOfMorphismFromDirectSum( proj, [ obj2, obj1, obj2 ], 1 ) );
true
gap> IsOne( ComponentOfMorphismFromDirectSum( proj, [ obj2, obj1, obj2 ], 2 ) );
true
gap> IsZero( ComponentOfMorphismFromDirectSum( proj, [ obj2, obj1, obj2 ], 3 ) );
true
gap> IsZero( ComponentOfMorphismFromCoproduct( proj, [ obj2, obj1, obj2 ], 1 ) );
true
gap> IsOne( ComponentOfMorphismFromCoproduct( proj, [ obj2, obj1, obj2 ], 2 ) );
true
gap> IsZero( ComponentOfMorphismFromCoproduct( proj, [ obj2, obj1, obj2 ], 3 ) );
true
gap> UniversalMorphismIntoDirectSum( [ alpha, alpha, alpha ] );;
gap> inj := InjectionOfCofactorOfDirectSum( [ obj2, obj2, obj1 ], 2 );;
gap> IsZero( ComponentOfMorphismIntoDirectSum( inj, [ obj2, obj2, obj1 ], 1 ) );
true
gap> IsOne( ComponentOfMorphismIntoDirectSum( inj, [ obj2, obj2, obj1 ], 2 ) );
true
gap> IsZero( ComponentOfMorphismIntoDirectSum( inj, [ obj2, obj2, obj1 ], 3 ) );
true
gap> IsZero( ComponentOfMorphismIntoDirectProduct( inj, [ obj2, obj2, obj1 ], 1 ) );
true
gap> IsOne( ComponentOfMorphismIntoDirectProduct( inj, [ obj2, obj2, obj1 ], 2 ) );
true
gap> IsZero( ComponentOfMorphismIntoDirectProduct( inj, [ obj2, obj2, obj1 ], 3 ) );
true
gap> gamma := CategoryOfRowsMorphism( obj2, HomalgMatrix( [ [ 1, 1 ], [ 1, 1 ] ], 2, 2, R ), obj2 );;
gap> IsColiftable( beta, gamma );
true
gap> IsColiftable( gamma, beta );
false
gap> ProjectionInFirstFactorOfWeakBiFiberProduct( gamma, gamma );;
gap> ProjectionInFirstFactorOfWeakBiFiberProduct( gamma, ZeroMorphism( Range( gamma ), Range( gamma ) ) );;
gap> lift_arg_1 := PreCompose( ProjectionInFirstFactorOfWeakBiFiberProduct( gamma, gamma + gamma ), gamma );;
gap> lift_arg_2 := gamma + gamma;;
gap> IsLiftable( lift_arg_1, lift_arg_2 );;
gap> Lift( lift_arg_1, lift_arg_2 );;
gap> pi1 := ProjectionInFirstFactorOfWeakBiFiberProduct( alpha, beta );;
gap> pi2 := ProjectionInSecondFactorOfWeakBiFiberProduct( alpha, beta );;
gap> IsEqualForMorphisms( PreCompose( pi1, alpha ), PreCompose( pi2, beta ) );;
gap> inj1 := InjectionOfFirstCofactorOfWeakBiPushout( gamma + gamma, gamma );;
gap> inj2 := InjectionOfSecondCofactorOfWeakBiPushout( gamma + gamma, gamma );;
gap> IsEqualForMorphisms( PreCompose( gamma + gamma, inj1 ), PreCompose( gamma, inj2 ) );;
gap> WeakKernelLift( WeakCokernelProjection( gamma ), gamma );;
gap> pi1 := InjectionOfFirstCofactorOfWeakBiPushout( alpha, alpha );;
gap> pi2 := InjectionOfSecondCofactorOfWeakBiPushout( alpha, alpha );;
gap> UniversalMorphismFromWeakBiPushout( alpha, alpha, pi1, pi2 );;
gap> ## Freyd categories
> freyd := FreydCategory( cat );;
gap> IsAbelianCategory( freyd );;
gap> obj_gamma := FreydCategoryObject( gamma );;
gap> u := RandomMorphismWithFixedSource( obj_gamma, [ [5], [5] ] );;
gap> IsWellDefined( u ) and IsEqualForObjects( Source(u), obj_gamma );
true
gap> u := RandomMorphismWithFixedSource( obj_gamma, 5 );;
gap> IsWellDefined( u ) and IsEqualForObjects( Source(u), obj_gamma );
true
gap> u := RandomMorphismWithFixedRange( obj_gamma, [ [5], [5] ] );;
gap> IsWellDefined( u ) and IsEqualForObjects( Range(u), obj_gamma );
true
gap> u := RandomMorphismWithFixedRange( obj_gamma, 5 );;
gap> IsWellDefined( u ) and IsEqualForObjects( Range(u), obj_gamma );
true
gap> obj_delta := RandomObject( freyd, [[10],[10],[10]] );;
gap> obj_delta := RandomObject( freyd, 10 );;
gap> u := RandomMorphismWithFixedSourceAndRange( obj_gamma, obj_delta, [ 5 ] );;
gap> IsWellDefined( u );
true
gap> IsEqualForObjects( Source(u), obj_gamma ) and IsEqualForObjects( Range(u), obj_delta );
true
gap> u := RandomMorphismWithFixedSourceAndRange( obj_gamma, obj_delta, 5 );;
gap> IsWellDefined( u );
true
gap> IsEqualForObjects( Source(u), obj_gamma ) and IsEqualForObjects( Range(u), obj_delta );
true
gap> IsWellDefined( RandomMorphism( freyd, 5 ) );
true
gap> IsWellDefined( RandomMorphism( freyd, [[[5],[5],[5]],[[5],[5],[5]],[1]] ) );
true
gap> f := FreydCategoryMorphism( obj_gamma, gamma, obj_gamma );;
gap> witness := MorphismWitness( f );;
gap> g := FreydCategoryMorphism( obj_gamma, ZeroMorphism( obj2, obj2 ), obj_gamma );;
gap> IsCongruentForMorphisms( f, g );;
gap> c := PreCompose( f, f );;
gap> s := g + g;;
gap> a := CategoryOfRowsMorphism( obj1, HomalgMatrix( [ [ 2 ] ], 1, 1, R ), obj1 );;
gap> Z2 := FreydCategoryObject( a );;
gap> id := IdentityMorphism( Z2 );;
gap> z := id + id + id;;
gap> d := DirectSumFunctorial( [ z, z, z ] );;
gap> pr2 := ProjectionInFactorOfDirectSum( [ Z2, Z2, Z2 ], 2 );;
gap> pr3 := ProjectionInFactorOfDirectSum( [ Z2, Z2, Z2 ], 3 );;
gap> UniversalMorphismIntoDirectSum( [ pr3, pr2 ] );;
gap> inj1 := InjectionOfCofactorOfDirectSum( [ Z2, Z2, Z2 ], 1 );;
gap> inj2 := InjectionOfCofactorOfDirectSum( [ Z2, Z2, Z2 ], 2 );;
gap> UniversalMorphismFromDirectSum( [ inj2, inj1 ] );;
gap> ZFree := obj1/freyd;;
gap> id := IdentityMorphism( ZFree );;
gap> z := id + id;;
gap> CokernelProjection( z );;
gap> CokernelColift( z, CokernelProjection( z ) );;
gap> UniversalMorphismFromZeroObjectWithGivenZeroObject( obj_gamma, ZeroObject( freyd ) );;
gap> MultiplyWithElementOfCommutativeRingForMorphisms( 2 / R, f );;
gap> S := HomalgFieldOfRationalsInSingular() * "x,y,z";;
gap> Rows_S := CategoryOfRows( S );;
gap> S3 := CategoryOfRowsObject( 3, Rows_S );;
gap> S1 := CategoryOfRowsObject( 1, Rows_S );;
gap> mor := CategoryOfRowsMorphism( S3, HomalgMatrix( "[x,y,z]", 3, 1, S ), S1 );;
gap> biased_w := CategoryOfRowsMorphism( S3, HomalgMatrix( "[x,0,0,0,x,0,0,0,x]", 3, 3, S ), S3 );;
gap> biased_h := CategoryOfRowsMorphism( S3, HomalgMatrix( "[x*y, x*z, y^2]", 3, 3, S ), S3 );;
gap> BiasedWeakFiberProduct( biased_h, biased_w );;
gap> ProjectionOfBiasedWeakFiberProduct( biased_h, biased_w );;
gap> IsCongruentForMorphisms(
>    PreCompose( UniversalMorphismIntoBiasedWeakFiberProduct( biased_h, biased_w, biased_h ), ProjectionOfBiasedWeakFiberProduct( biased_h, biased_w ) ),
>    biased_h
> );
true
gap> IsCongruentForMorphisms(
>   PreCompose( InjectionOfBiasedWeakPushout( biased_h, biased_w ), UniversalMorphismFromBiasedWeakPushout( biased_h, biased_w, biased_h )),
>   biased_h
> );
true
gap> k := FreydCategoryObject( mor );;
gap> w := EpimorphismFromSomeProjectiveObjectForKernelObject( UniversalMorphismIntoZeroObject( k ) );;
gap> k := KernelEmbedding( w );;
gap> ColiftAlongEpimorphism( CokernelProjection( k ), CokernelProjection( k ) );;
gap> ## Homomorphism structures
> a := InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( gamma );;
gap> IsCongruentForMorphisms( InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( Source( a ), Range( a ), InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( a ) ), a );;
gap> a := ZeroObjectFunctorial( cat );;
gap> IsCongruentForMorphisms( InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( Source( a ), Range( a ), InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( a ) ), a );;
gap> Z4 := FreydCategoryObject( AsCategoryOfRowsMorphism( HomalgMatrix( "[4]", 1, 1, R ), cat ) );;
gap> Z3 := FreydCategoryObject( AsCategoryOfRowsMorphism( HomalgMatrix( "[3]", 1, 1, R ), cat ) );;
gap> HomomorphismStructureOnObjects( Z4, Z2 );;
gap> HomomorphismStructureOnObjects( Z4, Z4 );;
gap> HomomorphismStructureOnObjects( Z2, Z4 );;
gap> HomomorphismStructureOnObjects( Z3, Z4 );;
gap> HomomorphismStructureOnMorphisms( IdentityMorphism( DirectSum( Z4, Z2, Z3 ) ), -IdentityMorphism( DirectSum( Z4, Z3 ) ) );;
gap> ## Lifts
> S2 := CategoryOfRowsObject( 2, Rows_S );;
gap> S4 := CategoryOfRowsObject( 4, Rows_S );;
gap> S1_freyd := AsFreydCategoryObject( S1 );;
gap> S2_freyd := AsFreydCategoryObject( S2 );;
gap> S3_freyd := AsFreydCategoryObject( S3 );;
gap> S4_freyd := AsFreydCategoryObject( S4 );;
gap> lift := FreydCategoryMorphism( S1_freyd, CategoryOfRowsMorphism( S1, HomalgMatrix( "[x]", 1, 1, S ), S1 ), S1_freyd );;
gap> gamma := FreydCategoryMorphism( S1_freyd, CategoryOfRowsMorphism( S1, HomalgMatrix( "[y]", 1,1, S ), S1 ), S1_freyd );;
gap> alpha := PreCompose( lift, gamma );;
gap> IsLiftable( alpha, gamma );
true
gap> Lift( alpha, gamma );;
gap> IsColiftable( lift, alpha );
true
gap> IsCongruentForMorphisms( PreCompose( lift, Colift( lift, alpha ) ), alpha );
true
gap> lift := FreydCategoryMorphism( S2_freyd, CategoryOfRowsMorphism( S2, HomalgMatrix( "[x,y,z,x^2,1,z+1]", 2, 3, S ), S3 ), S3_freyd );;
gap> gamma := FreydCategoryMorphism( S3_freyd, CategoryOfRowsMorphism( S3, HomalgMatrix( "[x,y,z,z+1, x^2,y^2,z^2,z^2+1, x^3,y^3,z^3,z^3+1]", 3,4, S ), S4 ), S4_freyd );;
gap> alpha := PreCompose( lift, gamma );;
gap> Lift( alpha, gamma );;
gap> Colift( lift, alpha );;
gap> IsCongruentForMorphisms( PreCompose( lift, Colift( lift, alpha ) ), alpha );;
gap> interpretation := InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( gamma );;
gap> IsCongruentForMorphisms( gamma,
> InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( Source( gamma ), Range( gamma ), interpretation ) );;
gap> ## Opposite
> HomomorphismStructureOnObjects( Opposite( Z4 ), Opposite( Z2 ) );;
gap> HomomorphismStructureOnObjects( Z2, Z4 );;
gap> interpretation := InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( Opposite( gamma ) );;
gap> IsCongruentForMorphisms( Opposite( gamma ),
> InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( Source( Opposite( gamma ) ), Range( Opposite( gamma ) ), interpretation ) );
true


#### 12.4 Basics based on category of columns

gap> R := HomalgRingOfIntegers();;
gap> cat := CategoryOfColumns( R );;
gap> obj1 := CategoryOfColumnsObject( 1, cat );;
gap> obj2 := CategoryOfColumnsObject( 2, cat );;
gap> id := IdentityMorphism( obj2 );;
gap> alpha := CategoryOfColumnsMorphism( obj1, HomalgMatrix( [ [ 1 ], [ 2 ] ], 1, 2, R ), obj2 );;
gap> beta := CategoryOfColumnsMorphism( obj2, HomalgMatrix( [ [ 1, 2 ], [ 3, 4 ] ], 2, 2, R ), obj2 );;
gap> comp := PreCompose( alpha, beta );;
gap> IsZero( comp );;
gap> zero := ZeroMorphism( obj1, obj2 );;
gap> IsZero( zero );;
gap> ZeroObject( cat );;
gap> UniversalMorphismIntoZeroObject( obj2 );;
gap> UniversalMorphismFromZeroObject( obj1 );;
gap> DirectSum( obj1, obj2 );;
gap> DirectSumFunctorial( [ alpha, beta, id ] );;
gap> proj := ProjectionInFactorOfDirectSum( [ obj2, obj1, obj2 ], 2 );;
gap> IsZero( ComponentOfMorphismFromDirectSum( proj, [ obj2, obj1, obj2 ], 1 ) );
true
gap> IsOne( ComponentOfMorphismFromDirectSum( proj, [ obj2, obj1, obj2 ], 2 ) );
true
gap> IsZero( ComponentOfMorphismFromDirectSum( proj, [ obj2, obj1, obj2 ], 3 ) );
true
gap> UniversalMorphismIntoDirectSum( [ alpha, alpha, alpha ] );;
gap> inj := InjectionOfCofactorOfDirectSum( [ obj2, obj2, obj1 ], 2 );;
gap> IsZero( ComponentOfMorphismIntoDirectSum( inj, [ obj2, obj2, obj1 ], 1 ) );
true
gap> IsOne( ComponentOfMorphismIntoDirectSum( inj, [ obj2, obj2, obj1 ], 2 ) );
true
gap> IsZero( ComponentOfMorphismIntoDirectSum( inj, [ obj2, obj2, obj1 ], 3 ) );
true
gap> gamma := CategoryOfColumnsMorphism( obj2, HomalgMatrix( [ [ 1, 1 ], [ 1, 1 ] ], 2, 2, R ), obj2 );;
gap> IsColiftable( beta, gamma );
false
gap> IsColiftable( gamma, beta );
false
gap> ProjectionInFirstFactorOfWeakBiFiberProduct( gamma, gamma );;
gap> ProjectionInFirstFactorOfWeakBiFiberProduct( gamma, ZeroMorphism( Range( gamma ), Range( gamma ) ) );;
gap> lift_arg_1 := PreCompose( ProjectionInFirstFactorOfWeakBiFiberProduct( gamma, gamma + gamma ), gamma );;
gap> lift_arg_2 := gamma + gamma;;
gap> IsLiftable( lift_arg_1, lift_arg_2 );;
gap> Lift( lift_arg_1, lift_arg_2 );;
gap> pi1 := ProjectionInFirstFactorOfWeakBiFiberProduct( alpha, beta );;
gap> pi2 := ProjectionInSecondFactorOfWeakBiFiberProduct( alpha, beta );;
gap> IsEqualForMorphisms( PreCompose( pi1, alpha ), PreCompose( pi2, beta ) );;
gap> inj1 := InjectionOfFirstCofactorOfWeakBiPushout( gamma + gamma, gamma );;
gap> inj2 := InjectionOfSecondCofactorOfWeakBiPushout( gamma + gamma, gamma );;
gap> IsEqualForMorphisms( PreCompose( gamma + gamma, inj1 ), PreCompose( gamma, inj2 ) );;
gap> WeakKernelLift( WeakCokernelProjection( gamma ), gamma );;
gap> pi1 := InjectionOfFirstCofactorOfWeakBiPushout( alpha, alpha );;
gap> pi2 := InjectionOfSecondCofactorOfWeakBiPushout( alpha, alpha );;
gap> UniversalMorphismFromWeakBiPushout( alpha, alpha, pi1, pi2 );;
gap> ## Freyd categories
> freyd := FreydCategory( cat );;
gap> IsAbelianCategory( freyd );;
gap> obj_gamma := FreydCategoryObject( gamma );;
gap> f := FreydCategoryMorphism( obj_gamma, gamma, obj_gamma );;
gap> witness := MorphismWitness( f );;
gap> g := FreydCategoryMorphism( obj_gamma, ZeroMorphism( obj2, obj2 ), obj_gamma );;
gap> IsCongruentForMorphisms( f, g );;
gap> c := PreCompose( f, f );;
gap> s := g + g;;
gap> a := CategoryOfColumnsMorphism( obj1, HomalgMatrix( [ [ 2 ] ], 1, 1, R ), obj1 );;
gap> Z2 := FreydCategoryObject( a );;
gap> id := IdentityMorphism( Z2 );;
gap> z := id + id + id;;
gap> d := DirectSumFunctorial( [ z, z, z ] );;
gap> pr2 := ProjectionInFactorOfDirectSum( [ Z2, Z2, Z2 ], 2 );;
gap> pr3 := ProjectionInFactorOfDirectSum( [ Z2, Z2, Z2 ], 3 );;
gap> UniversalMorphismIntoDirectSum( [ pr3, pr2 ] );;
gap> inj1 := InjectionOfCofactorOfDirectSum( [ Z2, Z2, Z2 ], 1 );;
gap> inj2 := InjectionOfCofactorOfDirectSum( [ Z2, Z2, Z2 ], 2 );;
gap> UniversalMorphismFromDirectSum( [ inj2, inj1 ] );;
gap> ZFree := AsFreydCategoryObject( obj1 );;
gap> id := IdentityMorphism( ZFree );;
gap> z := id + id;;
gap> CokernelProjection( z );;
gap> CokernelColift( z, CokernelProjection( z ) );;
gap> S := HomalgFieldOfRationalsInSingular() * "x,y,z";;
gap> Cols_S := CategoryOfColumns( S );;
gap> S3 := CategoryOfColumnsObject( 3, Cols_S );;
gap> S1 := CategoryOfColumnsObject( 1, Cols_S );;
gap> mor := CategoryOfColumnsMorphism( S3, HomalgMatrix( "[x,y,z]", 1, 3, S ), S1 );;
gap> biased_w := CategoryOfColumnsMorphism( S3, HomalgMatrix( "[x,0,0,0,x,0,0,0,x]", 3, 3, S ), S3 );;
gap> biased_h := CategoryOfColumnsMorphism( S3, HomalgMatrix( "[x*y, x*z, y^2]", 3, 3, S ), S3 );;
gap> BiasedWeakFiberProduct( biased_h, biased_w );;
gap> ProjectionOfBiasedWeakFiberProduct( biased_h, biased_w );;
gap> IsCongruentForMorphisms(
>    PreCompose( UniversalMorphismIntoBiasedWeakFiberProduct( biased_h, biased_w, biased_h ), ProjectionOfBiasedWeakFiberProduct( biased_h, biased_w ) ),
>    biased_h
> );
true
gap> IsCongruentForMorphisms(
>   PreCompose( InjectionOfBiasedWeakPushout( biased_h, biased_w ), UniversalMorphismFromBiasedWeakPushout( biased_h, biased_w, biased_h )),
>   biased_h
> );
true
gap> k := FreydCategoryObject( mor );;
gap> w := EpimorphismFromSomeProjectiveObjectForKernelObject( UniversalMorphismIntoZeroObject( k ) );;
gap> k := KernelEmbedding( w );;
gap> ColiftAlongEpimorphism( CokernelProjection( k ), CokernelProjection( k ) );;
gap> ## Homomorphism structures
> a := InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( gamma );;
gap> IsCongruentForMorphisms( InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( Source( a ), Range( a ), InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( a ) ), a );;
gap> a := ZeroObjectFunctorial( cat );;
gap> IsCongruentForMorphisms( InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( Source( a ), Range( a ), InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( a ) ), a );;
gap> Z4 := FreydCategoryObject( AsCategoryOfColumnsMorphism( HomalgMatrix( "[4]", 1, 1, R ), cat ) );;
gap> Z3 := FreydCategoryObject( AsCategoryOfColumnsMorphism( HomalgMatrix( "[3]", 1, 1, R ), cat ) );;
gap> HomomorphismStructureOnObjects( Z4, Z2 );;
gap> HomomorphismStructureOnObjects( Z4, Z4 );;
gap> HomomorphismStructureOnObjects( Z2, Z4 );;
gap> HomomorphismStructureOnObjects( Z3, Z4 );;
gap> HomomorphismStructureOnMorphisms( IdentityMorphism( DirectSum( Z4, Z2, Z3 ) ), -IdentityMorphism( DirectSum( Z4, Z3 ) ) );;
gap> ## Lifts
> S2 := CategoryOfColumnsObject( 2, Cols_S );;
gap> S4 := CategoryOfColumnsObject( 4, Cols_S );;
gap> S1_freyd := AsFreydCategoryObject( S1 );;
gap> S2_freyd := AsFreydCategoryObject( S2 );;
gap> S3_freyd := AsFreydCategoryObject( S3 );;
gap> S4_freyd := AsFreydCategoryObject( S4 );;
gap> lift := FreydCategoryMorphism( S1_freyd, CategoryOfColumnsMorphism( S1, HomalgMatrix( "[x]", 1, 1, S ), S1 ), S1_freyd );;
gap> gamma := FreydCategoryMorphism( S1_freyd, CategoryOfColumnsMorphism( S1, HomalgMatrix( "[y]", 1,1, S ), S1 ), S1_freyd );;
gap> alpha := PreCompose( lift, gamma );;
gap> Lift( alpha, gamma );;
gap> Colift( lift, alpha );;
gap> IsCongruentForMorphisms( PreCompose( lift, Colift( lift, alpha ) ), alpha );;
gap> lift := FreydCategoryMorphism( S2_freyd, CategoryOfColumnsMorphism( S2, HomalgMatrix( "[x,y,z,x^2,1,z+1]", 3, 2, S ), S3 ), S3_freyd );;
gap> gamma := FreydCategoryMorphism( S3_freyd, CategoryOfColumnsMorphism( S3, HomalgMatrix( "[x,y,z,z+1, x^2,y^2,z^2,z^2+1, x^3,y^3,z^3,z^3+1]", 4,3, S ), S4 ), S4_freyd );;
gap> alpha := PreCompose( lift, gamma );;
gap> Lift( alpha, gamma );;
gap> Colift( lift, alpha );;
gap> IsCongruentForMorphisms( PreCompose( lift, Colift( lift, alpha ) ), alpha );;
gap> interpretation := InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( gamma );;
gap> IsCongruentForMorphisms( gamma,
> InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( Source( gamma ), Range( gamma ), interpretation ) );;
gap> ## Opposite
> HomomorphismStructureOnObjects( Opposite( Z4 ), Opposite( Z2 ) );;
gap> HomomorphismStructureOnObjects( Z2, Z4 );;
gap> interpretation := InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( Opposite( gamma ) );;
gap> IsCongruentForMorphisms( Opposite( gamma ),
> InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism( Source( Opposite( gamma ) ), Range( Opposite( gamma ) ), interpretation ) );
true


#### 12.5 CoFreyd category

gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> ZZZ := HomalgRingOfIntegers( );;
gap> rows := CategoryOfRows( ZZZ );;
gap> co_freyd := CoFreydCategory( rows );
CoFreyd( Rows( Z ) )
gap> rows_obj := CategoryOfRowsObject( rows, 1 );; # ZZZ^1
gap> co_freyd_obj := AsCoFreydCategoryObject( rows_obj );; # ZZZ^1 -> 0
gap> rows_mor := CategoryOfRowsMorphism( rows, rows_obj, HomalgMatrix( [ 2 ], 1, 1, ZZZ ), rows_obj );; # ZZZ^1 --2-> ZZZ^1
gap> co_freyd_mor := CoFreydCategoryMorphism( co_freyd_obj, rows_mor, co_freyd_obj );;
gap> IsWellDefined( co_freyd_mor );
true
gap> Display( KernelObject( co_freyd_mor ) );

--------------------------------
CoRelation morphism:
--------------------------------

Source:
A row module over Z of rank 1

Matrix:
[ [  2 ] ]

Range:
A row module over Z of rank 1

A morphism in Rows( Z )

--------------------------------
General description:
--------------------------------

An object in CoFreyd( Rows( Z ) )

gap> Display( UnderlyingMorphism( KernelEmbedding( co_freyd_mor ) ) );
Source:
A row module over Z of rank 1

Matrix:
[ [  1 ] ]

Range:
A row module over Z of rank 1

An identity morphism in Rows( Z )
gap> Display( CokernelObject( co_freyd_mor ) );

--------------------------------
CoRelation morphism:
--------------------------------

Source:
A row module over Z of rank 0

Matrix:
(an empty 0 x 0 matrix)

Range:
A row module over Z of rank 0

A zero, split epi-, split monomorphism in Rows( Z )

--------------------------------
General description:
--------------------------------

An object in CoFreyd( Rows( Z ) )

gap> Display( UnderlyingMorphism( CokernelProjection( co_freyd_mor ) ) );
Source:
A row module over Z of rank 1

Matrix:
(an empty 1 x 0 matrix)

Range:
A row module over Z of rank 0

A zero, split epimorphism in Rows( Z )


#### 12.6 Cokernel image closure in category of rows

gap> R := HomalgFieldOfRationalsInSingular() * "x,y,z";;
gap> RowsR := CategoryOfRows( R );;
gap> m := AsCategoryOfRowsMorphism(
>     HomalgMatrix( "[[x],[y],[z]]", 3, 1, R ), RowsR
> );;
gap> mu := AsCokernelImageClosureMorphism( m );;
gap> C := CokernelObject( mu );;
gap> C2 := AsFinitelyPresentedCokernelImageClosureObject( m );;
gap> IsEqualForObjects( C, C2 );
true
gap> n := AsCategoryOfRowsMorphism(
>     HomalgMatrix( "[[x,y],[y^2,z]]", 2, 2, R ), RowsR
> );;
gap> nu := AsCokernelImageClosureMorphism( n );;
gap> nu2 := PreCompose( nu, nu );;
gap> IsWellDefined( nu2 );
true
gap> IsCongruentForMorphisms( nu, nu2 );
false
gap> nu + nu;;
gap> nu2 - nu;;
gap> cat := CapCategory( nu );;
gap> ZeroObject( cat );;
gap> ZeroMorphism( Source( nu ), Source( mu ) );;
gap> UniversalMorphismIntoZeroObject( Source( nu ) );;
gap> UniversalMorphismFromZeroObject( Source( nu ) );;
gap> S := Source( mu );;
gap> DirectSum( [S, S, S ] );;
gap> DirectSumFunctorial( [ nu2, nu ] );;
gap> UniversalMorphismIntoDirectSum( [ nu, nu ] );;
gap> UniversalMorphismFromDirectSum( [ nu, nu ] );;
gap> ProjectionInFactorOfDirectSum( [ S, S, S ], 2 );;
gap> InjectionOfCofactorOfDirectSum( [ S, S, S, S ], 4 );;
gap> CokernelColift( nu, CokernelProjection( nu ) );;
gap> IsCongruentForMorphisms( nu, PreCompose( CoastrictionToImage( nu ), ImageEmbedding( nu ) ) );
true
gap> u := UniversalMorphismFromImage( nu, [ nu, IdentityMorphism( Range( nu ) ) ] );;
gap> IsWellDefined( u );
true
gap> IsCongruentForMorphisms( nu, PreCompose( CoastrictionToImage( nu ), u ) );
true
gap> IsCongruentForMorphisms( u, ImageEmbedding( nu ) );
true
gap> kernel := KernelObject( mu );;
gap> emb := KernelEmbedding( mu );;
gap> p := PreCompose( EpimorphismFromSomeProjectiveObject( kernel ), KernelEmbedding( mu ) );;
gap> KernelLift( mu, p );;
gap> LiftAlongMonomorphism( emb, p );;
gap> I_to_A := FunctorCokernelImageClosureToFreydCategory( RowsR );;
gap> A_to_I := FunctorFreydCategoryToCokernelImageClosure( RowsR );;
gap> ApplyFunctor( I_to_A, kernel );;
gap> ApplyFunctor( A_to_I, ApplyFunctor( I_to_A, kernel ) );;
gap> nu := NaturalIsomorphismFromIdentityToFinitePresentationOfCokernelImageClosureObject( RowsR );;
gap> mu := NaturalIsomorphismFromFinitePresentationOfCokernelImageClosureObjectToIdentity( RowsR );;
gap> IsCongruentForMorphisms(
>     IdentityMorphism( kernel ),
>     PreCompose( ApplyNaturalTransformation( nu, kernel ), ApplyNaturalTransformation( mu, kernel ) )
> );
true


#### 12.7 Cokernel image closure in category of columns

gap> R := HomalgFieldOfRationalsInSingular() * "x,y,z";;
gap> ColsR := CategoryOfColumns( R );;
gap> m := AsCategoryOfColumnsMorphism(
>      HomalgMatrix( "[[x],[y],[z]]", 1, 3, R ), ColsR
> );;
gap> mu := AsCokernelImageClosureMorphism( m );;
gap> C := CokernelObject( mu );;
gap> C2 := AsFinitelyPresentedCokernelImageClosureObject( m );;
gap> IsEqualForObjects( C, C2 );
true
gap> n := AsCategoryOfColumnsMorphism(
>     HomalgMatrix( "[[x,y],[y^2,z]]", 2, 2, R ), ColsR
> );;
gap> nu := AsCokernelImageClosureMorphism( n );;
gap> nu2 := PreCompose( nu, nu );;
gap> IsWellDefined( nu2 );
true
gap> IsCongruentForMorphisms( nu, nu2 );
false
gap> nu + nu;;
gap> nu2 - nu;;
gap> cat := CapCategory( nu );;
gap> ZeroObject( cat );;
gap> ZeroMorphism( Source( nu ), Source( mu ) );;
gap> UniversalMorphismIntoZeroObject( Source( nu ) );;
gap> UniversalMorphismFromZeroObject( Source( nu ) );;
gap> S := Source( mu );;
gap> DirectSum( [S, S, S ] );;
gap> DirectSumFunctorial( [ nu2, nu ] );;
gap> UniversalMorphismIntoDirectSum( [ nu, nu ] );;
gap> UniversalMorphismFromDirectSum( [ nu, nu ] );;
gap> ProjectionInFactorOfDirectSum( [ S, S, S ], 2 );;
gap> InjectionOfCofactorOfDirectSum( [ S, S, S, S ], 4 );;
gap> CokernelColift( nu, CokernelProjection( nu ) );;
gap> IsCongruentForMorphisms( nu, PreCompose( CoastrictionToImage( nu ), ImageEmbedding( nu ) ) );
true
gap> u := UniversalMorphismFromImage( nu, [ nu, IdentityMorphism( Range( nu ) ) ] );;
gap> IsWellDefined( u );
true
gap> IsCongruentForMorphisms( nu, PreCompose( CoastrictionToImage( nu ), u ) );
true
gap> IsCongruentForMorphisms( u, ImageEmbedding( nu ) );
true
gap> kernel := KernelObject( mu );;
gap> emb := KernelEmbedding( mu );;
gap> p := PreCompose( EpimorphismFromSomeProjectiveObject( kernel ), KernelEmbedding( mu ) );;
gap> KernelLift( mu, p );;
gap> LiftAlongMonomorphism( emb, p );;
gap> I_to_A := FunctorCokernelImageClosureToFreydCategory( ColsR );;
gap> A_to_I := FunctorFreydCategoryToCokernelImageClosure( ColsR );;
gap> ApplyFunctor( I_to_A, kernel );;
gap> ApplyFunctor( A_to_I, ApplyFunctor( I_to_A, kernel ) );;
gap> nu := NaturalIsomorphismFromIdentityToFinitePresentationOfCokernelImageClosureObject( ColsR );;
gap> mu := NaturalIsomorphismFromFinitePresentationOfCokernelImageClosureObjectToIdentity( ColsR );;
gap> IsCongruentForMorphisms(
>     IdentityMorphism( kernel ),
>     PreCompose( ApplyNaturalTransformation( nu, kernel ), ApplyNaturalTransformation( mu, kernel ) )
> );
true


#### 12.8 Adelman category basics

gap> R := HomalgRingOfIntegers();;
gap> RowsR := CategoryOfRows( R );;
gap> one := AsCategoryOfRowsMorphism( HomalgMatrix( [ [ 1 ] ], 1, 1, R ), RowsR );;
gap> two := AsCategoryOfRowsMorphism( HomalgMatrix( [ [ 2 ] ], 1, 1, R ), RowsR );;
gap> four := AsCategoryOfRowsMorphism( HomalgMatrix( [ [ 4 ] ], 1, 1, R ), RowsR );;
gap> source := AdelmanCategoryObject( two, two );;
gap> range := AdelmanCategoryObject( two, four );;
gap> mor := AdelmanCategoryMorphism( source, one, range );;
gap> IsZero( mor );
false
gap> emb := EmbeddingFunctorIntoFreydCategory( RowsR );;
gap> ind := AdelmanCategoryFunctorInducedByUniversalProperty( emb );;
gap> IsZero( ApplyFunctor( ind, mor ) );
true
gap> M := FreydCategoryObject( AsCategoryOfRowsMorphism( HomalgMatrix( [ [  2, 2, 2 ], [ 4, 4, 6 ] ], 2, 3, R ), RowsR ) );;
gap> as_tensor := EmbeddingFunctorOfFreydCategoryIntoAdelmanCategory( RowsR );;
gap> Mt := ApplyFunctor( as_tensor, M );;
gap> lsat := LeftSatelliteAsEndofunctorOfAdelmanCategory( RowsR );;
gap> rsat := RightSatelliteAsEndofunctorOfAdelmanCategory( RowsR );;
gap> torsion := ApplyFunctor( ind, ( ApplyFunctor( rsat, ApplyFunctor( lsat, Mt ) ) ) );;
gap> IsZero( ApplyNaturalTransformation( unit, Mt ) );
true
gap> t := ApplyNaturalTransformation( counit, Mt );;


#### 12.9 Grade filtration

The sequence of modules computed via satellites behaves in a way that is not understood in the case when the ring is not Auslander regular.

gap> R := HomalgFieldOfRationalsInSingular() * "x,y";;
gap> R := R/"x*y"/"x^2";;
gap> RowsR := CategoryOfRows( R );;
gap> Freyd := FreydCategory( RowsR );;
gap> mat := HomalgMatrix( "[x,y]", 1, 2, R );;
gap> M := mat/Freyd;;
gap> mu1 := GradeFiltrationNthMonomorphism( M, 1 );;
gap> IsMonomorphism( mu1 );
true
gap> IsZero( mu1 );
false
gap> IsEpimorphism( mu1 );
false
gap> mu2 := GradeFiltrationNthMonomorphism( M, 2 );;
gap> IsIsomorphism( mu2 );
true
gap> IsZero( mu2 );
false
gap> mu3 := GradeFiltrationNthMonomorphism( M, 3 );;
gap> IsIsomorphism( mu3 );
true
gap> IsZero( mu3 );
false
gap> mu4 := GradeFiltrationNthMonomorphism( M, 4 );;
gap> IsMonomorphism( mu4 );
false
gap> IsEpimorphism( mu4 );
true
gap> IsZero( mu4 );
false

gap> Qxyz := HomalgFieldOfRationalsInDefaultCAS( ) * "x,y,z";;
gap> wmat := HomalgMatrix( "[ \
> x*y,  y*z,    z,        0,         0,    \
> x^3*z,x^2*z^2,0,        x*z^2,     -z^2, \
> x^4,  x^3*z,  0,        x^2*z,     -x*z, \
> 0,    0,      x*y,      -y^2,      x^2-1,\
> 0,    0,      x^2*z,    -x*y*z,    y*z,  \
> 0,    0,      x^2*y-x^2,-x*y^2+x*y,y^2-y \
> ]", 6, 5, Qxyz );;
gap> RowsR := CategoryOfRows( Qxyz );;
gap> Freyd := FreydCategory( RowsR );;
gap> M := wmat/Freyd;;


We compute the grade sequence of functors (it turns out that on the level of functors, we don't get monos)

gap> M_tor := M/Adel;;
gap> Mu1 := GradeFiltrationNthNaturalTransformationComponent( M_tor, 1 );;
gap> IsZero( Mu1 );
false
gap> IsMonomorphism( Mu1 );
true
gap> Mu2 := GradeFiltrationNthNaturalTransformationComponent( M_tor, 2 );;
gap> IsZero( Mu2 );
false
gap> IsMonomorphism( Mu2 );
false
gap> Mu3 := GradeFiltrationNthNaturalTransformationComponent( M_tor, 3 );;
gap> IsZero( Mu3 );
false
gap> IsMonomorphism( Mu3 );
false
gap> Mu4 := GradeFiltrationNthNaturalTransformationComponent( M_tor, 4 );;
gap> IsZero( Mu4 );
true


We compute the grade sequence of modules (here, we really get monos and thus a filtration)

gap> mu1 := GradeFiltrationNthMonomorphism( M, 1 );;
gap> IsZero( mu1 );
false
gap> IsMonomorphism( mu1 );
true
gap> mu2 := GradeFiltrationNthMonomorphism( M, 2 );;
gap> IsZero( mu2 );
false
gap> IsMonomorphism( mu2 );
true
gap> mu3 := GradeFiltrationNthMonomorphism( M, 3 );;
gap> IsZero( mu3 );
false
gap> IsMonomorphism( mu3 );
true
gap> mu4 := GradeFiltrationNthMonomorphism( M, 4 );;
gap> IsZero( mu4 );
true


#### 12.10 Groups as categories

#@if IsPackageMarkedForLoading( "FinSetsForCAP", ">= 2023.07-03" )
gap> G := SymmetricGroup( 3 );;
gap> CG := GroupAsCategory( G );;
gap> u := GroupAsCategoryUniqueObject( CG );;
gap> alpha := GroupAsCategoryMorphism( (1,2,3), CG );;
gap> alpha * Inverse( alpha ) = IdentityMorphism( u );
true
gap> beta := GroupAsCategoryMorphism( (1,2,3,5), CG );;
gap> IsWellDefined( beta );
false
gap> gamma := GroupAsCategoryMorphism( (1,3), CG );;
gap> IsWellDefined( gamma );
true
gap> Lift( alpha, gamma ) * gamma = alpha;
true
gap> alpha * Colift( alpha, gamma ) = gamma;
true
gap> Length( HomomorphismStructureOnObjects( u, u ) ) = Size( G );
true
gap> InterpretMorphismFromDistinguishedObjectToHomomorphismStructureAsMorphism(
>     u,u,
>     PreCompose(
>         InterpretMorphismAsMorphismFromDistinguishedObjectToHomomorphismStructure( alpha ), HomomorphismStructureOnMorphisms( gamma, Inverse( gamma ) )
>     )
> )
> =
> gamma * alpha * Inverse( gamma );
true
gap> x := (2,3)/CG;;
gap> id := ()/CG;;
gap> IsIdenticalObj( x * x, id );
true
#@fi


#### 12.11 Homomorphisms between f.p. functors based on category of rows

gap> R := HomalgFieldOfRationalsInSingular() * "x,y,z";;
gap> Rows_R := CategoryOfRows( R );;
gap> R1 := CategoryOfRowsObject( 1, Rows_R );;
gap> R3 := CategoryOfRowsObject( 3, Rows_R );;
gap> alpha := CategoryOfRowsMorphism( R3, HomalgMatrix( "[x,y,z]", 3, 1, R ), R1 );;
gap> M := FreydCategoryObject( alpha );;
gap> c0 := CovariantExtAsFreydCategoryObject( M, 0 );;
gap> c1 := CovariantExtAsFreydCategoryObject( M, 1 );;
gap> c2 := CovariantExtAsFreydCategoryObject( M, 2 );;
gap> IsZeroForObjects( HomomorphismStructureOnObjects( c0, c2 ) ); # = Ext^2( M, M )
false


#### 12.12 Homomorphisms between f.p. functors based on category of columns

gap> R := HomalgFieldOfRationalsInSingular() * "x,y,z";;
gap> Cols_R := CategoryOfColumns( R );;
gap> R1 := CategoryOfColumnsObject( 1, Cols_R );;
gap> R3 := CategoryOfColumnsObject( 3, Cols_R );;
gap> alpha := CategoryOfColumnsMorphism( R3, HomalgMatrix( "[x,y,z]", 1, 3, R ), R1 );;
gap> M := FreydCategoryObject( alpha );;
gap> c0 := CovariantExtAsFreydCategoryObject( M, 0 );;
gap> c1 := CovariantExtAsFreydCategoryObject( M, 1 );;
gap> c2 := CovariantExtAsFreydCategoryObject( M, 2 );;
gap> IsZeroForObjects( HomomorphismStructureOnObjects( c0, c2 ) ); # = Ext^2( M, M )
false


#### 12.13 Linear closure of categories

#@if IsPackageMarkedForLoading( "FinSetsForCAP", ">= 2023.07-03" )
gap> G := SymmetricGroup( 3 );;
gap> CG := GroupAsCategory( G );;
gap> compare_func := function( g, h ) return UnderlyingGroupElement( g ) < UnderlyingGroupElement( h ); end;;
gap> ZZZ := HomalgRingOfIntegers();;
gap> ZCG := LinearClosure( ZZZ, CG, compare_func );;
gap> u := GroupAsCategoryUniqueObject( CG );;
gap> g := GroupAsCategoryMorphism( (1,2,3), CG );;
gap> h := GroupAsCategoryMorphism( (1,2), CG );;
gap> v := LinearClosureObject( ZCG, u );;
gap> elem1 := LinearClosureMorphism( v, [ 1, 2, 3, 4, 5, 6 ], [ g, h, g, h, g, h ], v );;
gap> elem2 := LinearClosureMorphism( v, [ 1, 2, 3, 4, 5, 6 ], [ h, g, h, g, h, g ], v );;
gap> # for i in [ 1 .. 10^6 ] do LinearClosureMorphism( v, [ 1, 2, 3, 4, 5, 6 ], [ g, h, g, h, g, h ], v ); od;
gap> elem := LinearClosureMorphism( v, [ 0, 0, 0, 0, 0, 0 ], [ g, h, g, h, g, h ], v );;
gap> a := (1,2)/CG/ZCG;;
gap> b := (2,3)/CG/ZCG;;
gap> IsIsomorphism( a + b );
false
gap> Lift( a + b, a ) * a = a + b;
true
gap> IsLiftable( a + b, -2*a ); ## over Q this is liftable
false
#@fi


#### 12.14 Matrices over ZP K

#@if IsPackageMarkedForLoading( "FinSetsForCAP", ">= 2023.07-03" )
gap> #Incidence matrix of our proset
> K := [ [1, 1, 1], [0, 1, 1], [0, 1, 1] ];;
gap> #Construction of a tower of categories
> CP_K := ProSetAsCategory( K );;
gap> ZZZ := HomalgRingOfIntegers( );;
gap> ZP_K := LinearClosure( ZZZ, CP_K, ReturnTrue );;
gap> RowsP_K := AdditiveClosure( ZP_K );;
gap> a := ProSetAsCategoryObject( 1, CP_K );;
gap> b := ProSetAsCategoryObject( 2, CP_K );;
gap> c := ProSetAsCategoryObject( 3, CP_K );;
gap> #Three random objects in the additive closure
> #Such that there exists morphisms from A->B and B->C:
> rand_coef := List( [ 1 .. 5 ], i -> Random( [ 2 .. 20 ] ) );;
gap> A1 := List( [ 1 .. rand_coef[ 1 ] ], i -> a );;
gap> A2 := List( [ 1 .. rand_coef[ 2 ] ], i -> b );;
gap> A := Concatenation( A1, A2 );;
gap> B1 := List( [ 1 .. rand_coef[ 3 ] ], i -> b );;
gap> B2 := List( [ 1 .. rand_coef[ 4 ] ], i -> c );;
gap> B :=  Concatenation( B1, B2 );;
gap> C := List([ 1 .. rand_coef[ 5 ] ], i -> c);;
gap> #A random lifting problem over ZP_K
> MA_B :=  List( [ 1 .. rand_coef[ 1 ] + rand_coef[ 2 ] ], i ->
>             List( [ 1 .. rand_coef[ 3 ] + rand_coef[ 4 ] ], j ->
>                 LinearClosureMorphism( LinearClosureObject( A[i], ZP_K ), [Random( [ -20 .. 20 ] )], [ProSetAsCategoryMorphism( A[i], B[j] )], LinearClosureObject( B[j], ZP_K ) )
>                 )
>               );;
gap> alpha := MA_B/RowsP_K;;
gap> MB_C :=  List( [ 1 .. rand_coef[ 3 ] + rand_coef[ 4 ] ], i ->
>             List( [ 1 .. rand_coef[ 5 ] ], j ->
>                 LinearClosureMorphism( LinearClosureObject( B[i], ZP_K ), [Random( [ -20 .. 20 ] )], [ProSetAsCategoryMorphism( B[i], C[j] )], LinearClosureObject( C[j], ZP_K ) )
>                 )
>              );;
gap> beta := MB_C/RowsP_K;;
gap> gamma := PreCompose( alpha, beta );;
gap> lift := Lift( gamma, beta );;
gap> PreCompose(lift, beta) = gamma;
true
#@fi


#### 12.15 Matrices over ZG

Construction of a tower of categories

#@if IsPackageMarkedForLoading( "FinSetsForCAP", ">= 2023.07-03" )
gap> G := SymmetricGroup( 3 );;
gap> CG := GroupAsCategory( G );;
gap> ZZZ := HomalgRingOfIntegers( );;
gap> ZCG := LinearClosure( ZZZ, CG );;
gap> RowsG := AdditiveClosure( ZCG );;
#@fi


Construction of elements

#@if IsPackageMarkedForLoading( "FinSetsForCAP", ">= 2023.07-03" )
gap> a := (1,2)/CG/ZCG;;
gap> b := (2,3)/CG/ZCG;;
gap> e := ()/CG/ZCG;;
gap> omega := [ [ a - e ], [ b - e ] ]/RowsG;;
gap> u := GroupAsCategoryUniqueObject( CG );;
gap> v := LinearClosureObject( ZCG, u );;
gap> u := AsAdditiveClosureObject( v );;
gap> HomStructure( u, omega );;
#@fi


A random lifting problem over ZG

#@if IsPackageMarkedForLoading( "FinSetsForCAP", ">= 2023.07-03" )
gap> elem := Elements( G );;
gap> elem := List( elem, x -> x/CG/ZCG );;
gap> rand_elem := function() local coeffs; coeffs := List( [ 1 .. 6 ], i -> Random( [ -20 .. 20 ] ) ); if ForAll( coeffs, IsZero ) then return ZeroMorphism( v, v ); fi; return Sum( List( [ 1 .. 6 ], i -> Random( [ -20 .. 20 ] ) * One( ZZZ ) * elem[i] ) ); end;;
gap> mat10_11 := List( [ 1 .. 10 ], i ->
>         List( [ 1 .. 11 ], j ->
>             rand_elem()
>         )
>     );;
gap> mat11_12 := List( [ 1 .. 11 ], i ->
>         List( [ 1 .. 12 ], j ->
>             rand_elem()
>         )
>     );;
gap> alpha := mat10_11/RowsG;;
gap> beta := mat11_12/RowsG;;
gap> gamma := PreCompose( alpha, beta );;
gap> lift := Lift( gamma, beta );;
gap> PreCompose( lift, beta ) = gamma;
true
#@fi


#### 12.16 Opposite( CategoryOfRow ) as CategoryOfColumns

Assume that we have the constructors CategoryOfRows and CategoryOfColumns but no constructor Opposite. Then we can still model Opposite( CategoryOfRows ) as CategoryOfColumns using ReinterpretationOfCategory. This can be achieved up to minor modifications by swapping object_constructor and modeling_tower_object_constructor and so on in CategoryOfColumsAsOppositeOfCategoryOfRows. With this, objects and morphisms indeed have the attribute Opposite as desired. Getting ObjectDatum and MorphismDatum to return this attribute would also be possible, but would require more effort than simply swapping object_constructor and modeling_tower_object_constructor and so.

gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> QQ := HomalgFieldOfRationals( );;
gap> cols := CategoryOfColumns( QQ );;
gap> rows := CategoryOfRows( QQ );;
gap> object_constructor :=
>     { cat, rank } -> CreateCapCategoryObjectWithAttributes( cat,
>                                                             Opposite, CategoryOfRowsObject( Opposite( cat ), rank )
>     );;
gap> modeling_tower_object_constructor :=
>     { cat, rank } -> CreateCapCategoryObjectWithAttributes( ModelingCategory( cat ),
>                                                             RankOfObject, rank
>     );;
gap> object_datum := { cat, obj } -> RankOfObject( Opposite( obj ) );;
gap> modeling_tower_object_datum := { cat, obj } -> RankOfObject( obj );;
gap> morphism_constructor :=
>     { cat, source, underlying_matrix, range } ->
>         CreateCapCategoryMorphismWithAttributes(
>             cat,
>             source, range,
>             Opposite, CategoryOfRowsMorphism(
>                 Opposite( cat ),
>                 Opposite( range ),
>                 underlying_matrix,
>                 Opposite( source )
>             )
>         );;
gap> modeling_tower_morphism_constructor :=
>     { cat, source, underlying_matrix, range } ->
>         CreateCapCategoryMorphismWithAttributes(
>             ModelingCategory( cat ),
>             source, range,
>             UnderlyingMatrix, underlying_matrix
>         );;
gap> morphism_datum := { cat, mor } -> UnderlyingMatrix( Opposite( mor ) );;
gap> modeling_tower_morphism_datum := { cat, mor } -> UnderlyingMatrix( mor );;
gap> op := ReinterpretationOfCategory( cols, rec(
>     name := Concatenation( "Opposite( ", Name( rows )," )" ),
>     category_filter := WasCreatedAsOppositeCategory,
>     category_object_filter := IsCapCategoryOppositeObject,
>     category_morphism_filter := IsCapCategoryOppositeMorphism,
>     object_constructor := object_constructor,
>     object_datum := object_datum,
>     morphism_constructor := morphism_constructor,
>     morphism_datum := morphism_datum,
>     modeling_tower_object_constructor := modeling_tower_object_constructor,
>     modeling_tower_object_datum := modeling_tower_object_datum,
>     modeling_tower_morphism_constructor := modeling_tower_morphism_constructor,
>     modeling_tower_morphism_datum := modeling_tower_morphism_datum,
>     only_primitive_operations := true,
> ) );
Opposite( Rows( Q ) )
gap> SetOpposite( op, rows );
gap> source := ObjectConstructor( op, 1 );
<An object in Opposite( Rows( Q ) )>
gap> range := ObjectConstructor( op, 2 );
<An object in Opposite( Rows( Q ) )>
gap> zero := ZeroMorphism( source, range );
<A zero morphism in Opposite( Rows( Q ) )>
gap> sum := AdditionForMorphisms( zero, zero );
<A morphism in Opposite( Rows( Q ) )>
gap> # notice that source and range are indeed swapped compared to the above
> Display( Opposite( sum ) );
Source:
A row module over Q of rank 2

Matrix:
[ [  0 ],
[  0 ] ]

Range:
A row module over Q of rank 1

A morphism in Rows( Q )


#### 12.17 Testing if an object is projective, injective, bijective, and computing projective/injective dimensions

gap> R := HomalgRingOfIntegers();;
gap> rows := CategoryOfRows( R );;
gap> rowobj := CategoryOfRowsObject( 1, rows );;
gap> alpha := ProjectionInFactorOfDirectSum( [ rowobj, rowobj ], 1 );;
gap> alpha := AsAdelmanCategoryMorphism( alpha );;
gap> obj := CokernelObject( alpha );;
gap> IsBijectiveObject( obj );
true
gap> beta := 2 * IdentityMorphism( rowobj );;
gap> beta := AsAdelmanCategoryMorphism( beta );;
gap> obj1 := CokernelObject( beta );;
gap> obj2 := KernelObject( beta );;
gap> obj3 := ImageObject( beta );;
gap> obj4 := HomologyObject( beta, beta );;
gap> IsBijectiveObject( obj1 );
false
gap> IsInjective( obj1 );
true
gap> ProjectiveDimension( obj1 );
2
gap> IsBijectiveObject( obj2 );
false
gap> IsProjective( obj2 );
true
gap> InjectiveDimension( obj2 );
2
gap> ProjectiveDimension( obj3 );
1
gap> InjectiveDimension( obj3 );
1
gap> ProjectiveDimension( obj4 );
2
gap> InjectiveDimension( obj4 );
2


#### 12.18 Prosets

#@if IsPackageMarkedForLoading( "FinSetsForCAP", ">= 2023.07-03" )
gap> K := [ [1, 1, 1], [0, 1, 1], [0, 1, 1] ];;
gap> L := [ [1, 1, 0], [0, 1, 1], [0, 0, 1] ];;
gap> P_K := ProSetAsCategory(K);;
gap> #ProSetAsCategory(L);
gap> a := 1/P_K;;
gap> b := ProSetAsCategoryObject(2, P_K);;
gap> c := ProSetAsCategoryObject(3, P_K);;
gap> d := ProSetAsCategoryObject(4, P_K);;
gap> delta := ProSetAsCategoryMorphism(b, a);;
gap> IsWellDefined(a);
true
gap> IsWellDefined(d);
false
gap> IsWellDefined(delta);
false
gap> alpha := ProSetAsCategoryMorphism(a, b);;
gap> beta := ProSetAsCategoryMorphism(b, c);;
gap> gamma := ProSetAsCategoryMorphism(a, c);;
gap> gamma = PreCompose(alpha, beta);
true
gap> id_a := IdentityMorphism(a);;
gap> IsWellDefined(Inverse(alpha));
false
gap> beta*Inverse(beta) = IdentityMorphism(b);
true
gap> alpha = Lift(gamma, beta);
true
gap> IsLiftable(beta, gamma);
false
gap> Colift(alpha, gamma) = beta;
true
gap> alpha = HomStructure(a, b, HomStructure(alpha));
true
#@fi


#### 12.19 Tests

gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> R := HomalgRingOfIntegers( ) ;;
gap> cat := CategoryOfColumns( R );;
gap> A := RandomObjectByInteger( cat, 2 );;
gap> B := RandomObjectByInteger( cat, 2 );;
gap> mor1 := RandomMorphismByInteger( cat, 2 );;
gap> mor2 := RandomMorphismWithFixedSourceByInteger( cat, CategoryOfColumnsObject( cat, 3 ), 2 );;
gap> mor3 := RandomMorphismWithFixedRangeByInteger( cat, CategoryOfColumnsObject( cat, 3 ), 2 );;
gap> mor4 := RandomMorphismWithFixedSourceAndRangeByInteger( cat, CategoryOfColumnsObject( cat, 3 ), CategoryOfColumnsObject( cat, 4 ), 2 );;
gap> RankOfObject( Source( mor2 ) ) = 3;
true
gap> RankOfObject( Range( mor3 ) ) = 3;
true
gap> RankOfObject( Source( mor4 ) ) = 3;
true
gap> RankOfObject( Range( mor4 ) ) = 4;
true

gap> LoadPackage( "FreydCategoriesForCAP", false );
true
gap> QQ := HomalgFieldOfRationalsInSingular( );;
gap> QQxy := QQ * "x,y";;
gap> EQQxy := KoszulDualRing( QQxy );;
gap> R := KoszulDualRing( HomalgRingOfIntegersInSingular( ) * "x,y" );;
gap> CAP_INTERNAL_GENERATE_DOCUMENTATION_FOR_CATEGORY_INSTANCES(
>     [
>         [ CategoryOfRows( R ), "CategoryOfRows of an arbitrary ring" ],
>         [ CategoryOfRows( EQQxy ), "CategoryOfRows of an exterior algebra over a field" ],
>         [ CategoryOfRows( QQxy ), "CategoryOfRows of a commutative ring" ],
>         [ CategoryOfRows( QQ ), "CategoryOfRows of a field" ],
>     ],
>     "FreydCategoriesForCAP",
>     "CategoryOfRows.autogen.gd",
>     "Category of rows",
>     "Supported CAP operations"
> );


#### 12.20 Category of relations

gap> F := HomalgRingOfIntegers( 3 );;
gap> vec := CategoryOfRows( F );;
gap> rel := RelCategory( vec );;
gap> A := 1/vec/rel;;
gap> id := IdentityMorphism( A );;
gap> IsWellDefined( id );
true
gap> alpha := HomalgMatrix( "[ 1, 2 ]", 2, 1, F )/vec;;
gap> alpha_rel := alpha/rel;;
gap> alpha_rel_inv := rel/alpha;;
gap> beta := PreCompose( alpha_rel_inv, alpha_rel );;
gap> IsCongruentForMorphisms( beta, id );
true
gap> IsEqualForMorphisms( beta, id );
false
gap> R := HomalgFieldOfRationalsInSingular() * "t";;
gap> t := IndeterminatesOfPolynomialRing( R )[1];;
gap> cocycle := function( a, b, c ) local e; e := CoastrictionToImage( UniversalMorphismIntoDirectSum( [ ReversedArrow( c ), Arrow( c ) ] ) ); return t^RankOfObject( KernelObject( e ) ); end;;
gap> T := TwistedLinearClosure( R, rel, cocycle );;
gap> gamma := beta/T;;
gap> delta := ZeroMorphism( 1/vec, 1/vec )/rel/T;;
gap> IsZero( 3*gamma - 3*gamma );
true
gap> IsCongruentForMorphisms( delta, gamma );
false
gap> beta := PreCompose( alpha_rel_inv/T, alpha_rel/T );;
gap> IsZero( beta - t * IdentityMorphism( Range( alpha_rel/T ) ) );
true
gap> IsZero( ( gamma * delta ) * gamma - gamma * ( delta * gamma ) );
true
#@fi


#### 12.21 Rings as Ab-categories

gap> CR := RingAsCategory( Integers );;
gap> u := RingAsCategoryUniqueObject( CR );;
gap> alpha := 2 / CR;
<2>
gap> IsOne( alpha );
false
gap> IsZero( alpha );
false
gap> alpha * alpha;
<4>
gap> -alpha;
<-2>
gap> IsZero( alpha + AdditiveInverse( alpha ) );
true
gap> beta := RingAsCategoryMorphism( 1/2, CR );;
gap> IsWellDefined( beta );
false
gap> gamma := IdentityMorphism( u );
<1>
gap> IsOne( gamma );
true
gap> delta := ZeroMorphism( u, u );
<0>
gap> IsZero( delta );
true
gap> 2 * alpha;
<4>
gap> Lift( alpha * alpha, alpha );
<2>
gap> Colift( alpha, alpha * alpha );
<2>
gap> BasisOfExternalHom( u, u );
[ <1> ]
gap> CoefficientsOfMorphism( alpha );
[ 2 ]
gap> IsCongruentForMorphisms( alpha, LinearCombinationOfMorphisms( u, CoefficientsOfMorphism( alpha ), BasisOfExternalHom( u, u ), u ) );
true
gap> EEE := KoszulDualRing( HomalgFieldOfRationalsInSingular( ) * "x,y" );;
gap> CE := RingAsCategory( EEE );;
gap> u := RingAsCategoryUniqueObject( CE );;
gap> alpha := ("2 + 3 * e0 + 4 * e1 + 5 * e0*e1" / EEE) / CE;
<5*e0*e1+3*e0+4*e1+2>
gap> IsOne( alpha );
false
gap> IsZero( alpha );
false
gap> alpha * alpha;
<20*e0*e1+12*e0+16*e1+4>
gap> -alpha;
<-5*e0*e1-3*e0-4*e1-2>
gap> IsZero( alpha + AdditiveInverse( alpha ) );
true
gap> gamma := IdentityMorphism( u );
<1>
gap> IsOne( gamma );
true
gap> delta := ZeroMorphism( u, u );
<0>
gap> IsZero( delta );
true
gap> 2 * alpha;
<10*e0*e1+6*e0+8*e1+4>
gap> Lift( alpha * alpha, alpha );
<5*e0*e1+3*e0+4*e1+2>
gap> Colift( alpha, alpha * alpha );
<5*e0*e1+3*e0+4*e1+2>
gap> basis := BasisOfExternalHom( u, u );
[ <1>, <e0>, <e1>, <e0*e1> ]
gap> coeffs := CoefficientsOfMorphism( alpha );
[ 2, 3, 4, 5 ]
gap> IsCongruentForMorphisms( alpha, LinearCombinationOfMorphisms( u, coeffs, basis, u ) );
true
gap> u_op := Opposite( u );
<An object in Opposite( Ring as category( Q{e0,e1} ) )>
gap> alpha_op := Opposite( alpha );
<A morphism in Opposite( Ring as category( Q{e0,e1} ) )>
gap> basis := BasisOfExternalHom( u_op, u_op );;
gap> coeffs := CoefficientsOfMorphism( alpha_op );
[ 2, 3, 4, 5 ]
gap> IsCongruentForMorphisms( alpha_op, LinearCombinationOfMorphisms( u_op, coeffs, basis, u_op ) );
true

Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Ind

generated by GAPDoc2HTML