CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

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

Views: 418346
1
2
12 Examples and Tests
3
4
5
12.1 Spectral Sequences
6
7
 Example 
8
gap> ZZ := HomalgRingOfIntegersInSingular( );
9
Z
10
gap> C1 := FreeLeftPresentation( 1, ZZ );
11
<An object in Category of left presentations of Z>
12
gap> C2 := FreeLeftPresentation( 2, ZZ );
13
<An object in Category of left presentations of Z>
14
gap> h1 := PresentationMorphism( C2, HomalgMatrix( [ [ 0 ], [ 4 ] ], ZZ ), C1 );
15
<A morphism in Category of left presentations of Z>
16
gap> h2 := PresentationMorphism( C2, HomalgMatrix( [ [ 0 ], [ 2 ] ], ZZ ), C1 );
17
<A morphism in Category of left presentations of Z>
18
gap> v1 := PresentationMorphism( C2, HomalgMatrix( [ [ 2, 0 ], [ 1, 2 ] ], ZZ ), C2 );
19
<A morphism in Category of left presentations of Z>
20
gap> v2 := PresentationMorphism( C1, HomalgMatrix( [ [ 4 ] ], ZZ ), C1 );
21
<A morphism in Category of left presentations of Z>
22
gap> cocomplex_h1 := CocomplexFromMorphismList( [ h1 ] );
23
<An object in Cocomplex category of Category of left presentations of Z>
24
gap> cocomplex_h2 := CocomplexFromMorphismList( [ h2 ] );
25
<An object in Cocomplex category of Category of left presentations of Z>
26
gap> cocomplex_mor := CochainMap( cocomplex_h2, [ v1, v2 ], cocomplex_h1 );
27
<A morphism in Cocomplex category of Category of left presentations of Z>
28
gap> Zmod := CapCategory( C1 );
29
Category of left presentations of Z
30
gap> CH0 := CohomologyFunctor( Zmod, 0 );
31
0-th cohomology functor of Category of left presentations of Z
32
gap> cmor0 := ApplyFunctor( CH0, cocomplex_mor );
33
<A morphism in Category of left presentations of Z>
34
gap> Display( UnderlyingMatrix( cmor0 ) );
35
2
36
gap> CH1 := CohomologyFunctor( Zmod, 1 );
37
1-th cohomology functor of Category of left presentations of Z
38
gap> cmor1 := ApplyFunctor( CH1, cocomplex_mor );
39
<A morphism in Category of left presentations of Z>
40
gap> Display( UnderlyingMatrix( cmor1 ) );
41
4
42
gap> ToComplex := CocomplexToComplexFunctor( Zmod );
43
Cocomplex to complex functor of Category of left presentations of Z
44
gap> complex_mor := ApplyFunctor( ToComplex, cocomplex_mor );
45
<A morphism in Complex category of Category of left presentations of Z>
46
gap> H0 := HomologyFunctor( Zmod, 0 );
47
0-th homology functor of Category of left presentations of Z
48
gap> mor0 := ApplyFunctor( H0, complex_mor );
49
<A morphism in Category of left presentations of Z>
50
gap> Display( UnderlyingMatrix( mor0 ) );
51
2
52
gap> Hm1 := HomologyFunctor( Zmod, -1 );
53
-1-th homology functor of Category of left presentations of Z
54
gap> mor1 := ApplyFunctor( Hm1, complex_mor );
55
<A morphism in Category of left presentations of Z>
56
gap> Display( UnderlyingMatrix( mor1 ) );
57
4
58

59
60
 Example 
61
gap> QQ := HomalgFieldOfRationalsInSingular( );;
62
gap> R := QQ * "x,y";
63
Q[x,y]
64
gap> SetRecursionTrapInterval( 10000 );
65
gap> category := LeftPresentations( R );
66
Category of left presentations of Q[x,y]
67
gap> S := FreeLeftPresentation( 1, R );
68
<An object in Category of left presentations of Q[x,y]>
69
gap> object_func := function( i ) return S; end;
70
function( i ) ... end
71
gap> morphism_func := function( i ) return IdentityMorphism( S ); end;
72
function( i ) ... end
73
gap> C0 := ZFunctorObjectExtendedByInitialAndIdentity( object_func, morphism_func, category, 0, 4 );
74
<An object in Functors from integers into Category of left presentations of Q[x,y]>
75
gap> S2 := FreeLeftPresentation( 2, R );
76
<An object in Category of left presentations of Q[x,y]>
77
gap> C1 := ZFunctorObjectFromMorphismList( [ InjectionOfCofactorOfDirectSum( [ S2, S ], 1 ) ], 2 );
78
<An object in Functors from integers into Category of left presentations of Q[x,y]>
79
gap> C1 := ZFunctorObjectExtendedByInitialAndIdentity( C1, 2, 3 );
80
<An object in Functors from integers into Category of left presentations of Q[x,y]>
81
gap> C2 := ZFunctorObjectFromMorphismList( [ InjectionOfCofactorOfDirectSum( [ S, S ], 1 ) ], 3 );
82
<An object in Functors from integers into Category of left presentations of Q[x,y]>
83
gap> C2 := ZFunctorObjectExtendedByInitialAndIdentity( C2, 3, 4 );
84
<An object in Functors from integers into Category of left presentations of Q[x,y]>
85
gap> delta_1_3 := PresentationMorphism( C1[3], HomalgMatrix( [ [ "x^2" ], [ "xy" ], [ "y^3"] ], 3, 1, R ), C0[3] );
86
<A morphism in Category of left presentations of Q[x,y]>
87
gap> delta_1_2 := PresentationMorphism( C1[2], HomalgMatrix( [ [ "x^2" ], [ "xy" ] ], 2, 1, R ), C0[2] );
88
<A morphism in Category of left presentations of Q[x,y]>
89
gap> delta1 := ZFunctorMorphism( C1, [ UniversalMorphismFromInitialObject( C0[1] ), UniversalMorphismFromInitialObject( C0[1] ), delta_1_2, delta_1_3 ], 0, C0 );
90
<A morphism in Functors from integers into Category of left presentations of Q[x,y]>
91
gap> delta1 := ZFunctorMorphismExtendedByInitialAndIdentity( delta1, 0, 3 );
92
<A morphism in Functors from integers into Category of left presentations of Q[x,y]>
93
gap> delta1 := AsAscendingFilteredMorphism( delta1 );
94
<A morphism in Ascending filtered object category of Category of left presentations of Q[x,y]>
95
gap> delta_2_3 := PresentationMorphism( C2[3], HomalgMatrix( [ [ "y", "-x", "0" ] ], 1, 3, R ), C1[3] );
96
<A morphism in Category of left presentations of Q[x,y]>
97
gap> delta_2_4 := PresentationMorphism( C2[4], HomalgMatrix( [ [ "y", "-x", "0" ], [ "0", "y^2", "-x" ] ], 2, 3, R ), C1[4] );
98
<A morphism in Category of left presentations of Q[x,y]>
99
gap> delta2 := ZFunctorMorphism( C2, [ UniversalMorphismFromInitialObject( C1[2] ), delta_2_3, delta_2_4 ], 2, C1 );
100
<A morphism in Functors from integers into Category of left presentations of Q[x,y]>
101
gap> delta2 := ZFunctorMorphismExtendedByInitialAndIdentity( delta2, 2, 4 );
102
<A morphism in Functors from integers into Category of left presentations of Q[x,y]>
103
gap> delta2 := AsAscendingFilteredMorphism( delta2 );
104
<A morphism in Ascending filtered object category of Category of left presentations of Q[x,y]>
105
gap> SetIsAdditiveCategory( CategoryOfAscendingFilteredObjects( category ), true );
106
gap> complex := ZFunctorObjectFromMorphismList( [ delta2, delta1 ], -2 );
107
<An object in Functors from integers into Ascending filtered object category of Category of left presentations of Q[x,y]>
108
gap> complex := AsComplex( complex );
109
<An object in Complex category of Ascending filtered object category of Category of left presentations of Q[x,y]>
110
gap> LessGenFunctor := FunctorLessGeneratorsLeft( R );
111
Less generators for Category of left presentations of Q[x,y]
112
gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 0, 0, 0 );
113
<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
114
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
115
(an empty 0 x 1 matrix)
116
gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 1, 0, 0 );
117
<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
118
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
119
(an empty 0 x 1 matrix)
120
gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 2, 0, 0 );
121
<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
122
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
123
(an empty 0 x 1 matrix)
124
gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 3, 0, 0 );
125
<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
126
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
127
x*y,
128
x^2
129
gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 4, 0, 0 );
130
<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
131
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
132
x*y,
133
x^2,
134
y^3
135
gap> s := SpectralSequenceEntryOfAscendingFilteredComplex( complex, 5, 0, 0 );
136
<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
137
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
138
x*y,
139
x^2,
140
y^3
141
gap> s := SpectralSequenceDifferentialOfAscendingFilteredComplex( complex, 3, 3, -2 );
142
<A morphism in Category of left presentations of Q[x,y]>
143
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, s ) ) );
144
y^3
145
gap> AscToDescFunctor := AscendingToDescendingFilteredObjectFunctor( category );
146
Ascending to descending filtered object functor of Category of left presentations of Q[x,y]
147
gap> cocomplex := ZFunctorObjectFromMorphismList( [ ApplyFunctor( AscToDescFunctor, delta2 ), ApplyFunctor( AscToDescFunctor, delta1 ) ], -2 );
148
<An object in Functors from integers into Descending filtered object category of Category of left presentations of Q[x,y]>
149
gap> SetIsAdditiveCategory( CategoryOfDescendingFilteredObjects( category ), true );
150
gap> cocomplex := AsCocomplex( cocomplex );
151
<An object in Cocomplex category of Descending filtered object category of Category of left presentations of Q[x,y]>
152
gap> s := SpectralSequenceEntryOfDescendingFilteredCocomplex( cocomplex, 0, -2, 1 );
153
<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
154
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
155
(an empty 0 x 2 matrix)
156
gap> s := SpectralSequenceEntryOfDescendingFilteredCocomplex( cocomplex, 1, -2, 1 );
157
<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
158
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
159
(an empty 0 x 2 matrix)
160
gap> s := SpectralSequenceEntryOfDescendingFilteredCocomplex( cocomplex, 2, -2, 1 );
161
<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
162
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
163
-y,x
164
gap> s := SpectralSequenceEntryOfDescendingFilteredCocomplex( cocomplex, 3, -2, 1 );
165
<A morphism in Generalized morphism category of Category of left presentations of Q[x,y]>
166
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, UnderlyingHonestObject( Source( s ) ) ) ) );
167
(an empty 0 x 0 matrix)
168
gap> s := SpectralSequenceDifferentialOfDescendingFilteredCocomplex( cocomplex, 2, -2, 1 );
169
<A morphism in Category of left presentations of Q[x,y]>
170
gap> Display( UnderlyingMatrix( ApplyFunctor( LessGenFunctor, s ) ) );
171
x^2,
172
x*y
173

174
175
176
12.2 Monoidal Categories
177
178
 Example 
179
gap> ZZ := HomalgRingOfIntegers();;
180
gap> Ml := AsLeftPresentation( HomalgMatrix( [ [ 2 ] ], 1, 1, ZZ ) );
181
<An object in Category of left presentations of Z>
182
gap> Nl := AsLeftPresentation( HomalgMatrix( [ [ 3 ] ], 1, 1, ZZ ) );
183
<An object in Category of left presentations of Z>
184
gap> Tl := TensorProductOnObjects( Ml, Nl );
185
<An object in Category of left presentations of Z>
186
gap> Display( UnderlyingMatrix( Tl ) );
187
[ [ 3 ],
188
 [ 2 ] ]
189
gap> IsZeroForObjects( Tl );
190
true
191
gap> Bl := Braiding( DirectSum( Ml, Nl ), DirectSum( Ml, Ml ) );
192
<A morphism in Category of left presentations of Z>
193
gap> Display( UnderlyingMatrix( Bl ) );
194
[ [ 1, 0, 0, 0 ],
195
 [ 0, 0, 1, 0 ],
196
 [ 0, 1, 0, 0 ],
197
 [ 0, 0, 0, 1 ] ]
198
gap> IsWellDefined( Bl );
199
true
200
gap> Ul := TensorUnit( CapCategory( Ml ) );
201
<An object in Category of left presentations of Z>
202
gap> IntHoml := InternalHomOnObjects( DirectSum( Ml, Ul ), Nl );
203
<An object in Category of left presentations of Z>
204
gap> Display( UnderlyingMatrix( IntHoml ) );
205
[ [ -2, -1 ],
206
 [ 1, -1 ] ]
207
gap> generator_l1 := StandardGeneratorMorphism( IntHoml, 1 );
208
<A morphism in Category of left presentations of Z>
209
gap> morphism_l1 := LambdaElimination( DirectSum( Ml, Ul ), Nl, generator_l1 );
210
<A morphism in Category of left presentations of Z>
211
gap> Display( UnderlyingMatrix( morphism_l1 ) );
212
[ [ 0 ],
213
 [ 2 ] ]
214
gap> generator_l2 := StandardGeneratorMorphism( IntHoml, 2 );
215
<A morphism in Category of left presentations of Z>
216
gap> morphism_l2 := LambdaElimination( DirectSum( Ml, Ul ), Nl, generator_l2 );
217
<A morphism in Category of left presentations of Z>
218
gap> Display( UnderlyingMatrix( morphism_l2 ) );
219
[ [ 0 ],
220
 [ 2 ] ]
221
gap> IsEqualForMorphisms( LambdaIntroduction( morphism_l1 ), generator_l1 );
222
false
223
gap> IsCongruentForMorphisms( LambdaIntroduction( morphism_l1 ), generator_l1 );
224
true
225
gap> IsEqualForMorphisms( LambdaIntroduction( morphism_l2 ), generator_l2 );
226
false
227
gap> IsCongruentForMorphisms( LambdaIntroduction( morphism_l2 ), generator_l2 );
228
true
229
gap> Mr := AsRightPresentation( HomalgMatrix( [ [ 2 ] ], 1, 1, ZZ ) );
230
<An object in Category of right presentations of Z>
231
gap> Nr := AsRightPresentation( HomalgMatrix( [ [ 3 ] ], 1, 1, ZZ ) );
232
<An object in Category of right presentations of Z>
233
gap> Tr := TensorProductOnObjects( Mr, Nr );
234
<An object in Category of right presentations of Z>
235
gap> Display( UnderlyingMatrix( Tr ) );
236
[ [ 3, 2 ] ]
237
gap> IsZeroForObjects( Tr );
238
true
239
gap> Br := Braiding( DirectSum( Mr, Nr ), DirectSum( Mr, Mr ) );
240
<A morphism in Category of right presentations of Z>
241
gap> Display( UnderlyingMatrix( Br ) );
242
[ [ 1, 0, 0, 0 ],
243
 [ 0, 0, 1, 0 ],
244
 [ 0, 1, 0, 0 ],
245
 [ 0, 0, 0, 1 ] ]
246
gap> IsWellDefined( Br );
247
true
248
gap> Ur := TensorUnit( CapCategory( Mr ) );
249
<An object in Category of right presentations of Z>
250
gap> IntHomr := InternalHomOnObjects( DirectSum( Mr, Ur ), Nr );
251
<An object in Category of right presentations of Z>
252
gap> Display( UnderlyingMatrix( IntHomr ) );
253
[ [ -2, 1 ],
254
 [ -1, -1 ] ]
255
gap> generator_r1 := StandardGeneratorMorphism( IntHomr, 1 );
256
<A morphism in Category of right presentations of Z>
257
gap> morphism_r1 := LambdaElimination( DirectSum( Mr, Ur ), Nr, generator_r1 );
258
<A morphism in Category of right presentations of Z>
259
gap> Display( UnderlyingMatrix( morphism_r1 ) );
260
[ [ 0, 2 ] ]
261
gap> generator_r2 := StandardGeneratorMorphism( IntHoml, 2 );
262
<A morphism in Category of left presentations of Z>
263
gap> morphism_r2 := LambdaElimination( DirectSum( Ml, Ul ), Nl, generator_r2 );
264
<A morphism in Category of left presentations of Z>
265
gap> Display( UnderlyingMatrix( morphism_r2 ) );
266
[ [ 0 ],
267
 [ 2 ] ]
268
gap> IsEqualForMorphisms( LambdaIntroduction( morphism_r1 ), generator_r1 );
269
false
270
gap> IsCongruentForMorphisms( LambdaIntroduction( morphism_r1 ), generator_r1 );
271
true
272
gap> IsEqualForMorphisms( LambdaIntroduction( morphism_r2 ), generator_r2 );
273
false
274
gap> IsCongruentForMorphisms( LambdaIntroduction( morphism_r2 ), generator_r2 );
275
true
276

277
278
279
12.3 Generalized Morphisms Category
280
281
 Example 
282
gap> vecspaces := CreateCapCategory( "VectorSpacesForGeneralizedMorphismsTest" );
283
VectorSpacesForGeneralizedMorphismsTest
284
gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );
285
true
286
gap> LoadPackage( "GeneralizedMorphismsForCAP" );
287
true
288
gap> B := QVectorSpace( 2 );
289
<A rational vector space of dimension 2>
290
gap> C := QVectorSpace( 3 );
291
<A rational vector space of dimension 3>
292
gap> B_1 := QVectorSpace( 1 );
293
<A rational vector space of dimension 1>
294
gap> C_1 := QVectorSpace( 2 );
295
<A rational vector space of dimension 2>
296
gap> c1_source_aid := VectorSpaceMorphism( B_1, [ [ 1, 0 ] ], B );
297
A rational vector space homomorphism with matrix: 
298
[ [ 1, 0 ] ]
299

300
gap> SetIsSubobject( c1_source_aid, true );
301
gap> c1_range_aid := VectorSpaceMorphism( C, [ [ 1, 0 ], [ 0, 1 ], [ 0, 0 ] ], C_1 );
302
A rational vector space homomorphism with matrix: 
303
[ [ 1, 0 ],
304
 [ 0, 1 ],
305
 [ 0, 0 ] ]
306

307
gap> SetIsFactorobject( c1_range_aid, true );
308
gap> c1_associated := VectorSpaceMorphism( B_1, [ [ 1, 1 ] ], C_1 );
309
A rational vector space homomorphism with matrix: 
310
[ [ 1, 1 ] ]
311

312
gap> c1 := GeneralizedMorphism( c1_source_aid, c1_associated, c1_range_aid );
313
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
314
gap> B_2 := QVectorSpace( 1 );
315
<A rational vector space of dimension 1>
316
gap> C_2 := QVectorSpace( 2 );
317
<A rational vector space of dimension 2>
318
gap> c2_source_aid := VectorSpaceMorphism( B_2, [ [ 2, 0 ] ], B );
319
A rational vector space homomorphism with matrix: 
320
[ [ 2, 0 ] ]
321

322
gap> SetIsSubobject( c2_source_aid, true );
323
gap> c2_range_aid := VectorSpaceMorphism( C, [ [ 3, 0 ], [ 0, 3 ], [ 0, 0 ] ], C_2 );
324
A rational vector space homomorphism with matrix: 
325
[ [ 3, 0 ],
326
 [ 0, 3 ],
327
 [ 0, 0 ] ]
328

329
gap> SetIsFactorobject( c2_range_aid, true );
330
gap> c2_associated := VectorSpaceMorphism( B_2, [ [ 6, 6 ] ], C_2 );
331
A rational vector space homomorphism with matrix: 
332
[ [ 6, 6 ] ]
333

334
gap> c2 := GeneralizedMorphism( c2_source_aid, c2_associated, c2_range_aid );
335
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
336
gap> IsCongruentForMorphisms( c1, c2 );
337
true
338
gap> IsCongruentForMorphisms( c1, c1 );
339
true
340
gap> c3_associated := VectorSpaceMorphism( B_1, [ [ 2, 2 ] ], C_1 );
341
A rational vector space homomorphism with matrix: 
342
[ [ 2, 2 ] ]
343

344
gap> c3 := GeneralizedMorphism( c1_source_aid, c3_associated, c1_range_aid );
345
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
346
gap> IsCongruentForMorphisms( c1, c3 );
347
false
348
gap> IsCongruentForMorphisms( c2, c3 );
349
false
350
gap> c1 + c2;
351
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
352
gap> Arrow( c1 + c2 );
353
A rational vector space homomorphism with matrix: 
354
[ [ 12, 12 ] ]
355

356

357
358
First composition test:
359
360
 Example 
361
gap> vecspaces := CreateCapCategory( "VectorSpacesForGeneralizedMorphismsTest" );
362
VectorSpacesForGeneralizedMorphismsTest
363
gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );
364
true
365
gap> A := QVectorSpace( 1 );
366
<A rational vector space of dimension 1>
367
gap> B := QVectorSpace( 2 );
368
<A rational vector space of dimension 2>
369
gap> C := QVectorSpace( 3 );
370
<A rational vector space of dimension 3>
371
gap> phi_tilde_associated := VectorSpaceMorphism( A, [ [ 1, 2, 0 ] ], C );
372
A rational vector space homomorphism with matrix: 
373
[ [ 1, 2, 0 ] ]
374

375
gap> phi_tilde_source_aid := VectorSpaceMorphism( A, [ [ 1, 2 ] ], B );
376
A rational vector space homomorphism with matrix: 
377
[ [ 1, 2 ] ]
378

379
gap> phi_tilde := GeneralizedMorphismWithSourceAid( phi_tilde_source_aid, phi_tilde_associated );
380
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
381
gap> psi_tilde_associated := IdentityMorphism( B );
382
A rational vector space homomorphism with matrix: 
383
[ [ 1, 0 ],
384
 [ 0, 1 ] ]
385

386
gap> psi_tilde_source_aid := VectorSpaceMorphism( B, [ [ 1, 0, 0 ], [ 0, 1, 0 ] ], C );
387
A rational vector space homomorphism with matrix: 
388
[ [ 1, 0, 0 ],
389
 [ 0, 1, 0 ] ]
390

391
gap> psi_tilde := GeneralizedMorphismWithSourceAid( psi_tilde_source_aid, psi_tilde_associated );
392
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
393
gap> composition := PreCompose( phi_tilde, psi_tilde );
394
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
395
gap> Arrow( composition );
396
A rational vector space homomorphism with matrix: 
397
[ [ 1/2, 1 ] ]
398

399
gap> SourceAid( composition );
400
A rational vector space homomorphism with matrix: 
401
[ [ 1/2, 1 ] ]
402

403
gap> RangeAid( composition );
404
A rational vector space homomorphism with matrix: 
405
[ [ 1, 0 ],
406
 [ 0, 1 ] ]
407

408
409
Second composition test
410
411
 Example 
412
gap> vecspaces := CreateCapCategory( "VectorSpacesForGeneralizedMorphismsTest" );
413
VectorSpacesForGeneralizedMorphismsTest
414
gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );
415
true
416
gap> A := QVectorSpace( 1 );
417
<A rational vector space of dimension 1>
418
gap> B := QVectorSpace( 2 );
419
<A rational vector space of dimension 2>
420
gap> C := QVectorSpace( 3 );
421
<A rational vector space of dimension 3>
422
gap> phi2_tilde_associated := VectorSpaceMorphism( A, [ [ 1, 5 ] ], B );
423
A rational vector space homomorphism with matrix: 
424
[ [ 1, 5 ] ]
425

426
gap> phi2_tilde_range_aid := VectorSpaceMorphism( C, [ [ 1, 0 ], [ 0, 1 ], [ 1, 1 ] ], B );
427
A rational vector space homomorphism with matrix: 
428
[ [ 1, 0 ],
429
 [ 0, 1 ],
430
 [ 1, 1 ] ]
431

432
gap> phi2_tilde := GeneralizedMorphismWithRangeAid( phi2_tilde_associated, phi2_tilde_range_aid );
433
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
434
gap> psi2_tilde_associated := VectorSpaceMorphism( C, [ [ 1 ], [ 3 ], [ 4 ] ], A );
435
A rational vector space homomorphism with matrix: 
436
[ [ 1 ],
437
 [ 3 ],
438
 [ 4 ] ]
439

440
gap> psi2_tilde_range_aid := VectorSpaceMorphism( B, [ [ 1 ], [ 1 ] ], A );
441
A rational vector space homomorphism with matrix: 
442
[ [ 1 ],
443
 [ 1 ] ]
444

445
gap> psi2_tilde := GeneralizedMorphismWithRangeAid( psi2_tilde_associated, psi2_tilde_range_aid );
446
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
447
gap> composition2 := PreCompose( phi2_tilde, psi2_tilde );
448
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
449
gap> Arrow( composition2 );
450
A rational vector space homomorphism with matrix: 
451
[ [ 16 ] ]
452

453
gap> RangeAid( composition2 );
454
A rational vector space homomorphism with matrix: 
455
[ [ 1 ],
456
 [ 1 ] ]
457

458
gap> SourceAid( composition2 );
459
A rational vector space homomorphism with matrix: 
460
[ [ 1 ] ]
461

462
463
Third composition test
464
465
 Example 
466
gap> vecspaces := CreateCapCategory( "VectorSpacesForGeneralizedMorphismsTest" );
467
VectorSpacesForGeneralizedMorphismsTest
468
gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );
469
true
470
gap> A := QVectorSpace( 3 );
471
<A rational vector space of dimension 3>
472
gap> Asub := QVectorSpace( 2 );
473
<A rational vector space of dimension 2>
474
gap> B := QVectorSpace( 3 );
475
<A rational vector space of dimension 3>
476
gap> Bfac := QVectorSpace( 1 );
477
<A rational vector space of dimension 1>
478
gap> Bsub := QVectorSpace( 2 );
479
<A rational vector space of dimension 2>
480
gap> C := QVectorSpace( 3 );
481
<A rational vector space of dimension 3>
482
gap> Cfac := QVectorSpace( 1 );
483
<A rational vector space of dimension 1>
484
gap> Asub_into_A := VectorSpaceMorphism( Asub, [ [ 1, 0, 0 ], [ 0, 1, 0 ] ], A );
485
A rational vector space homomorphism with matrix: 
486
[ [ 1, 0, 0 ],
487
 [ 0, 1, 0 ] ]
488

489
gap> Asub_to_Bfac := VectorSpaceMorphism( Asub, [ [ 1 ], [ 1 ] ], Bfac );
490
A rational vector space homomorphism with matrix: 
491
[ [ 1 ],
492
 [ 1 ] ]
493

494
gap> B_onto_Bfac := VectorSpaceMorphism( B, [ [ 1 ], [ 1 ], [ 1 ] ], Bfac );
495
A rational vector space homomorphism with matrix: 
496
[ [ 1 ],
497
 [ 1 ],
498
 [ 1 ] ]
499

500
gap> Bsub_into_B := VectorSpaceMorphism( Bsub, [ [ 2, 2, 0 ], [ 0, 2, 2 ] ], B );
501
A rational vector space homomorphism with matrix: 
502
[ [ 2, 2, 0 ],
503
 [ 0, 2, 2 ] ]
504

505
gap> Bsub_to_Cfac := VectorSpaceMorphism( Bsub, [ [ 3 ], [ 0 ] ], Cfac );
506
A rational vector space homomorphism with matrix: 
507
[ [ 3 ],
508
 [ 0 ] ]
509

510
gap> C_onto_Cfac := VectorSpaceMorphism( C, [ [ 1 ], [ 2 ], [ 3 ] ], Cfac );
511
A rational vector space homomorphism with matrix: 
512
[ [ 1 ],
513
 [ 2 ],
514
 [ 3 ] ]
515

516
gap> generalized_morphism1 := GeneralizedMorphism( Asub_into_A, Asub_to_Bfac, B_onto_Bfac );
517
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
518
gap> generalized_morphism2 := GeneralizedMorphism( Bsub_into_B, Bsub_to_Cfac, C_onto_Cfac );
519
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
520
gap> IsWellDefined( generalized_morphism1 );
521
true
522
gap> IsWellDefined( generalized_morphism2 );
523
true
524
gap> p := PreCompose( generalized_morphism1, generalized_morphism2 );
525
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
526
gap> SourceAid( p );
527
A rational vector space homomorphism with matrix: 
528
[ [ -1, 1, 0 ],
529
 [ 1, 0, 0 ] ]
530

531
gap> Arrow( p );
532
A rational vector space homomorphism with matrix: 
533
(an empty 2 x 0 matrix)
534

535
gap> RangeAid( p );
536
A rational vector space homomorphism with matrix: 
537
(an empty 3 x 0 matrix)
538
gap> A := QVectorSpace( 3 );
539
<A rational vector space of dimension 3>
540
gap> Asub := QVectorSpace( 2 );
541
<A rational vector space of dimension 2>
542
gap> B := QVectorSpace( 3 );
543
<A rational vector space of dimension 3>
544
gap> Bfac := QVectorSpace( 1 );
545
<A rational vector space of dimension 1>
546
gap> Bsub := QVectorSpace( 2 );
547
<A rational vector space of dimension 2>
548
gap> C := QVectorSpace( 3 );
549
<A rational vector space of dimension 3>
550
gap> Cfac := QVectorSpace( 2 );
551
<A rational vector space of dimension 2>
552
gap> Asub_into_A := VectorSpaceMorphism( Asub, [ [ 1, 0, 0 ], [ 0, 1, 0 ] ], A );
553
A rational vector space homomorphism with matrix: 
554
[ [ 1, 0, 0 ],
555
 [ 0, 1, 0 ] ]
556

557
gap> Asub_to_Bfac := VectorSpaceMorphism( Asub, [ [ 1 ], [ 1 ] ], Bfac );
558
A rational vector space homomorphism with matrix: 
559
[ [ 1 ],
560
 [ 1 ] ]
561

562
gap> B_onto_Bfac := VectorSpaceMorphism( B, [ [ 1 ], [ 1 ], [ 1 ] ], Bfac );
563
A rational vector space homomorphism with matrix: 
564
[ [ 1 ],
565
 [ 1 ],
566
 [ 1 ] ]
567

568
gap> Bsub_into_B := VectorSpaceMorphism( Bsub, [ [ 2, 2, 0 ], [ 0, 2, 2 ] ], B );
569
A rational vector space homomorphism with matrix: 
570
[ [ 2, 2, 0 ],
571
 [ 0, 2, 2 ] ]
572

573
gap> Bsub_to_Cfac := VectorSpaceMorphism( Bsub, [ [ 3, 3 ], [ 0, 0 ] ], Cfac );
574
A rational vector space homomorphism with matrix: 
575
[ [ 3, 3 ],
576
 [ 0, 0 ] ]
577

578
gap> C_onto_Cfac := VectorSpaceMorphism( C, [ [ 1, 0 ], [ 0, 2 ], [ 3, 3 ] ], Cfac );
579
A rational vector space homomorphism with matrix: 
580
[ [ 1, 0 ],
581
 [ 0, 2 ],
582
 [ 3, 3 ] ]
583

584
gap> generalized_morphism1 := GeneralizedMorphism( Asub_into_A, Asub_to_Bfac, B_onto_Bfac );
585
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
586
gap> generalized_morphism2 := GeneralizedMorphism( Bsub_into_B, Bsub_to_Cfac, C_onto_Cfac );
587
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
588
gap> IsWellDefined( generalized_morphism1 );
589
true
590
gap> IsWellDefined( generalized_morphism2 );
591
true
592
gap> p := PreCompose( generalized_morphism1, generalized_morphism2 );
593
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
594
gap> SourceAid( p );
595
A rational vector space homomorphism with matrix: 
596
[ [ -1, 1, 0 ],
597
 [ 1, 0, 0 ] ]
598

599
gap> Arrow( p );
600
A rational vector space homomorphism with matrix: 
601
[ [ 0 ],
602
 [ 0 ] ]
603

604
gap> RangeAid( p );
605
A rational vector space homomorphism with matrix: 
606
[ [ -1 ],
607
 [ 2 ],
608
 [ 0 ] ]
609

610
611
Honest representative test
612
613
 Example 
614
gap> vecspaces := CreateCapCategory( "VectorSpacesForGeneralizedMorphismsTest" );
615
VectorSpacesForGeneralizedMorphismsTest
616
gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );
617
true
618
gap> A := QVectorSpace( 1 );
619
<A rational vector space of dimension 1>
620
gap> B := QVectorSpace( 2 );
621
<A rational vector space of dimension 2>
622
gap> phi_tilde_source_aid := VectorSpaceMorphism( A, [ [ 2 ] ], A );
623
A rational vector space homomorphism with matrix: 
624
[ [ 2 ] ]
625

626
gap> phi_tilde_associated := VectorSpaceMorphism( A, [ [ 1, 1 ] ], B );
627
A rational vector space homomorphism with matrix: 
628
[ [ 1, 1 ] ]
629

630
gap> phi_tilde_range_aid := VectorSpaceMorphism( B, [ [ 1, 2 ], [ 3, 4 ] ], B );
631
A rational vector space homomorphism with matrix: 
632
[ [ 1, 2 ],
633
 [ 3, 4 ] ]
634

635
gap> phi_tilde := GeneralizedMorphism( phi_tilde_source_aid, phi_tilde_associated, phi_tilde_range_aid );
636
<A morphism in Generalized morphism category of VectorSpacesForGeneralizedMorphismsTest>
637
gap> HonestRepresentative( phi_tilde );
638
A rational vector space homomorphism with matrix: 
639
[ [ -1/4, 1/4 ] ]
640

641
gap> IsWellDefined( phi_tilde );
642
true
643
gap> IsWellDefined( psi_tilde );
644
true
645

646
647
648
12.4 IsWellDefined
649
650
 Example 
651
gap> vecspaces := CreateCapCategory( "VectorSpacesForIsWellDefinedTest" );
652
VectorSpacesForIsWellDefinedTest 
653
gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );
654
true
655
gap> LoadPackage( "GeneralizedMorphismsForCAP" );
656
true
657
gap> A := QVectorSpace( 1 );
658
<A rational vector space of dimension 1>
659
gap> B := QVectorSpace( 2 );
660
<A rational vector space of dimension 2>
661
gap> alpha := VectorSpaceMorphism( A, [ [ 1, 2 ] ], B );
662
A rational vector space homomorphism with matrix: 
663
[ [ 1, 2 ] ]
664

665
gap> g := GeneralizedMorphism( alpha, alpha, alpha );
666
<A morphism in Generalized morphism category of VectorSpacesForIsWellDefinedTest>
667
gap> IsWellDefined( alpha );
668
true
669
gap> IsWellDefined( g );
670
true
671

672
673
674
12.5 Kernel
675
676
 Example 
677
gap> vecspaces := CreateCapCategory( "VectorSpaces01" );
678
VectorSpaces01
679
gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAddKernel01.gi" );
680
true
681
gap> V := QVectorSpace( 2 );
682
<A rational vector space of dimension 2>
683
gap> W := QVectorSpace( 3 );
684
<A rational vector space of dimension 3>
685
gap> alpha := VectorSpaceMorphism( V, [ [ 1, 1, 1 ], [ -1, -1, -1 ] ], W );
686
A rational vector space homomorphism with matrix: 
687
[ [ 1, 1, 1 ],
688
 [ -1, -1, -1 ] ]
689

690
gap> k := KernelObject( alpha );
691
<A rational vector space of dimension 1>
692
gap> T := QVectorSpace( 2 );
693
<A rational vector space of dimension 2>
694
gap> tau := VectorSpaceMorphism( T, [ [ 2, 2 ], [ 2, 2 ] ], V );
695
A rational vector space homomorphism with matrix: 
696
[ [ 2, 2 ],
697
 [ 2, 2 ] ]
698

699
gap> k_lift := KernelLift( alpha, tau );
700
A rational vector space homomorphism with matrix: 
701
[ [ 2 ],
702
 [ 2 ] ]
703

704
gap> HasKernelEmbedding( alpha );
705
false
706
gap> KernelEmbedding( alpha );
707
A rational vector space homomorphism with matrix: 
708
[ [ 1, 1 ] ]
709

710

711
712
 Example 
713
gap> vecspaces := CreateCapCategory( "VectorSpaces02" );
714
VectorSpaces02
715
gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAddKernel02.gi" );
716
true
717
gap> V := QVectorSpace( 2 );
718
<A rational vector space of dimension 2>
719
gap> W := QVectorSpace( 3 );
720
<A rational vector space of dimension 3>
721
gap> alpha := VectorSpaceMorphism( V, [ [ 1, 1, 1 ], [ -1, -1, -1 ] ], W );
722
A rational vector space homomorphism with matrix: 
723
[ [ 1, 1, 1 ],
724
 [ -1, -1, -1 ] ]
725

726
gap> k := KernelObject( alpha );
727
<A rational vector space of dimension 1>
728
gap> T := QVectorSpace( 2 );
729
<A rational vector space of dimension 2>
730
gap> tau := VectorSpaceMorphism( T, [ [ 2, 2 ], [ 2, 2 ] ], V );
731
A rational vector space homomorphism with matrix: 
732
[ [ 2, 2 ],
733
 [ 2, 2 ] ]
734

735
gap> k_lift := KernelLift( alpha, tau );
736
A rational vector space homomorphism with matrix: 
737
[ [ 2 ],
738
 [ 2 ] ]
739

740
gap> HasKernelEmbedding( alpha );
741
false
742

743
744
 Example 
745
gap> vecspaces := CreateCapCategory( "VectorSpaces03" );
746
VectorSpaces03
747
gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAddKernel03.gi" );
748
true
749
gap> V := QVectorSpace( 2 );
750
<A rational vector space of dimension 2>
751
gap> W := QVectorSpace( 3 );
752
<A rational vector space of dimension 3>
753
gap> alpha := VectorSpaceMorphism( V, [ [ 1, 1, 1 ], [ -1, -1, -1 ] ], W );
754
A rational vector space homomorphism with matrix: 
755
[ [ 1, 1, 1 ],
756
 [ -1, -1, -1 ] ]
757

758
gap> k := KernelObject( alpha );
759
<A rational vector space of dimension 1>
760
gap> k_emb := KernelEmbedding( alpha );
761
A rational vector space homomorphism with matrix: 
762
[ [ 1, 1 ] ]
763

764
gap> IsIdenticalObj( Source( k_emb ), k );
765
true
766
gap> V := QVectorSpace( 2 );
767
<A rational vector space of dimension 2>
768
gap> W := QVectorSpace( 3 );
769
<A rational vector space of dimension 3>
770
gap> beta := VectorSpaceMorphism( V, [ [ 1, 1, 1 ], [ -1, -1, -1 ] ], W );
771
A rational vector space homomorphism with matrix: 
772
[ [ 1, 1, 1 ],
773
 [ -1, -1, -1 ] ]
774

775
gap> k_emb := KernelEmbedding( beta );
776
A rational vector space homomorphism with matrix: 
777
[ [ 1, 1 ] ]
778

779
gap> IsIdenticalObj( Source( k_emb ), KernelObject( beta ) );
780
true
781

782
783
784
12.6 FiberProduct
785
786
 Example 
787
gap> vecspaces := CreateCapCategory( "VectorSpacesForFiberProductTest" );
788
VectorSpacesForFiberProductTest
789
gap> ReadPackage( "CAP", "examples/testfiles/VectorSpacesAllMethods.gi" );
790
true
791
gap> A := QVectorSpace( 1 );
792
<A rational vector space of dimension 1>
793
gap> B := QVectorSpace( 2 );
794
<A rational vector space of dimension 2>
795
gap> C := QVectorSpace( 3 );
796
<A rational vector space of dimension 3>
797
gap> AtoC := VectorSpaceMorphism( A, [ [ 1, 2, 0 ] ], C );
798
A rational vector space homomorphism with matrix: 
799
[ [ 1, 2, 0 ] ]
800

801
gap> BtoC := VectorSpaceMorphism( B, [ [ 1, 0, 0 ], [ 0, 1, 0 ] ], C );
802
A rational vector space homomorphism with matrix: 
803
[ [ 1, 0, 0 ],
804
 [ 0, 1, 0 ] ]
805

806
gap> P := FiberProduct( AtoC, BtoC );
807
<A rational vector space of dimension 1>
808
gap> p1 := ProjectionInFactorOfFiberProduct( [ AtoC, BtoC ], 1 );
809
A rational vector space homomorphism with matrix: 
810
[ [ 1/2 ] ]
811

812
gap> p2 := ProjectionInFactorOfFiberProduct( [ AtoC, BtoC ], 2 );
813
A rational vector space homomorphism with matrix: 
814
[ [ 1/2, 1 ] ]
815

816

817
818
819