Skip to content

Commit 274ba63

Browse files
authored
Merge pull request #1167 from zickgraf/master
Clean up terminal category and avoid constructing CAP_INTERNAL_TERMINAL_CATEGORY
2 parents d7a381a + eb5f7e9 commit 274ba63

File tree

7 files changed

+64
-135
lines changed

7 files changed

+64
-135
lines changed

CAP/PackageInfo.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SetPackageInfo( rec(
1010

1111
PackageName := "CAP",
1212
Subtitle := "Categories, Algorithms, Programming",
13-
Version := "2022.11-20",
13+
Version := "2022.11-21",
1414
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
1515
License := "GPL-2.0-or-later",
1616

CAP/gap/CategoriesCategory.gi

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -560,45 +560,25 @@ AddTerminalObject( cat,
560560

561561
function( )
562562

563-
return CAP_INTERNAL_TERMINAL_CATEGORY_AS_CAT_OBJECT;
564-
565-
end );
566-
567-
##
568-
AddUniversalMorphismIntoTerminalObject( cat,
569-
570-
function( category )
571-
local new_functor;
572-
573-
new_functor := CapFunctor( Concatenation( "The terminal of ", Name( AsCapCategory( category ) ) ), category, CAP_INTERNAL_TERMINAL_CATEGORY_AS_CAT_OBJECT );
574-
575-
AddObjectFunction( new_functor,
576-
577-
function( arg ) return UniqueObject( CAP_INTERNAL_TERMINAL_CATEGORY ); end );
578-
579-
AddMorphismFunction( new_functor,
580-
581-
function( arg ) return UniqueMorphism( CAP_INTERNAL_TERMINAL_CATEGORY ); end );
582-
583-
return new_functor;
563+
return AsCatObject( TerminalCategoryWithSingleObject( ) );
584564

585565
end );
586566

587567
##
588568
AddUniversalMorphismIntoTerminalObjectWithGivenTerminalObject( cat,
589569

590-
function( category, cat_obj )
570+
function( category, terminal_cat )
591571
local new_functor;
592572

593-
new_functor := CapFunctor( Concatenation( "The terminal of ", Name( AsCapCategory( category ) ) ), category, CAP_INTERNAL_TERMINAL_CATEGORY_AS_CAT_OBJECT );
573+
new_functor := CapFunctor( Concatenation( "The terminal of ", Name( AsCapCategory( category ) ) ), category, terminal_cat );
594574

595575
AddObjectFunction( new_functor,
596576

597-
function( arg ) return UniqueObject( CAP_INTERNAL_TERMINAL_CATEGORY ); end );
577+
function( arg ) return UniqueObject( AsCapCategory( terminal_cat ) ); end );
598578

599579
AddMorphismFunction( new_functor,
600580

601-
function( arg ) return UniqueMorphism( CAP_INTERNAL_TERMINAL_CATEGORY ); end );
581+
function( arg ) return UniqueMorphism( AsCapCategory( terminal_cat ) ); end );
602582

603583
return new_functor;
604584

CAP/gap/DerivedMethods.gi

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3726,17 +3726,18 @@ AddFinalDerivationBundle( # IsomorphismFromCoproductToDirectSum,
37263726
AddFinalDerivationBundle( # RandomObjectByList,
37273727
[ [ RandomObjectByInteger, 1 ],
37283728
[ RandomMorphismWithFixedSourceAndRangeByInteger, 1 ],
3729-
[ RandomMorphismWithFixedRangeByInteger, 1 ],
37303729
[ RandomMorphismWithFixedSourceByInteger, 1 ],
3730+
[ RandomMorphismWithFixedRangeByInteger, 1 ],
37313731
[ RandomMorphismByInteger, 1 ],
37323732
],
37333733
[ RandomObjectByList,
37343734
RandomMorphismWithFixedSourceAndRangeByList,
3735-
RandomMorphismWithFixedRangeByList,
37363735
RandomMorphismWithFixedSourceByList,
3736+
RandomMorphismWithFixedRangeByList,
37373737
RandomMorphismByList ],
37383738
[
37393739
RandomObjectByList,
3740+
[ [ RandomObjectByInteger, 1 ] ],
37403741
function( cat, L )
37413742

37423743
if Length( L ) <> 1 or not IsInt( L[1] ) then
@@ -3749,6 +3750,7 @@ AddFinalDerivationBundle( # RandomObjectByList,
37493750
],
37503751
[
37513752
RandomMorphismWithFixedSourceAndRangeByList,
3753+
[ [ RandomMorphismWithFixedSourceAndRangeByInteger, 1 ] ],
37523754
function( cat, S, R, L )
37533755

37543756
if Length( L ) <> 1 or not IsInt( L[1] ) then
@@ -3760,31 +3762,34 @@ AddFinalDerivationBundle( # RandomObjectByList,
37603762
end
37613763
],
37623764
[
3763-
RandomMorphismWithFixedRangeByList,
3764-
function( cat, R, L )
3765+
RandomMorphismWithFixedSourceByList,
3766+
[ [ RandomMorphismWithFixedSourceByInteger, 1 ] ],
3767+
function( cat, S, L )
37653768

37663769
if Length( L ) <> 1 or not IsInt( L[1] ) then
3767-
Error( "the list passed to 'RandomMorphismWithFixedRangeByList' in ", Name( cat ), " must consist of only one integer!\n" );
3770+
Error( "the list passed to 'RandomMorphismWithFixedSourceByList' in ", Name( cat ), " must consist of only one integer!\n" );
37683771
fi;
37693772

3770-
return RandomMorphismWithFixedRangeByInteger( cat, R, L[1] );
3773+
return RandomMorphismWithFixedSourceByInteger( cat, S, L[1] );
37713774

37723775
end
37733776
],
37743777
[
3775-
RandomMorphismWithFixedSourceByList,
3776-
function( cat, S, L )
3778+
RandomMorphismWithFixedRangeByList,
3779+
[ [ RandomMorphismWithFixedRangeByInteger, 1 ] ],
3780+
function( cat, R, L )
37773781

37783782
if Length( L ) <> 1 or not IsInt( L[1] ) then
3779-
Error( "the list passed to 'RandomMorphismWithFixedSourceByList' in ", Name( cat ), " must consist of only one integer!\n" );
3783+
Error( "the list passed to 'RandomMorphismWithFixedRangeByList' in ", Name( cat ), " must consist of only one integer!\n" );
37803784
fi;
37813785

3782-
return RandomMorphismWithFixedSourceByInteger( cat, S, L[1] );
3786+
return RandomMorphismWithFixedRangeByInteger( cat, R, L[1] );
37833787

37843788
end
37853789
],
37863790
[
37873791
RandomMorphismByList,
3792+
[ [ RandomMorphismByInteger, 1 ] ],
37883793
function( cat, L )
37893794

37903795
if Length( L ) <> 1 or not IsInt( L[1] ) then
@@ -3794,7 +3799,7 @@ AddFinalDerivationBundle( # RandomObjectByList,
37943799
return RandomMorphismByInteger( cat, L[1] );
37953800

37963801
end
3797-
]: Description := "Derive all <ByList> random methods from <ByInteger> random methods" );
3802+
] : Description := "Derive all <ByList> random methods from <ByInteger> random methods" );
37983803

37993804
## Final methods for homology object
38003805

CAP/gap/TerminalCategory.gd

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,21 @@
1212
########################################
1313

1414
#! @Description
15-
#! The &GAP; type of a terminal category.
15+
#! The &GAP; type of a terminal category with a single object.
1616
#! @Arguments T
1717
DeclareCategory( "IsCapTerminalCategoryWithSingleObject",
1818
IsCapCategory );
1919

2020
#! @Description
21-
#! The &GAP; type of a cell in a terminal category.
22-
#! @Arguments T
23-
DeclareCategory( "IsCellInCapTerminalCategoryWithSingleObject",
24-
IsCapCategoryCell );
25-
26-
#! @Description
27-
#! The &GAP; type of an object in a terminal category.
21+
#! The &GAP; type of an object in a terminal category with a single object.
2822
#! @Arguments T
2923
DeclareCategory( "IsObjectInCapTerminalCategoryWithSingleObject",
30-
IsCellInCapTerminalCategoryWithSingleObject and
3124
IsCapCategoryObject );
3225

3326
#! @Description
34-
#! The &GAP; type of a morphism in a terminal category.
27+
#! The &GAP; type of a morphism in a terminal category with a single object.
3528
#! @Arguments T
3629
DeclareCategory( "IsMorphismInCapTerminalCategoryWithSingleObject",
37-
IsCellInCapTerminalCategoryWithSingleObject and
3830
IsCapCategoryMorphism );
3931

4032
#! @Description
@@ -43,24 +35,16 @@ DeclareCategory( "IsMorphismInCapTerminalCategoryWithSingleObject",
4335
DeclareCategory( "IsCapTerminalCategoryWithMultipleObjects",
4436
IsCapCategory );
4537

46-
#! @Description
47-
#! The &GAP; type of a cell in a terminal category with multiple objects.
48-
#! @Arguments T
49-
DeclareCategory( "IsCellInCapTerminalCategoryWithMultipleObjects",
50-
IsCapCategoryCell );
51-
5238
#! @Description
5339
#! The &GAP; type of an object in a terminal category with multiple objects.
5440
#! @Arguments T
5541
DeclareCategory( "IsObjectInCapTerminalCategoryWithMultipleObjects",
56-
IsCellInCapTerminalCategoryWithMultipleObjects and
5742
IsCapCategoryObject );
5843

5944
#! @Description
6045
#! The &GAP; type of a morphism in a terminal category with multiple objects.
6146
#! @Arguments T
6247
DeclareCategory( "IsMorphismInCapTerminalCategoryWithMultipleObjects",
63-
IsCellInCapTerminalCategoryWithMultipleObjects and
6448
IsCapCategoryMorphism );
6549

6650
AddCategoricalProperty( [ "IsTerminalCategory", "IsTerminalCategory" ] );
@@ -71,21 +55,17 @@ AddCategoricalProperty( [ "IsTerminalCategory", "IsTerminalCategory" ] );
7155
#
7256
########################################
7357

74-
DeclareGlobalName( "CAP_INTERNAL_CREATE_TerminalCategory" );
75-
7658
#! @Description
77-
#! Construct a terminal category.
78-
DeclareGlobalFunction( "TerminalCategory" );
79-
#! @InsertChunk TerminalCategory
59+
#! Construct a terminal category with a single object.
60+
DeclareGlobalFunction( "TerminalCategoryWithSingleObject" );
8061

8162
#! @Description
8263
#! Construct a terminal category with multiple objects.
8364
DeclareGlobalFunction( "TerminalCategoryWithMultipleObjects" );
84-
#! @InsertChunk TerminalCategoryWithMultipleObjects
8565

8666
#! @Description
8767
#! This function takes a record of options suited for CategoryConstructor.
88-
#! It makes common adjustments from TerminalCategory and TerminalCategoryWithMultipleObjects
68+
#! It makes common adjustments for TerminalCategoryWithSingleObject and TerminalCategoryWithMultipleObjects
8969
#! to the list of operations to install and the categorical properties of the given record,
9070
#! before passing it on to CategoryConstructor.
9171
#! @Arguments options
@@ -99,13 +79,13 @@ DeclareGlobalFunction( "CAP_INTERNAL_CONSTRUCTOR_FOR_TERMINAL_CATEGORY" );
9979
#########################################
10080

10181
#! @Description
102-
#! The unique object in a terminal category.
82+
#! The unique object in a terminal category with a single object.
10383
#! @Returns a &CAP; object
10484
DeclareAttribute( "UniqueObject",
10585
IsCapTerminalCategoryWithSingleObject );
10686

10787
#! @Description
108-
#! The unique morphism in a terminal category.
88+
#! The unique morphism in a terminal category with a single object.
10989
#! @Returns a &CAP; morphism
11090
DeclareAttribute( "UniqueMorphism",
11191
IsCapTerminalCategoryWithSingleObject );
@@ -117,22 +97,8 @@ DeclareAttribute( "UniqueMorphism",
11797
#########################################
11898

11999
#! @Description
120-
#! A functor from a terminal category to another category with a given cell **cell**.
121-
#! @Arguments cell
122-
#! @Returns a &CAP; morphism
100+
#! A functor from `AsCapCategory( TerminalObject( CapCat ) )` mapping the unique object to <A>object</A>.
101+
#! @Arguments object
102+
#! @Returns a &CAP; functor
123103
DeclareAttribute( "FunctorFromTerminalCategory",
124-
IsCapCategoryCell );
125-
126-
#########################################
127-
#
128-
#! @Section Variables
129-
#
130-
#########################################
131-
132-
#! @Description
133-
#! A terminal category.
134-
DeclareGlobalName( "CAP_INTERNAL_TERMINAL_CATEGORY" );
135-
136-
#! @Description
137-
#! A terminal category as an object in CAT.
138-
DeclareGlobalName( "CAP_INTERNAL_TERMINAL_CATEGORY_AS_CAT_OBJECT" );
104+
IsCapCategoryObject );

0 commit comments

Comments
 (0)