|
1 | | -LoadPackage( "ActionsForCAP" ); |
2 | | -LoadPackage( "LinearAlgebraForCAP" ); |
| 1 | +#! @Chapter Examples and tests |
| 2 | + |
| 3 | +#! @Section Tests |
| 4 | + |
| 5 | +#! @Example |
| 6 | + |
| 7 | +LoadPackage( "ActionsForCAP", false ); |
| 8 | +#! true |
| 9 | +LoadPackage( "LinearAlgebraForCAP", false ); |
| 10 | +#! true |
3 | 11 |
|
4 | 12 | ## Category and Type of Objects |
5 | 13 | ## |
6 | 14 | DeclareCategory( "IsObjectWithEndo", |
7 | | - IsCategoryWithAttributesObject ); |
| 15 | + IsCategoryWithAttributesObject );; |
8 | 16 |
|
9 | 17 | DeclareRepresentation( "IsObjectWithEndoRep", |
10 | 18 | IsObjectWithEndo and IsAttributeStoringRep, |
11 | | - [ ] ); |
| 19 | + [ ] );; |
12 | 20 |
|
13 | 21 | BindGlobal( "TheFamilyOfObjectsWithEndo", |
14 | | - NewFamily( "TheFamilyOfObjectsWithEndo" ) ); |
| 22 | + NewFamily( "TheFamilyOfObjectsWithEndo" ) );; |
15 | 23 |
|
16 | 24 | BindGlobal( "TheTypeOfObjectsWithEndo", |
17 | 25 | NewType( TheFamilyOfObjectsWithEndo, |
18 | | - IsObjectWithEndoRep ) ); |
| 26 | + IsObjectWithEndoRep ) );; |
19 | 27 |
|
20 | 28 | ## Category and Type of Morphisms |
21 | 29 | ## |
22 | 30 | DeclareCategory( "IsMorphismWithEndo", |
23 | | - IsCategoryWithAttributesMorphism ); |
| 31 | + IsCategoryWithAttributesMorphism );; |
24 | 32 |
|
25 | 33 | DeclareRepresentation( "IsMorphismWithEndoRep", |
26 | 34 | IsMorphismWithEndo and IsAttributeStoringRep, |
27 | | - [ ] ); |
| 35 | + [ ] );; |
28 | 36 |
|
29 | 37 | BindGlobal( "TheFamilyOfMorphismsWithEndo", |
30 | | - NewFamily( "TheFamilyOfMorphismsWithEndo" ) ); |
| 38 | + NewFamily( "TheFamilyOfMorphismsWithEndo" ) );; |
31 | 39 |
|
32 | 40 | BindGlobal( "TheTypeOfMorphismsWithEndo", |
33 | 41 | NewType( TheFamilyOfMorphismsWithEndo, |
34 | | - IsMorphismWithEndoRep ) ); |
| 42 | + IsMorphismWithEndoRep ) );; |
35 | 43 |
|
36 | 44 |
|
37 | 45 | ## |
38 | | -Q := HomalgFieldOfRationals(); |
39 | | -vec := MatrixCategory( Q ); |
40 | | - |
41 | | -category_with_endo_record := rec( |
42 | | - underlying_category := vec, |
43 | | - object_type := TheTypeOfObjectsWithEndo, |
44 | | - morphism_type := TheTypeOfMorphismsWithEndo, |
45 | | - |
46 | | - ZeroObject := |
| 46 | +Q := HomalgFieldOfRationals();; |
| 47 | +vec := MatrixCategory( Q );; |
| 48 | + |
| 49 | +category_with_endo_record := rec( );; |
| 50 | + |
| 51 | +category_with_endo_record.underlying_category := vec;; |
| 52 | +category_with_endo_record.object_type := TheTypeOfObjectsWithEndo;; |
| 53 | +category_with_endo_record.morphism_type := TheTypeOfMorphismsWithEndo;; |
| 54 | + |
| 55 | +category_with_endo_record.ZeroObject := |
47 | 56 | function( zero_object ) |
48 | 57 |
|
49 | | - return [ IdentityMorphism( zero_object ) ]; |
50 | | - |
51 | | - end, |
52 | | - |
53 | | - DirectSum := |
| 58 | + return [ IdentityMorphism( zero_object ) ]; end;; |
| 59 | + |
| 60 | +category_with_endo_record.DirectSum := |
54 | 61 | function( obj_list, underlying_direct_sum ) |
55 | | - local attr_list; |
56 | | - |
57 | | - attr_list := List( obj_list, obj -> ObjectAttributesAsList( obj )[1] ); |
58 | 62 |
|
59 | | - return [ DirectSumFunctorial( attr_list ) ]; |
60 | | - end, |
61 | | - |
62 | | - Lift := |
| 63 | + return [ DirectSumFunctorial( List( obj_list, obj -> ObjectAttributesAsList( obj )[1] ) ) ]; end;; |
| 64 | + |
| 65 | +category_with_endo_record.Lift := |
63 | 66 | function( mono, range ) |
64 | | - local range_endo, composition; |
65 | | - |
66 | | - range_endo := ObjectAttributesAsList( range )[1]; |
67 | | - |
68 | | - composition := PreCompose( mono, range_endo ); |
69 | 67 |
|
70 | | - return [ LiftAlongMonomorphism( mono, composition ) ]; |
71 | | - |
72 | | - end, |
73 | | - |
74 | | - Colift := |
| 68 | + return [ LiftAlongMonomorphism( mono, PreCompose( mono, ObjectAttributesAsList( range )[1] ) ) ]; end;; |
| 69 | + |
| 70 | +category_with_endo_record.Colift := |
75 | 71 | function( epi, source ) |
76 | | - local source_endo, composition; |
77 | | - |
78 | | - source_endo := ObjectAttributesAsList( source )[1]; |
79 | 72 |
|
80 | | - composition := PreCompose( source_endo, epi ); |
81 | | - |
82 | | - return [ ColiftAlongEpimorphism( epi, composition ) ]; |
83 | | - end, |
84 | | - |
85 | | - TensorProductOnObjects := |
| 73 | + return [ ColiftAlongEpimorphism( epi, PreCompose( ObjectAttributesAsList( source )[1], epi ) ) ]; end;; |
| 74 | + |
| 75 | +category_with_endo_record.TensorProductOnObjects := |
86 | 76 | function( obj1, obj2, underlying_tensor_product ) |
87 | | - local endo1, endo2; |
88 | | - |
89 | | - endo1 := ObjectAttributesAsList( obj1 )[1]; |
90 | 77 |
|
91 | | - endo2 := ObjectAttributesAsList( obj2 )[1]; |
92 | | - |
93 | | - return [ TensorProductOnMorphisms( endo1, endo2 ) ]; |
94 | | - |
95 | | - end, |
96 | | - |
97 | | - TensorUnit := |
| 78 | + return [ TensorProductOnMorphisms( ObjectAttributesAsList( obj1 )[1], ObjectAttributesAsList( obj2 )[1] ) ]; end;; |
| 79 | + |
| 80 | +category_with_endo_record.TensorUnit := |
98 | 81 | function( unit ) |
99 | | - |
100 | | - return [ IdentityMorphism( unit ) ]; |
101 | | - |
102 | | - end |
103 | | -); |
| 82 | + |
| 83 | + return [ IdentityMorphism( unit ) ]; end;; |
104 | 84 |
|
105 | | -triple := EnhancementWithAttributes( category_with_endo_record ); |
| 85 | +triple := EnhancementWithAttributes( category_with_endo_record );; |
106 | 86 | endo_cat := triple[1]; |
| 87 | +#! Category with attributes of Category of matrices over Q |
107 | 88 | ## not finalized yet |
108 | 89 | ObjConstr := triple[2]; |
| 90 | +#! function( object, attributes ) ... end |
109 | 91 |
|
110 | 92 | V := VectorSpaceObject( 3, Q ); |
| 93 | +#! <A vector space object over Q of dimension 3> |
111 | 94 | endV := IdentityMorphism( V ); |
| 95 | +#! <An identity morphism in Category of matrices over Q> |
112 | 96 | VwithEndo := ObjConstr( V, [ endV ] ); |
| 97 | +#! <An object in Category with attributes of Category of matrices over Q> |
113 | 98 |
|
114 | 99 | MorConstr := triple[3]; |
| 100 | +#! function( source, morphism, range ) ... end |
115 | 101 |
|
116 | 102 | alpha := MorConstr( VwithEndo, VectorSpaceMorphism( V, HomalgMatrix( [ [ 1, -1, 1 ], [ 1, 1, 1 ], [ 0, 0 , 0 ] ], 3, 3, Q ), V ), VwithEndo ); |
| 103 | +#! <A morphism in Category with attributes of Category of matrices over Q> |
| 104 | + |
| 105 | +#! @EndExample |
0 commit comments