Goto Chapter: Top 1 Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

1 Examples and tests
 1.1 Tests

1 Examples and tests

1.1 Tests

gap> LoadPackage( "ActionsForCAP", false );
true
gap> LoadPackage( "LinearAlgebraForCAP", false );
true
gap> Q := HomalgFieldOfRationals();;
gap> vec := MatrixCategory( Q );;
gap> u := TensorUnit( vec );;
gap> cat := LeftActionsCategory( u );
Category of left actions of <A vector space object over Q of dimension 1>
gap> V := MatrixCategoryObject( vec, 2 );
<A vector space object over Q of dimension 2>
gap> alpha := VectorSpaceMorphism( TensorProductOnObjects( u, V ), HomalgMatrix( [ [ 0, 1 ], [ -1, 0 ] ], 2, 2, Q ), V );
<A morphism in Category of matrices over Q>
gap> LoadPackage( "ActionsForCAP", false );
true
gap> LoadPackage( "LinearAlgebraForCAP", false );
true
gap> ## Category and Type of Objects
> ##
> DeclareCategory( "IsObjectWithEndo",
>                  IsCategoryWithAttributesObject );;
gap> DeclareRepresentation( "IsObjectWithEndoRep",
>                        IsObjectWithEndo and IsAttributeStoringRep,
>                        [ ] );;
gap> BindGlobal( "TheFamilyOfObjectsWithEndo",
>             NewFamily( "TheFamilyOfObjectsWithEndo" ) );;
gap> BindGlobal( "TheTypeOfObjectsWithEndo",
>             NewType( TheFamilyOfObjectsWithEndo,
>                      IsObjectWithEndoRep ) );;
gap> ## Category and Type of Morphisms
> ##
> DeclareCategory( "IsMorphismWithEndo",
>                  IsCategoryWithAttributesMorphism );;
gap> DeclareRepresentation( "IsMorphismWithEndoRep",
>                        IsMorphismWithEndo and IsAttributeStoringRep,
>                        [ ] );;
gap> BindGlobal( "TheFamilyOfMorphismsWithEndo",
>             NewFamily( "TheFamilyOfMorphismsWithEndo" ) );;
gap> BindGlobal( "TheTypeOfMorphismsWithEndo",
>             NewType( TheFamilyOfMorphismsWithEndo,
>                      IsMorphismWithEndoRep ) );;
gap> ##
> Q := HomalgFieldOfRationals();;
gap> vec := MatrixCategory( Q );;
gap> category_with_endo_record := rec( );;
gap> category_with_endo_record.underlying_category := vec;;
gap> category_with_endo_record.object_type := TheTypeOfObjectsWithEndo;;
gap> category_with_endo_record.morphism_type := TheTypeOfMorphismsWithEndo;;
gap> category_with_endo_record.ZeroObject :=
>     function( zero_object )
>       
>       return [ IdentityMorphism( zero_object ) ]; end;;
gap> category_with_endo_record.DirectSum :=
>     function( obj_list, underlying_direct_sum )
>       
>       return [ DirectSumFunctorial( List( obj_list, obj -> ObjectAttributesAsList( obj )[1] ) ) ]; end;;
gap> category_with_endo_record.Lift :=
>     function( mono, range )
>       
>       return [ LiftAlongMonomorphism( mono,  PreCompose( mono, ObjectAttributesAsList( range )[1] ) ) ]; end;;
gap> category_with_endo_record.Colift :=
>     function( epi, source )
>       
>       return [ ColiftAlongEpimorphism( epi, PreCompose( ObjectAttributesAsList( source )[1], epi ) ) ]; end;;
gap> category_with_endo_record.TensorProductOnObjects :=
>     function( obj1, obj2, underlying_tensor_product )
>       
>       return [ TensorProductOnMorphisms( ObjectAttributesAsList( obj1 )[1], ObjectAttributesAsList( obj2 )[1] ) ]; end;;
gap> category_with_endo_record.TensorUnit :=
>     function( unit )
>       
>       return [ IdentityMorphism( unit ) ]; end;;
gap> triple := EnhancementWithAttributes( category_with_endo_record );;
gap> endo_cat := triple[1];
Category with attributes of Category of matrices over Q
gap> ## not finalized yet
> ObjConstr := triple[2];
function( object, attributes ) ... end
gap> V := VectorSpaceObject( 3, Q );
<A vector space object over Q of dimension 3>
gap> endV := IdentityMorphism( V );
<An identity morphism in Category of matrices over Q>
gap> VwithEndo := ObjConstr( V, [ endV ] );
<An object in Category with attributes of Category of matrices over Q>
gap> MorConstr := triple[3];
function( source, morphism, range ) ... end
gap> alpha := MorConstr( VwithEndo, VectorSpaceMorphism( V, HomalgMatrix( [ [ 1, -1, 1 ], [ 1, 1, 1 ], [ 0, 0 , 0 ] ], 3, 3, Q ), V ), VwithEndo );
<A morphism in Category with attributes of Category of matrices over Q>
gap> LoadPackage( "ModulePresentationsForCAP", false );
true
gap> LoadPackage( "HomologicalAlgebraForCAP", false );
true
gap> LoadPackage( "RingsForHomalg", false );
true
gap> LoadPackage( "IO_ForHomalg", false );
true
gap> LoadPackage( "ActionsForCAP", false );
true
gap> HOMALG_IO.show_banners := false;;
gap> ##
> ## Category and Type of Objects
> ##
> DeclareCategory( "IsModuleWithAttribute",
>                  IsCategoryWithAttributesObject );;
gap> DeclareRepresentation( "IsModuleWithAttributeRep",
>                        IsModuleWithAttribute and IsAttributeStoringRep,
>                        [ ] );;
gap> BindGlobal( "TheFamilyOfModulesWithAttribute",
>             NewFamily( "TheFamilyOfModulesWithAttribute" ) );;
gap> BindGlobal( "TheTypeOfModulesWithAttribute",
>             NewType( TheFamilyOfModulesWithAttribute,
>                      IsModuleWithAttributeRep ) );;
gap> ## Category and Type of Morphisms
> ##
> DeclareCategory( "IsModuleMorphismWithAttribute",
>                  IsCategoryWithAttributesMorphism );;
gap> DeclareRepresentation( "IsModuleMorphismWithAttributeRep",
>                        IsModuleMorphismWithAttribute and IsAttributeStoringRep,
>                        [ ] );;
gap> BindGlobal( "TheFamilyOfModuleMorphismsWithAttribute",
>             NewFamily( "TheFamilyOfModuleMorphismsWithAttribute" ) );;
gap> BindGlobal( "TheTypeOfModuleMorphismsWithAttribute",
>             NewType( TheFamilyOfModuleMorphismsWithAttribute,
>                      IsModuleMorphismWithAttributeRep ) );;
gap> ##
> 
> 
> 
> QQ := HomalgFieldOfRationalsInSingular( );;
gap> R := QQ * "x,y";
Q[x,y]
gap> SetRecursionTrapInterval( 10000 );;
gap> category := LeftPresentations( R );;
gap> category_with_attributes_record := rec(
>   underlying_category := category,
>   object_type := TheTypeOfModulesWithAttribute,
>   morphism_type := TheTypeOfModuleMorphismsWithAttribute,
>   
>   ZeroObject :=
>     { zero_object } -> [ "a string for indirection" ],
>   
>   DirectSum :=
>     { obj_list, underlying_direct_sum } -> [ "a string for indirection" ],
>   
>   KernelObject :=
>     { diagram, underlying_kernel_object } -> [ "a string for indirection" ],
>       
>   ImageObject :=
>     { diagram, underlying_image_object } -> [ "a string for indirection" ],
>       
>   FiberProduct :=
>     { diagram, underlying_fiber_product } -> [ "a string for indirection" ],
>       
>   CokernelObject :=
>     { diagram, underlying_cokernel_object } -> [ "a string for indirection" ],
>   
>   CoimageObject :=
>     { diagram, underlying_coimage_object } -> [ "a string for indirection" ],
>   
>   Pushout :=
>     { diagram, underlying_pushout_object } -> [ "a string for indirection" ],
> );;
gap> triple := EnhancementWithAttributes( category_with_attributes_record );;
gap> indirection_category := triple[1];;
gap> SetIsAbelianCategory( indirection_category, true );;
gap> AddIsEqualForObjects( indirection_category, function( cat, obj1, obj2 ) return UnderlyingCell( obj1 ) = UnderlyingCell( obj2 ); end );;
gap> AddIsEqualForMorphisms( indirection_category, function( cat, mor1, mor2 ) return IsIdenticalObj( mor1, mor2 ); end );;
gap> AddIsCongruentForMorphisms( indirection_category, function( cat, mor1, mor2 ) return UnderlyingCell( mor1 ) = UnderlyingCell( mor2 ); end );;
gap> Finalize( indirection_category );;
gap> Object_Constructor := triple[2];;
gap> Morphism_Constructor := triple[3];;
gap> S := Object_Constructor( FreeLeftPresentation( 1, R ), [ "a string for indirection" ] );
<An object in Category with attributes of Category of left presentations of Q[x,y]>
gap> object_func := function( i ) return S; end;
function( i ) ... end
gap> morphism_func := function( i ) return IdentityMorphism( S ); end;
function( i ) ... end
gap> C0 := ZFunctorObjectExtendedByInitialAndIdentity( object_func, morphism_func, indirection_category, 0, 4 );
<An object in Functors from integers into Category with attributes of Category of left presentations of Q[x,y]>
gap> S2 := Object_Constructor( FreeLeftPresentation( 2, R ), [ "a string for indirection" ] );
<An object in Category with attributes of Category of left presentations of Q[x,y]>
gap> C1 := ZFunctorObjectFromMorphismList( [ InjectionOfCofactorOfDirectSum( [ S2, S ], 1 ) ], 2 );
<An object in Functors from integers into Category with attributes of Category of left presentations of Q[x,y]>
gap> C1 := ZFunctorObjectExtendedByInitialAndIdentity( C1, 2, 3 );
<An object in Functors from integers into Category with attributes of Category of left presentations of Q[x,y]>
gap> C2 := ZFunctorObjectFromMorphismList( [ InjectionOfCofactorOfDirectSum( [ S, S ], 1 ) ], 3 );
<An object in Functors from integers into Category with attributes of Category of left presentations of Q[x,y]>
gap> C2 := ZFunctorObjectExtendedByInitialAndIdentity( C2, 3, 4 );
<An object in Functors from integers into Category with attributes of Category of left presentations of Q[x,y]>
gap> delta_1_3 := PresentationMorphism( UnderlyingCell( C1[3] ), HomalgMatrix( [ [ "x^2" ], [ "xy" ], [ "y^3"] ], 3, 1, R ), UnderlyingCell( C0[3] ) );
<A morphism in Category of left presentations of Q[x,y]>
gap> delta_1_3 := Morphism_Constructor( C1[3], delta_1_3, C0[3] );
<A morphism in Category with attributes of Category of left presentations of Q[x,y]>
gap> delta_1_2 := PresentationMorphism( UnderlyingCell( C1[2] ), HomalgMatrix( [ [ "x^2" ], [ "xy" ] ], 2, 1, R ), UnderlyingCell( C0[2] ) );
<A morphism in Category of left presentations of Q[x,y]>
gap> delta_1_2 := Morphism_Constructor( C1[2], delta_1_2, C0[2] );
<A morphism in Category with attributes of Category of left presentations of Q[x,y]>
gap> delta1 := ZFunctorMorphism( C1, [ UniversalMorphismFromInitialObject( C0[1] ), UniversalMorphismFromInitialObject( C0[1] ), delta_1_2, delta_1_3 ], 0, C0 );
<A morphism in Functors from integers into Category with attributes of Category of left presentations of Q[x,y]>
gap> delta1 := ZFunctorMorphismExtendedByInitialAndIdentity( delta1, 0, 3 );
<A morphism in Functors from integers into Category with attributes of Category of left presentations of Q[x,y]>
gap> delta1 := AsAscendingFilteredMorphism( delta1 );
<A morphism in Ascending filtered object category of Category with attributes of Category of left presentations of Q[x,y]>
gap> delta_2_3 := PresentationMorphism( UnderlyingCell( C2[3] ), HomalgMatrix( [ [ "y", "-x", "0" ] ], 1, 3, R ), UnderlyingCell( C1[3] ) );
<A morphism in Category of left presentations of Q[x,y]>
gap> delta_2_3 := Morphism_Constructor( C2[3], delta_2_3, C1[3] );
<A morphism in Category with attributes of Category of left presentations of Q[x,y]>
gap> delta_2_4 := PresentationMorphism( UnderlyingCell( C2[4] ), HomalgMatrix( [ [ "y", "-x", "0" ], [ "0", "y^2", "-x" ] ], 2, 3, R ), UnderlyingCell( C1[4] ) );
<A morphism in Category of left presentations of Q[x,y]>
gap> delta_2_4 := Morphism_Constructor( C2[4], delta_2_4, C1[4] );
<A morphism in Category with attributes of Category of left presentations of Q[x,y]>
gap> delta2 := ZFunctorMorphism( C2, [  UniversalMorphismFromInitialObject( C1[2] ), delta_2_3, delta_2_4 ], 2, C1 );
<A morphism in Functors from integers into Category with attributes of Category of left presentations of Q[x,y]>
gap> delta2 := ZFunctorMorphismExtendedByInitialAndIdentity( delta2, 2, 4 );
<A morphism in Functors from integers into Category with attributes of Category of left presentations of Q[x,y]>
gap> delta2 := AsAscendingFilteredMorphism( delta2 );
<A morphism in Ascending filtered object category of Category with attributes of Category of left presentations of Q[x,y]>
gap> SetIsAdditiveCategory( CategoryOfAscendingFilteredObjects( indirection_category ), true );
gap> complex := ZFunctorObjectFromMorphismList( [ delta2, delta1 ], -2 );
<An object in Functors from integers into Ascending filtered object category of Category with attributes of Category of left presentations of Q[x,y]>
gap> complex := AsComplex( complex );
<An object in Complex category of Ascending filtered object category of Category with attributes of Category of left presentations of Q[x,y]>
gap> LessGenFunctor := FunctorLessGeneratorsLeft( R );
Less generators for Category of left presentations of Q[x,y]
gap> # ProfileFunctionsInGlobalVariables( true );
gap> # ProfileOperationsAndMethods( true );
gap> # ProfileGlobalFunctions( true );
gap> # s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 0, 0, 0 );
gap> # ProfileFunctionsInGlobalVariables( false );
gap> # ProfileOperationsAndMethods( false );
gap> # ProfileGlobalFunctions( false );
gap> # 
> # DisplayProfile();
gap> # 
> # 
> # ProfileFunctionsInGlobalVariables( true );
gap> # ProfileOperationsAndMethods( true );
gap> # ProfileGlobalFunctions( true );
gap> # s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 1, 0, 0 );
gap> # ProfileFunctionsInGlobalVariables( false );
gap> # ProfileOperationsAndMethods( false );
gap> # ProfileGlobalFunctions( false );
gap> # 
> # DisplayProfile();
gap> # time;
gap> # # <A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
> # # Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
gap> # # # (an empty 0 x 1 matrix)
> # s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 1, 0, 0 );
gap> # time;
gap> # # # <A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
> # # Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
gap> # # # (an empty 0 x 1 matrix)
> # s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 2, 0, 0 );
gap> # time;
gap> # # # <A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
> # # Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
gap> # # # (an empty 0 x 1 matrix)
> # s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 3, 0, 0 );
gap> # time;
gap> # # # <A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
> # # Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
gap> # # # x*y,
> # # # x^2
> # s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 4, 0, 0 );
gap> # time;
gap> # # # <A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
> # # Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
gap> # # # x*y,
> # # # x^2,
> # # # y^3
> # s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 5, 0, 0 );
gap> # time;
gap> # # # <A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
> # # Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
gap> # # # x*y,
> # # # x^2,
> # # # y^3
> # s := SpectralSequenceDifferentialOfAscendingFilteredComplex( complex, 3, 3, -2 );
gap> # time;
gap> # # <A morphism in Category of left presentations of Q[x,y]>
> # Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, s ) ) );
gap> # # y^3
> 
gap> LoadPackage( "LinearAlgebraForCAP", false );
true
gap> DeclareFilter( "IsWrappedObject", IsCapCategoryObject );;
gap> DeclareFilter( "IsWrappedMorphism", IsCapCategoryMorphism );;
gap> DeclareOperation( "WrappedObject",
>                   [ IsCapCategoryObject ] );;
gap> DeclareAttribute( "UnderlyingCell",
>                   IsWrappedObject );;
gap> DeclareOperation( "WrappedMorphism",
>                   [ IsWrappedObject, IsCapCategoryMorphism, IsWrappedObject ] );;
gap> DeclareAttribute( "UnderlyingCell",
>                   IsWrappedMorphism );;
gap> #################################
> ##
> ## Creation of category
> ##
> #################################
> 
> Q := HomalgFieldOfRationals();;
gap> vec := MatrixCategory( Q );;
gap> wrapped_cat := CreateCapCategory( "Wrapped Category", IsCapCategory, IsWrappedObject, IsWrappedMorphism, IsCapCategoryTwoCell : is_computable := false );
Wrapped Category
gap> #################################
> ##
> ## Constructors for objects and morphisms
> ##
> #################################
> 
> InstallMethod( WrappedObject,
>                [ IsCapCategoryObject ],
>                
>   function( obj )
>     
>     return CreateCapCategoryObjectWithAttributes( wrapped_cat,
>         UnderlyingCell, obj
>     ); end );
gap> InstallMethod( WrappedMorphism,
>                [ IsWrappedObject, IsCapCategoryMorphism, IsWrappedObject ],
>                   
>   function( source, morphism, range )
>     
>     return CreateCapCategoryMorphismWithAttributes(
>         wrapped_cat,
>         Source, source,
>         Range, range,
>         UnderlyingCell, morphism
>     ); end );
gap> AddKernelEmbedding( wrapped_cat,
>   function( cat, diagram )
>     
>     # avoid semicolons so AutoDoc does not start a new statement
>     return ({ underlying_kernel_embedding } ->
>         WrappedMorphism( WrappedObject( Source( underlying_kernel_embedding ) ),
>                          underlying_kernel_embedding,
>                          Source( diagram ) )
>     )(KernelEmbedding( UnderlyingCell( diagram ) )); end );
gap> Finalize( wrapped_cat );;
gap> V := VectorSpaceObject( 3, Q );
<A vector space object over Q of dimension 3>
gap> alpha := VectorSpaceMorphism( V, HomalgMatrix( [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ], 3, 3, Q ), V );
<A morphism in Category of matrices over Q>
gap> V_wrapped := WrappedObject( V );
<An object in Wrapped Category>
gap> alpha_wrapped := WrappedMorphism( V_wrapped, alpha, V_wrapped );
<A morphism in Wrapped Category>
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 Ind

generated by GAPDoc2HTML