Skip to content

Commit c9af9e5

Browse files
authored
Merge pull request #61 from mohamed-barakat/category_as_first_argument
FinSets!.category_as_first_argument := true
2 parents 6df2fac + 06898ee commit c9af9e5

File tree

4 files changed

+284
-200
lines changed

4 files changed

+284
-200
lines changed

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 := "FinSetsForCAP",
1212
Subtitle := "The elementary topos of (skeletal) finite sets",
13-
Version := "2020.09-01",
13+
Version := "2020.11-01",
1414

1515
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
1616
License := "GPL-2.0-or-later",

examples/Pushout.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ U := ImageObject( iota );
3333
#! <An object in FinSets>
3434
Display( U );
3535
#! [ 1, 2, 4, 3 ]
36-
UnionOfFinSets( [ N1, N2 ] ) = U;
36+
UnionOfFinSets( FinSets, [ N1, N2 ] ) = U;
3737
#! true
3838
#! @EndExample

gap/FinSetsForCAP.gd

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@
44
# Declarations
55
#
66

7+
# Technical functions
8+
DeclareGlobalFunction( "INSTALL_FUNCTIONS_FOR_FIN_SETS" );
9+
710
#! @Chapter The category of finite sets
811

912
#! @Section GAP Categories
1013

14+
#! @Description
15+
#! The GAP category of categories
16+
#! of finite sets.
17+
#! @Arguments object
18+
DeclareCategory( "IsCategoryOfFinSets",
19+
IsCapCategory );
20+
1121
#! @Description
1222
#! The GAP category of objects in the category
1323
#! of finite sets.
@@ -50,16 +60,30 @@ DeclareAttribute( "AsList",
5060

5161
#! @Section Constructors
5262

63+
#! @Description
64+
#! Construct a category of finite sets.
65+
#! Accepts the options <C>overhead</C> (default: <C>true</C>) and
66+
#! <C>FinalizeCategory</C> (default: <C>true</C>).
67+
#! @Returns a &CAP; category
68+
DeclareOperation( "CategoryOfFinSets", [ ] );
69+
5370
#! @Description
5471
#! Construct a finite set out of the list <A>L</A>, i.e.,
55-
#! an object in the &CAP; category <C>FinSets</C>.
72+
#! an object in the &CAP; category <C>cat_of_fin_sets</C>.
5673
#! The &GAP; operation <C>Set</C> must be applicable to <A>L</A> without throwing an error.
5774
#! Equality is determined as follows: <C>FinSet( L1 ) = FinSet( L2 )</C> iff <C>IsEqualForElementsOfFinSets( Immutable( Set( L1 ) ), Immutable( Set( L2 ) ) )</C>.
5875
#! Warning: all internal operations use <C>FinSetNC</C> (see below) instead of <C>FinSet</C>.
5976
#! Thus, this notion of equality is only valid for objects created by calling <C>FinSet</C> explicitly.
60-
#! Internally, <C>FinSet( L )</C> is an alias for <C>FinSetNC( Set( L ) )</C> and equality is determined as for <C>FinSetNC</C>.
61-
#! Thus, <C>FinSet( L1 ) = FinSetNC( L2 )</C> iff <C>IsEqualForElementsOfFinSets( Immutable( Set( L1 ) ), Immutable( L2 ) )</C> and
62-
#! <C>FinSetNC( L1 ) = FinSet( L2 )</C> iff <C>IsEqualForElementsOfFinSets( Immutable( L1 ), Immutable( Set( L2 ) ) )</C>.
77+
#! Internally, <C>FinSet( cat_of_fin_sets, L )</C> is an alias for <C>FinSetNC( cat_of_fin_sets, Set( L ) )</C> and equality is determined as for <C>FinSetNC</C>.
78+
#! Thus, <C>FinSet( cat_of_fin_sets, L1 ) = FinSetNC( cat_of_fin_sets, L2 )</C> iff <C>IsEqualForElementsOfFinSets( Immutable( Set( L1 ) ), Immutable( L2 ) )</C> and
79+
#! <C>FinSetNC( cat_of_fin_sets, L1 ) = FinSet( cat_of_fin_sets, L2 )</C> iff <C>IsEqualForElementsOfFinSets( Immutable( L1 ), Immutable( Set( L2 ) ) )</C>.
80+
#! @Arguments cat_of_fin_sets, L
81+
#! @Returns a &CAP; object
82+
DeclareOperation( "FinSet",
83+
[ IsCategoryOfFinSets, IsList ] );
84+
85+
#! @Description
86+
#! Return <C>FinSet</C>( <C>FinSets</C>, <A>L</A> ).
6387
#! @Arguments L
6488
#! @Returns a &CAP; object
6589
DeclareOperation( "FinSet",
@@ -68,8 +92,16 @@ DeclareOperation( "FinSet",
6892

6993
#! @Description
7094
#! Construct a finite set out of the duplicate-free (w.r.t. <C>IsEqualForElementsOfFinSets</C>) and dense list <A>L</A>, i.e.,
71-
#! an object in the &CAP; category <C>FinSets</C>.
72-
#! Equality is determined as follows: <C>FinSetNC( L1 ) = FinSetNC( L2 )</C> iff <C>IsEqualForElementsOfFinSets( Immutable( L1 ), Immutable( L2 ) )</C>.
95+
#! an object in the &CAP; category <C>cat_of_fin_sets,</C>.
96+
#! Equality is determined as follows: <C>FinSetNC( cat_of_fin_sets, L1 ) = FinSetNC( cat_of_fin_sets, L2 )</C>
97+
#! iff <C>IsEqualForElementsOfFinSets( Immutable( L1 ), Immutable( L2 ) )</C>.
98+
#! @Arguments cat_of_fin_sets, L
99+
#! @Returns a &CAP; object
100+
DeclareOperation( "FinSetNC",
101+
[ IsCategoryOfFinSets, IsList ] );
102+
103+
#! @Description
104+
#! Return <C>FinSetNC</C>( <C>FinSets</C>, <A>L</A> ).
73105
#! @Arguments L
74106
#! @Returns a &CAP; object
75107
DeclareOperation( "FinSetNC",
@@ -137,11 +169,11 @@ DeclareOperation( "Iterator",
137169
[ IsFiniteSet ] );
138170

139171
#! @Description
140-
#! Compute the set-theoretic union of the elements of <A>L</A>, where <A>L</A> is a list of finite sets.
141-
#! @Arguments L
172+
#! Compute the set-theoretic union of the elements of <A>L</A>, where <A>L</A> is a list of finite sets in the category <A>cat_of_fin_sets</A>.
173+
#! @Arguments cat_of_fin_sets, L
142174
#! @Returns a &CAP; object
143175
DeclareOperation( "UnionOfFinSets",
144-
[ IsList ] );
176+
[ IsCategoryOfFinSets, IsList ] );
145177

146178
#! @Description
147179
#! Returns <C>List( AsList( <A>M</A> ), <A>f</A> )</C>.

0 commit comments

Comments
 (0)