Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346<?xml version="1.0" encoding="UTF-8"?>12<!-- This is an automatically generated file. -->3<Chapter Label="Chapter_Examples_and_Tests">4<Heading>Examples and Tests</Heading>56<Section Label="Chapter_Examples_and_Tests_Section_Spectral_Sequences">7<Heading>Spectral Sequences</Heading>89<Example><![CDATA[10gap> ZZ := HomalgRingOfIntegersInSingular( );11Z12gap> C1 := FreeLeftPresentation( 1, ZZ );13<An object in Category of left presentations of Z>14gap> C2 := FreeLeftPresentation( 2, ZZ );15<An object in Category of left presentations of Z>16gap> h1 := PresentationMorphism( C2, HomalgMatrix( [ [ 0 ], [ 4 ] ], ZZ ), C1 );17<A morphism in Category of left presentations of Z>18gap> h2 := PresentationMorphism( C2, HomalgMatrix( [ [ 0 ], [ 2 ] ], ZZ ), C1 );19<A morphism in Category of left presentations of Z>20gap> v1 := PresentationMorphism( C2, HomalgMatrix( [ [ 2, 0 ], [ 1, 2 ] ], ZZ ), C2 );21<A morphism in Category of left presentations of Z>22gap> v2 := PresentationMorphism( C1, HomalgMatrix( [ [ 4 ] ], ZZ ), C1 );23<A morphism in Category of left presentations of Z>24gap> cocomplex_h1 := CocomplexFromMorphismList( [ h1 ] );25<An object in Cocomplex category of Category of left presentations of Z>26gap> cocomplex_h2 := CocomplexFromMorphismList( [ h2 ] );27<An object in Cocomplex category of Category of left presentations of Z>28gap> cocomplex_mor := CochainMap( cocomplex_h2, [ v1, v2 ], cocomplex_h1 );29<A morphism in Cocomplex category of Category of left presentations of Z>30gap> Zmod := CapCategory( C1 );31Category of left presentations of Z32gap> CH0 := CohomologyFunctor( Zmod, 0 );330-th cohomology functor of Category of left presentations of Z34gap> cmor0 := ApplyFunctor( CH0, cocomplex_mor );35<A morphism in Category of left presentations of Z>36gap> Display( UnderlyingMatrix( cmor0 ) );37238gap> CH1 := CohomologyFunctor( Zmod, 1 );391-th cohomology functor of Category of left presentations of Z40gap> cmor1 := ApplyFunctor( CH1, cocomplex_mor );41<A morphism in Category of left presentations of Z>42gap> Display( UnderlyingMatrix( cmor1 ) );43444gap> ToComplex := CocomplexToComplexFunctor( Zmod );45Cocomplex to complex functor of Category of left presentations of Z46gap> complex_mor := ApplyFunctor( ToComplex, cocomplex_mor );47<A morphism in Complex category of Category of left presentations of Z>48gap> H0 := HomologyFunctor( Zmod, 0 );490-th homology functor of Category of left presentations of Z50gap> mor0 := ApplyFunctor( H0, complex_mor );51<A morphism in Category of left presentations of Z>52gap> Display( UnderlyingMatrix( mor0 ) );53254gap> Hm1 := HomologyFunctor( Zmod, -1 );55-1-th homology functor of Category of left presentations of Z56gap> mor1 := ApplyFunctor( Hm1, complex_mor );57<A morphism in Category of left presentations of Z>58gap> Display( UnderlyingMatrix( mor1 ) );59460]]></Example>616263<Example><![CDATA[64gap> QQ := HomalgFieldOfRationalsInSingular( );;65gap> R := QQ * "x,y";66Q[x,y]67gap> SetRecursionTrapInterval( 10000 );68gap> category := LeftPresentations( R );69Category of left presentations of Q[x,y]70gap> S := FreeLeftPresentation( 1, R );71<An object in Category of left presentations of Q[x,y]>72gap> object_func := function( i ) return S; end;73function( i ) ... end74gap> morphism_func := function( i ) return IdentityMorphism( S ); end;75function( i ) ... end76gap> C0 := ZFunctorObjectExtendedByInitialAndIdentity( object_func, morphism_func, category, 0, 4 );77<An object in Functors from integers into Category of left presentations of Q[x,y]>78gap> S2 := FreeLeftPresentation( 2, R );79<An object in Category of left presentations of Q[x,y]>80gap> C1 := ZFunctorObjectFromMorphismList( [ InjectionOfCofactorOfDirectSum( [ S2, S ], 1 ) ], 2 );81<An object in Functors from integers into Category of left presentations of Q[x,y]>82gap> C1 := ZFunctorObjectExtendedByInitialAndIdentity( C1, 2, 3 );83<An object in Functors from integers into Category of left presentations of Q[x,y]>84gap> C2 := ZFunctorObjectFromMorphismList( [ InjectionOfCofactorOfDirectSum( [ S, S ], 1 ) ], 3 );85<An object in Functors from integers into Category of left presentations of Q[x,y]>86gap> C2 := ZFunctorObjectExtendedByInitialAndIdentity( C2, 3, 4 );87<An object in Functors from integers into Category of left presentations of Q[x,y]>88gap> delta_1_3 := PresentationMorphism( C1[3], HomalgMatrix( [ [ "x^2" ], [ "xy" ], [ "y^3"] ], 3, 1, R ), C0[3] );89<A morphism in Category of left presentations of Q[x,y]>90gap> delta_1_2 := PresentationMorphism( C1[2], HomalgMatrix( [ [ "x^2" ], [ "xy" ] ], 2, 1, R ), C0[2] );91<A morphism in Category of left presentations of Q[x,y]>92gap> delta1 := ZFunctorMorphism( C1, [ UniversalMorphismFromInitialObject( C0[1] ), UniversalMorphismFromInitialObject( C0[1] ), delta_1_2, delta_1_3 ], 0, C0 );93<A morphism in Functors from integers into Category of left presentations of Q[x,y]>94gap> delta1 := ZFunctorMorphismExtendedByInitialAndIdentity( delta1, 0, 3 );95<A morphism in Functors from integers into Category of left presentations of Q[x,y]>96gap> delta1 := AsAscendingFilteredMorphism( delta1 );97<A morphism in Ascending filtered object category of Category of left presentations of Q[x,y]>98gap> delta_2_3 := PresentationMorphism( C2[3], HomalgMatrix( [ [ "y", "-x", "0" ] ], 1, 3, R ), C1[3] );99<A morphism in Category of left presentations of Q[x,y]>100gap> delta_2_4 := PresentationMorphism( C2[4], HomalgMatrix( [ [ "y", "-x", "0" ], [ "0", "y^2", "-x" ] ], 2, 3, R ), C1[4] );101<A morphism in Category of left presentations of Q[x,y]>102gap> delta2 := ZFunctorMorphism( C2, [ UniversalMorphismFromInitialObject( C1[2] ), delta_2_3, delta_2_4 ], 2, C1 );103<A morphism in Functors from integers into Category of left presentations of Q[x,y]>104gap> delta2 := ZFunctorMorphismExtendedByInitialAndIdentity( delta2, 2, 4 );105<A morphism in Functors from integers into Category of left presentations of Q[x,y]>106gap> delta2 := AsAscendingFilteredMorphism( delta2 );107<A morphism in Ascending filtered object category of Category of left presentations of Q[x,y]>108gap> SetIsAdditiveCategory( CategoryOfAscendingFilteredObjects( category ), true );109gap> complex := ZFunctorObjectFromMorphismList( [ delta2, delta1 ], -2 );110<An object in Functors from integers into Ascending filtered object category of Category of left presentations of Q[x,y]>111gap> complex := AsComplex( complex );112<An object in Complex category of Ascending filtered object category of Category of left presentations of Q[x,y]>113gap> LessGenFunctor := FunctorLessGeneratorsLeft( R );114Less generators for Category of left presentations of Q[x,y]115gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 0, 0, 0 );116<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>117gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );118(an empty 0 x 1 matrix)119gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 1, 0, 0 );120<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>121gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );122(an empty 0 x 1 matrix)123gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 2, 0, 0 );124<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>125gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );126(an empty 0 x 1 matrix)127gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 3, 0, 0 );128<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>129gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );130x*y,131x^2132gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 4, 0, 0 );133<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>134gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );135x*y,136x^2,137y^3138gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 5, 0, 0 );139<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>140gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );141x*y,142x^2,143y^3144gap> s := SpectralSequenceDifferentialOfAscendingFilteredComplex( complex, 3, 3, -2 );145<A morphism in Category of left presentations of Q[x,y]>146gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, s ) ) );147y^3148gap> AscToDescFunctor := AscendingToDescendingFilteredObjectFunctor( category );149Ascending to descending filtered object functor of Category of left presentations of Q[x,y]150gap> cocomplex := ZFunctorObjectFromMorphismList( [ ApplyFunctor( AscToDescFunctor, delta2 ), ApplyFunctor( AscToDescFunctor, delta1 ) ], -2 );151<An object in Functors from integers into Descending filtered object category of Category of left presentations of Q[x,y]>152gap> SetIsAdditiveCategory( CategoryOfDescendingFilteredObjects( category ), true );153gap> cocomplex := AsCocomplex( cocomplex );154<An object in Cocomplex category of Descending filtered object category of Category of left presentations of Q[x,y]>155gap> s := SpectralSequenceEntryOfDescendingFilteredCocomplex( cocomplex, 0, -2, 1 );156<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>157gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );158(an empty 0 x 2 matrix)159gap> s := SpectralSequenceEntryOfDescendingFilteredCocomplex( cocomplex, 1, -2, 1 );160<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>161gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );162(an empty 0 x 2 matrix)163gap> s := SpectralSequenceEntryOfDescendingFilteredCocomplex( cocomplex, 2, -2, 1 );164<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>165gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );166-y,x167gap> s := SpectralSequenceEntryOfDescendingFilteredCocomplex( cocomplex, 3, -2, 1 );168<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>169gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );170(an empty 0 x 0 matrix)171gap> s := SpectralSequenceDifferentialOfDescendingFilteredCocomplex( cocomplex, 2, -2, 1 );172<A morphism in Category of left presentations of Q[x,y]>173gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, s ) ) );174x^2,175x*y176]]></Example>177178179</Section>180181182<Section Label="Chapter_Examples_and_Tests_Section_Monoidal_Categories">183<Heading>Monoidal Categories</Heading>184185<Example><![CDATA[186gap> ZZ := HomalgRingOfIntegers();;187gap> Ml := AsLeftPresentation( HomalgMatrix( [ [ 2 ] ], 1, 1, ZZ ) );188<An object in Category of left presentations of Z>189gap> Nl := AsLeftPresentation( HomalgMatrix( [ [ 3 ] ], 1, 1, ZZ ) );190<An object in Category of left presentations of Z>191gap> Tl := TensorProductOnObjects( Ml, Nl );192<An object in Category of left presentations of Z>193gap> Display( UnderlyingMatrix( Tl ) );194[ [ 3 ],195[ 2 ] ]196gap> IsZeroForObjects( Tl );197true198gap> Bl := Braiding( DirectSum( Ml, Nl ), DirectSum( Ml, Ml ) );199<A morphism in Category of left presentations of Z>200gap> Display( UnderlyingMatrix( Bl ) );201[ [ 1, 0, 0, 0 ],202[ 0, 0, 1, 0 ],203[ 0, 1, 0, 0 ],204[ 0, 0, 0, 1 ] ]205gap> IsWellDefined( Bl );206true207gap> Ul := TensorUnit( CapCategory( Ml ) );208<An object in Category of left presentations of Z>209gap> IntHoml := InternalHomOnObjects( DirectSum( Ml, Ul ), Nl );210<An object in Category of left presentations of Z>211gap> Display( UnderlyingMatrix( IntHoml ) );212[ [ -2, -1 ],213[ 1, -1 ] ]214gap> generator_l1 := StandardGeneratorMorphism( IntHoml, 1 );215<A morphism in Category of left presentations of Z>216gap> morphism_l1 := LambdaElimination( DirectSum( Ml, Ul ), Nl, generator_l1 );217<A morphism in Category of left presentations of Z>218gap> Display( UnderlyingMatrix( morphism_l1 ) );219[ [ 0 ],220[ 2 ] ]221gap> generator_l2 := StandardGeneratorMorphism( IntHoml, 2 );222<A morphism in Category of left presentations of Z>223gap> morphism_l2 := LambdaElimination( DirectSum( Ml, Ul ), Nl, generator_l2 );224<A morphism in Category of left presentations of Z>225gap> Display( UnderlyingMatrix( morphism_l2 ) );226[ [ 0 ],227[ 2 ] ]228gap> IsEqualForMorphisms( LambdaIntroduction( morphism_l1 ), generator_l1 );229false230gap> IsCongruentForMorphisms( LambdaIntroduction( morphism_l1 ), generator_l1 );231true232gap> IsEqualForMorphisms( LambdaIntroduction( morphism_l2 ), generator_l2 );233false234gap> IsCongruentForMorphisms( LambdaIntroduction( morphism_l2 ), generator_l2 );235true236gap> Mr := AsRightPresentation( HomalgMatrix( [ [ 2 ] ], 1, 1, ZZ ) );237<An object in Category of right presentations of Z>238gap> Nr := AsRightPresentation( HomalgMatrix( [ [ 3 ] ], 1, 1, ZZ ) );239<An object in Category of right presentations of Z>240gap> Tr := TensorProductOnObjects( Mr, Nr );241<An object in Category of right presentations of Z>242gap> Display( UnderlyingMatrix( Tr ) );243[ [ 3, 2 ] ]244gap> IsZeroForObjects( Tr );245true246gap> Br := Braiding( DirectSum( Mr, Nr ), DirectSum( Mr, Mr ) );247<A morphism in Category of right presentations of Z>248gap> Display( UnderlyingMatrix( Br ) );249[ [ 1, 0, 0, 0 ],250[ 0, 0, 1, 0 ],251[ 0, 1, 0, 0 ],252[ 0, 0, 0, 1 ] ]253gap> IsWellDefined( Br );254true255gap> Ur := TensorUnit( CapCategory( Mr ) );256<An object in Category of right presentations of Z>257gap> IntHomr := InternalHomOnObjects( DirectSum( Mr, Ur ), Nr );258<An object in Category of right presentations of Z>259gap> Display( UnderlyingMatrix( IntHomr ) );260[ [ -2, 1 ],261[ -1, -1 ] ]262gap> generator_r1 := StandardGeneratorMorphism( IntHomr, 1 );263<A morphism in Category of right presentations of Z>264gap> morphism_r1 := LambdaElimination( DirectSum( Mr, Ur ), Nr, generator_r1 );265<A morphism in Category of right presentations of Z>266gap> Display( UnderlyingMatrix( morphism_r1 ) );267[ [ 0, 2 ] ]268gap> generator_r2 := StandardGeneratorMorphism( IntHoml, 2 );269<A morphism in Category of left presentations of Z>270gap> morphism_r2 := LambdaElimination( DirectSum( Ml, Ul ), Nl, generator_r2 );271<A morphism in Category of left presentations of Z>272gap> Display( UnderlyingMatrix( morphism_r2 ) );273[ [ 0 ],274[ 2 ] ]275gap> IsEqualForMorphisms( LambdaIntroduction( morphism_r1 ), generator_r1 );276false277gap> IsCongruentForMorphisms( LambdaIntroduction( morphism_r1 ), generator_r1 );278true279gap> IsEqualForMorphisms( LambdaIntroduction( morphism_r2 ), generator_r2 );280false281gap> IsCongruentForMorphisms( LambdaIntroduction( morphism_r2 ), generator_r2 );282true283]]></Example>284285286</Section>287288289<Section Label="Chapter_Examples_and_Tests_Section_Generalized_Morphisms_Category">290<Heading>Generalized Morphisms Category</Heading>291292<Example><![CDATA[293gap> vecspaces := CreateCapCategory( "VectorSpacesForGeneralizedMorphismsTest" );294VectorSpacesForGeneralizedMorphismsTest295gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );296true297gap> LoadPackage( "GeneralizedMorphismsForCAP" );298true299gap> B := QVectorSpace( 2 );300<A rational vector space of dimension 2>301gap> C := QVectorSpace( 3 );302<A rational vector space of dimension 3>303gap> B_1 := QVectorSpace( 1 );304<A rational vector space of dimension 1>305gap> C_1 := QVectorSpace( 2 );306<A rational vector space of dimension 2>307gap> c1_source_aid := VectorSpaceMorphism( B_1, [ [ 1, 0 ] ], B );308A rational vector space homomorphism with matrix:309[ [ 1, 0 ] ]310311gap> SetIsSubobject( c1_source_aid, true );312gap> c1_range_aid := VectorSpaceMorphism( C, [ [ 1, 0 ], [ 0, 1 ], [ 0, 0 ] ], C_1 );313A rational vector space homomorphism with matrix:314[ [ 1, 0 ],315[ 0, 1 ],316[ 0, 0 ] ]317318gap> SetIsFactorobject( c1_range_aid, true );319gap> c1_associated := VectorSpaceMorphism( B_1, [ [ 1, 1 ] ], C_1 );320A rational vector space homomorphism with matrix:321[ [ 1, 1 ] ]322323gap> c1 := GeneralizedMorphism( c1_source_aid, c1_associated, c1_range_aid );324<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>325gap> B_2 := QVectorSpace( 1 );326<A rational vector space of dimension 1>327gap> C_2 := QVectorSpace( 2 );328<A rational vector space of dimension 2>329gap> c2_source_aid := VectorSpaceMorphism( B_2, [ [ 2, 0 ] ], B );330A rational vector space homomorphism with matrix:331[ [ 2, 0 ] ]332333gap> SetIsSubobject( c2_source_aid, true );334gap> c2_range_aid := VectorSpaceMorphism( C, [ [ 3, 0 ], [ 0, 3 ], [ 0, 0 ] ], C_2 );335A rational vector space homomorphism with matrix:336[ [ 3, 0 ],337[ 0, 3 ],338[ 0, 0 ] ]339340gap> SetIsFactorobject( c2_range_aid, true );341gap> c2_associated := VectorSpaceMorphism( B_2, [ [ 6, 6 ] ], C_2 );342A rational vector space homomorphism with matrix:343[ [ 6, 6 ] ]344345gap> c2 := GeneralizedMorphism( c2_source_aid, c2_associated, c2_range_aid );346<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>347gap> IsCongruentForMorphisms( c1, c2 );348true349gap> IsCongruentForMorphisms( c1, c1 );350true351gap> c3_associated := VectorSpaceMorphism( B_1, [ [ 2, 2 ] ], C_1 );352A rational vector space homomorphism with matrix:353[ [ 2, 2 ] ]354355gap> c3 := GeneralizedMorphism( c1_source_aid, c3_associated, c1_range_aid );356<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>357gap> IsCongruentForMorphisms( c1, c3 );358false359gap> IsCongruentForMorphisms( c2, c3 );360false361gap> c1 + c2;362<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>363gap> Arrow( c1 + c2 );364A rational vector space homomorphism with matrix:365[ [ 12, 12 ] ]366367]]></Example>368369370First composition test:371<Example><![CDATA[372gap> vecspaces := CreateCapCategory( "VectorSpacesForGeneralizedMorphismsTest" );373VectorSpacesForGeneralizedMorphismsTest374gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );375true376gap> A := QVectorSpace( 1 );377<A rational vector space of dimension 1>378gap> B := QVectorSpace( 2 );379<A rational vector space of dimension 2>380gap> C := QVectorSpace( 3 );381<A rational vector space of dimension 3>382gap> phi_tilde_associated := VectorSpaceMorphism( A, [ [ 1, 2, 0 ] ], C );383A rational vector space homomorphism with matrix:384[ [ 1, 2, 0 ] ]385386gap> phi_tilde_source_aid := VectorSpaceMorphism( A, [ [ 1, 2 ] ], B );387A rational vector space homomorphism with matrix:388[ [ 1, 2 ] ]389390gap> phi_tilde := GeneralizedMorphismWithSourceAid( phi_tilde_source_aid, phi_tilde_associated );391<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>392gap> psi_tilde_associated := IdentityMorphism( B );393A rational vector space homomorphism with matrix:394[ [ 1, 0 ],395[ 0, 1 ] ]396397gap> psi_tilde_source_aid := VectorSpaceMorphism( B, [ [ 1, 0, 0 ], [ 0, 1, 0 ] ], C );398A rational vector space homomorphism with matrix:399[ [ 1, 0, 0 ],400[ 0, 1, 0 ] ]401402gap> psi_tilde := GeneralizedMorphismWithSourceAid( psi_tilde_source_aid, psi_tilde_associated );403<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>404gap> composition := PreCompose( phi_tilde, psi_tilde );405<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>406gap> Arrow( composition );407A rational vector space homomorphism with matrix:408[ [ 1/2, 1 ] ]409410gap> SourceAid( composition );411A rational vector space homomorphism with matrix:412[ [ 1/2, 1 ] ]413414gap> RangeAid( composition );415A rational vector space homomorphism with matrix:416[ [ 1, 0 ],417[ 0, 1 ] ]418]]></Example>419420421Second composition test422<Example><![CDATA[423gap> vecspaces := CreateCapCategory( "VectorSpacesForGeneralizedMorphismsTest" );424VectorSpacesForGeneralizedMorphismsTest425gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );426true427gap> A := QVectorSpace( 1 );428<A rational vector space of dimension 1>429gap> B := QVectorSpace( 2 );430<A rational vector space of dimension 2>431gap> C := QVectorSpace( 3 );432<A rational vector space of dimension 3>433gap> phi2_tilde_associated := VectorSpaceMorphism( A, [ [ 1, 5 ] ], B );434A rational vector space homomorphism with matrix:435[ [ 1, 5 ] ]436437gap> phi2_tilde_range_aid := VectorSpaceMorphism( C, [ [ 1, 0 ], [ 0, 1 ], [ 1, 1 ] ], B );438A rational vector space homomorphism with matrix:439[ [ 1, 0 ],440[ 0, 1 ],441[ 1, 1 ] ]442443gap> phi2_tilde := GeneralizedMorphismWithRangeAid( phi2_tilde_associated, phi2_tilde_range_aid );444<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>445gap> psi2_tilde_associated := VectorSpaceMorphism( C, [ [ 1 ], [ 3 ], [ 4 ] ], A );446A rational vector space homomorphism with matrix:447[ [ 1 ],448[ 3 ],449[ 4 ] ]450451gap> psi2_tilde_range_aid := VectorSpaceMorphism( B, [ [ 1 ], [ 1 ] ], A );452A rational vector space homomorphism with matrix:453[ [ 1 ],454[ 1 ] ]455456gap> psi2_tilde := GeneralizedMorphismWithRangeAid( psi2_tilde_associated, psi2_tilde_range_aid );457<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>458gap> composition2 := PreCompose( phi2_tilde, psi2_tilde );459<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>460gap> Arrow( composition2 );461A rational vector space homomorphism with matrix:462[ [ 16 ] ]463464gap> RangeAid( composition2 );465A rational vector space homomorphism with matrix:466[ [ 1 ],467[ 1 ] ]468469gap> SourceAid( composition2 );470A rational vector space homomorphism with matrix:471[ [ 1 ] ]472]]></Example>473474475Third composition test476<Example><![CDATA[477gap> vecspaces := CreateCapCategory( "VectorSpacesForGeneralizedMorphismsTest" );478VectorSpacesForGeneralizedMorphismsTest479gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );480true481gap> A := QVectorSpace( 3 );482<A rational vector space of dimension 3>483gap> Asub := QVectorSpace( 2 );484<A rational vector space of dimension 2>485gap> B := QVectorSpace( 3 );486<A rational vector space of dimension 3>487gap> Bfac := QVectorSpace( 1 );488<A rational vector space of dimension 1>489gap> Bsub := QVectorSpace( 2 );490<A rational vector space of dimension 2>491gap> C := QVectorSpace( 3 );492<A rational vector space of dimension 3>493gap> Cfac := QVectorSpace( 1 );494<A rational vector space of dimension 1>495gap> Asub_into_A := VectorSpaceMorphism( Asub, [ [ 1, 0, 0 ], [ 0, 1, 0 ] ], A );496A rational vector space homomorphism with matrix:497[ [ 1, 0, 0 ],498[ 0, 1, 0 ] ]499500gap> Asub_to_Bfac := VectorSpaceMorphism( Asub, [ [ 1 ], [ 1 ] ], Bfac );501A rational vector space homomorphism with matrix:502[ [ 1 ],503[ 1 ] ]504505gap> B_onto_Bfac := VectorSpaceMorphism( B, [ [ 1 ], [ 1 ], [ 1 ] ], Bfac );506A rational vector space homomorphism with matrix:507[ [ 1 ],508[ 1 ],509[ 1 ] ]510511gap> Bsub_into_B := VectorSpaceMorphism( Bsub, [ [ 2, 2, 0 ], [ 0, 2, 2 ] ], B );512A rational vector space homomorphism with matrix:513[ [ 2, 2, 0 ],514[ 0, 2, 2 ] ]515516gap> Bsub_to_Cfac := VectorSpaceMorphism( Bsub, [ [ 3 ], [ 0 ] ], Cfac );517A rational vector space homomorphism with matrix:518[ [ 3 ],519[ 0 ] ]520521gap> C_onto_Cfac := VectorSpaceMorphism( C, [ [ 1 ], [ 2 ], [ 3 ] ], Cfac );522A rational vector space homomorphism with matrix:523[ [ 1 ],524[ 2 ],525[ 3 ] ]526527gap> generalized_morphism1 := GeneralizedMorphism( Asub_into_A, Asub_to_Bfac, B_onto_Bfac );528<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>529gap> generalized_morphism2 := GeneralizedMorphism( Bsub_into_B, Bsub_to_Cfac, C_onto_Cfac );530<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>531gap> IsWellDefined( generalized_morphism1 );532true533gap> IsWellDefined( generalized_morphism2 );534true535gap> p := PreCompose( generalized_morphism1, generalized_morphism2 );536<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>537gap> SourceAid( p );538A rational vector space homomorphism with matrix:539[ [ -1, 1, 0 ],540[ 1, 0, 0 ] ]541542gap> Arrow( p );543A rational vector space homomorphism with matrix:544(an empty 2 x 0 matrix)545546gap> RangeAid( p );547A rational vector space homomorphism with matrix:548(an empty 3 x 0 matrix)549gap> A := QVectorSpace( 3 );550<A rational vector space of dimension 3>551gap> Asub := QVectorSpace( 2 );552<A rational vector space of dimension 2>553gap> B := QVectorSpace( 3 );554<A rational vector space of dimension 3>555gap> Bfac := QVectorSpace( 1 );556<A rational vector space of dimension 1>557gap> Bsub := QVectorSpace( 2 );558<A rational vector space of dimension 2>559gap> C := QVectorSpace( 3 );560<A rational vector space of dimension 3>561gap> Cfac := QVectorSpace( 2 );562<A rational vector space of dimension 2>563gap> Asub_into_A := VectorSpaceMorphism( Asub, [ [ 1, 0, 0 ], [ 0, 1, 0 ] ], A );564A rational vector space homomorphism with matrix:565[ [ 1, 0, 0 ],566[ 0, 1, 0 ] ]567568gap> Asub_to_Bfac := VectorSpaceMorphism( Asub, [ [ 1 ], [ 1 ] ], Bfac );569A rational vector space homomorphism with matrix:570[ [ 1 ],571[ 1 ] ]572573gap> B_onto_Bfac := VectorSpaceMorphism( B, [ [ 1 ], [ 1 ], [ 1 ] ], Bfac );574A rational vector space homomorphism with matrix:575[ [ 1 ],576[ 1 ],577[ 1 ] ]578579gap> Bsub_into_B := VectorSpaceMorphism( Bsub, [ [ 2, 2, 0 ], [ 0, 2, 2 ] ], B );580A rational vector space homomorphism with matrix:581[ [ 2, 2, 0 ],582[ 0, 2, 2 ] ]583584gap> Bsub_to_Cfac := VectorSpaceMorphism( Bsub, [ [ 3, 3 ], [ 0, 0 ] ], Cfac );585A rational vector space homomorphism with matrix:586[ [ 3, 3 ],587[ 0, 0 ] ]588589gap> C_onto_Cfac := VectorSpaceMorphism( C, [ [ 1, 0 ], [ 0, 2 ], [ 3, 3 ] ], Cfac );590A rational vector space homomorphism with matrix:591[ [ 1, 0 ],592[ 0, 2 ],593[ 3, 3 ] ]594595gap> generalized_morphism1 := GeneralizedMorphism( Asub_into_A, Asub_to_Bfac, B_onto_Bfac );596<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>597gap> generalized_morphism2 := GeneralizedMorphism( Bsub_into_B, Bsub_to_Cfac, C_onto_Cfac );598<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>599gap> IsWellDefined( generalized_morphism1 );600true601gap> IsWellDefined( generalized_morphism2 );602true603gap> p := PreCompose( generalized_morphism1, generalized_morphism2 );604<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>605gap> SourceAid( p );606A rational vector space homomorphism with matrix:607[ [ -1, 1, 0 ],608[ 1, 0, 0 ] ]609610gap> Arrow( p );611A rational vector space homomorphism with matrix:612[ [ 0 ],613[ 0 ] ]614615gap> RangeAid( p );616A rational vector space homomorphism with matrix:617[ [ -1 ],618[ 2 ],619[ 0 ] ]620]]></Example>621622623Honest representative test624<Example><![CDATA[625gap> vecspaces := CreateCapCategory( "VectorSpacesForGeneralizedMorphismsTest" );626VectorSpacesForGeneralizedMorphismsTest627gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );628true629gap> A := QVectorSpace( 1 );630<A rational vector space of dimension 1>631gap> B := QVectorSpace( 2 );632<A rational vector space of dimension 2>633gap> phi_tilde_source_aid := VectorSpaceMorphism( A, [ [ 2 ] ], A );634A rational vector space homomorphism with matrix:635[ [ 2 ] ]636637gap> phi_tilde_associated := VectorSpaceMorphism( A, [ [ 1, 1 ] ], B );638A rational vector space homomorphism with matrix:639[ [ 1, 1 ] ]640641gap> phi_tilde_range_aid := VectorSpaceMorphism( B, [ [ 1, 2 ], [ 3, 4 ] ], B );642A rational vector space homomorphism with matrix:643[ [ 1, 2 ],644[ 3, 4 ] ]645646gap> phi_tilde := GeneralizedMorphism( phi_tilde_source_aid, phi_tilde_associated, phi_tilde_range_aid );647<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>648gap> HonestRepresentative( phi_tilde );649A rational vector space homomorphism with matrix:650[ [ -1/4, 1/4 ] ]651652gap> IsWellDefined( phi_tilde );653true654gap> IsWellDefined( psi_tilde );655true656]]></Example>657658659</Section>660661662<Section Label="Chapter_Examples_and_Tests_Section_IsWellDefined">663<Heading>IsWellDefined</Heading>664665<Example><![CDATA[666gap> vecspaces := CreateCapCategory( "VectorSpacesForIsWellDefinedTest" );667VectorSpacesForIsWellDefinedTest668gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );669true670gap> LoadPackage( "GeneralizedMorphismsForCAP" );671true672gap> A := QVectorSpace( 1 );673<A rational vector space of dimension 1>674gap> B := QVectorSpace( 2 );675<A rational vector space of dimension 2>676gap> alpha := VectorSpaceMorphism( A, [ [ 1, 2 ] ], B );677A rational vector space homomorphism with matrix:678[ [ 1, 2 ] ]679680gap> g := GeneralizedMorphism( alpha, alpha, alpha );681<A morphism in Generalized morphism category of VectorSpacesForIsWellDefinedTest>682gap> IsWellDefined( alpha );683true684gap> IsWellDefined( g );685true686]]></Example>687688689</Section>690691692<Section Label="Chapter_Examples_and_Tests_Section_Kernel">693<Heading>Kernel</Heading>694695<Example><![CDATA[696gap> vecspaces := CreateCapCategory( "VectorSpaces01" );697VectorSpaces01698gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAddKernel01.gi" );699true700gap> V := QVectorSpace( 2 );701<A rational vector space of dimension 2>702gap> W := QVectorSpace( 3 );703<A rational vector space of dimension 3>704gap> alpha := VectorSpaceMorphism( V, [ [ 1, 1, 1 ], [ -1, -1, -1 ] ], W );705A rational vector space homomorphism with matrix:706[ [ 1, 1, 1 ],707[ -1, -1, -1 ] ]708709gap> k := KernelObject( alpha );710<A rational vector space of dimension 1>711gap> T := QVectorSpace( 2 );712<A rational vector space of dimension 2>713gap> tau := VectorSpaceMorphism( T, [ [ 2, 2 ], [ 2, 2 ] ], V );714A rational vector space homomorphism with matrix:715[ [ 2, 2 ],716[ 2, 2 ] ]717718gap> k_lift := KernelLift( alpha, tau );719A rational vector space homomorphism with matrix:720[ [ 2 ],721[ 2 ] ]722723gap> HasKernelEmbedding( alpha );724false725gap> KernelEmbedding( alpha );726A rational vector space homomorphism with matrix:727[ [ 1, 1 ] ]728729]]></Example>730731732<Example><![CDATA[733gap> vecspaces := CreateCapCategory( "VectorSpaces02" );734VectorSpaces02735gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAddKernel02.gi" );736true737gap> V := QVectorSpace( 2 );738<A rational vector space of dimension 2>739gap> W := QVectorSpace( 3 );740<A rational vector space of dimension 3>741gap> alpha := VectorSpaceMorphism( V, [ [ 1, 1, 1 ], [ -1, -1, -1 ] ], W );742A rational vector space homomorphism with matrix:743[ [ 1, 1, 1 ],744[ -1, -1, -1 ] ]745746gap> k := KernelObject( alpha );747<A rational vector space of dimension 1>748gap> T := QVectorSpace( 2 );749<A rational vector space of dimension 2>750gap> tau := VectorSpaceMorphism( T, [ [ 2, 2 ], [ 2, 2 ] ], V );751A rational vector space homomorphism with matrix:752[ [ 2, 2 ],753[ 2, 2 ] ]754755gap> k_lift := KernelLift( alpha, tau );756A rational vector space homomorphism with matrix:757[ [ 2 ],758[ 2 ] ]759760gap> HasKernelEmbedding( alpha );761false762]]></Example>763764765<Example><![CDATA[766gap> vecspaces := CreateCapCategory( "VectorSpaces03" );767VectorSpaces03768gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAddKernel03.gi" );769true770gap> V := QVectorSpace( 2 );771<A rational vector space of dimension 2>772gap> W := QVectorSpace( 3 );773<A rational vector space of dimension 3>774gap> alpha := VectorSpaceMorphism( V, [ [ 1, 1, 1 ], [ -1, -1, -1 ] ], W );775A rational vector space homomorphism with matrix:776[ [ 1, 1, 1 ],777[ -1, -1, -1 ] ]778779gap> k := KernelObject( alpha );780<A rational vector space of dimension 1>781gap> k_emb := KernelEmbedding( alpha );782A rational vector space homomorphism with matrix:783[ [ 1, 1 ] ]784785gap> IsIdenticalObj( Source( k_emb ), k );786true787gap> V := QVectorSpace( 2 );788<A rational vector space of dimension 2>789gap> W := QVectorSpace( 3 );790<A rational vector space of dimension 3>791gap> beta := VectorSpaceMorphism( V, [ [ 1, 1, 1 ], [ -1, -1, -1 ] ], W );792A rational vector space homomorphism with matrix:793[ [ 1, 1, 1 ],794[ -1, -1, -1 ] ]795796gap> k_emb := KernelEmbedding( beta );797A rational vector space homomorphism with matrix:798[ [ 1, 1 ] ]799800gap> IsIdenticalObj( Source( k_emb ), KernelObject( beta ) );801true802]]></Example>803804805</Section>806807808<Section Label="Chapter_Examples_and_Tests_Section_FiberProduct">809<Heading>FiberProduct</Heading>810811<Example><![CDATA[812gap> vecspaces := CreateCapCategory( "VectorSpacesForFiberProductTest" );813VectorSpacesForFiberProductTest814gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );815true816gap> A := QVectorSpace( 1 );817<A rational vector space of dimension 1>818gap> B := QVectorSpace( 2 );819<A rational vector space of dimension 2>820gap> C := QVectorSpace( 3 );821<A rational vector space of dimension 3>822gap> AtoC := VectorSpaceMorphism( A, [ [ 1, 2, 0 ] ], C );823A rational vector space homomorphism with matrix:824[ [ 1, 2, 0 ] ]825826gap> BtoC := VectorSpaceMorphism( B, [ [ 1, 0, 0 ], [ 0, 1, 0 ] ], C );827A rational vector space homomorphism with matrix:828[ [ 1, 0, 0 ],829[ 0, 1, 0 ] ]830831gap> P := FiberProduct( AtoC, BtoC );832<A rational vector space of dimension 1>833gap> p1 := ProjectionInFactorOfFiberProduct( [ AtoC, BtoC ], 1 );834A rational vector space homomorphism with matrix:835[ [ 1/2 ] ]836837gap> p2 := ProjectionInFactorOfFiberProduct( [ AtoC, BtoC ], 2 );838A rational vector space homomorphism with matrix:839[ [ 1/2, 1 ] ]840841]]></Example>842843844</Section>845846847</Chapter>848849850851