Skip to content

Commit 079eb91

Browse files
authored
Merge pull request #225 from mohamed-barakat/CoimageProjection
AddAstrictionToCoimage
2 parents 478e58a + 240dcdf commit 079eb91

File tree

7 files changed

+104
-57
lines changed

7 files changed

+104
-57
lines changed

PackageInfo.g

Lines changed: 2 additions & 2 deletions
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 := "2023.10-02",
13+
Version := "2023.10-03",
1414

1515
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
1616
License := "GPL-2.0-or-later",
@@ -100,7 +100,7 @@ Dependencies := rec(
100100
NeededOtherPackages := [
101101
[ "CAP", ">= 2023.09-11" ],
102102
[ "CartesianCategories", ">= 2023.08-13" ],
103-
[ "Toposes", ">= 2023.10-01" ],
103+
[ "Toposes", ">= 2023.10-13" ],
104104
],
105105
SuggestedOtherPackages := [ ],
106106
ExternalConditions := [ ],

doc/Doc.autodoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@
106106
@InsertChunk SkeletalImageEmbedding
107107
@InsertChunk SkeletalCoastrictionToImage
108108

109+
@Subsection Skeletal Coimage
110+
@InsertChunk SkeletalCoimageObject
111+
109112
@Subsection Skeletal Preimage
110113
@InsertChunk SkeletalPreimage
111114

examples/CoimageObject.g

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ IsEpimorphism( phi );
2222
#! false
2323
IsSplitEpimorphism( phi );
2424
#! false
25-
iota := AstrictionToCoimage( phi );
26-
#! <A morphism in FinSets>
2725
pi := CoimageProjection( phi );
2826
#! <An epimorphism in FinSets>
27+
iota := AstrictionToCoimage( phi );
28+
#! <A morphism in FinSets>
2929
PreCompose( pi, iota ) = phi;
3030
#! true
31+
3132
#! @EndExample

examples/PrecompileCategoryOfSkeletalFinSetsWithMorphismsGivenByLists.g

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
LoadPackage( "FinSetsForCAP", false );
1010
#! true
11-
LoadPackage( "CompilerForCAP", false );
11+
LoadPackage( "CompilerForCAP", ">= 2023.10-03", false );
1212
#! true
1313

1414
ReadPackage( "FinSetsForCAP", "gap/CompilerLogic.gi" );
@@ -24,6 +24,8 @@ primitive_operations :=
2424
category_constructor( : no_precompiled_code := true ) );;
2525
list_of_operations :=
2626
SortedList( Concatenation( primitive_operations, [
27+
"CoastrictionToImage",
28+
"CoimageProjection",
2729
"IsHomSetInhabited",
2830
"TruthMorphismOfImplies",
2931
#"HasPushoutComplement",

examples/SkeletalCoimageObject.g

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#! @Chunk SkeletalCoimageObject
2+
3+
#! @Example
4+
LoadPackage( "FinSetsForCAP", false );
5+
#! true
6+
m := FinSet( 3 );
7+
#! |3|
8+
n := FinSet( 3 );
9+
#! |3|
10+
phi := MapOfFinSets( m, [ 1, 0, 1 ], n );
11+
#! |3| → |3|
12+
I := CoimageObject( phi );
13+
#! |2|
14+
IsMonomorphism( phi );
15+
#! false
16+
IsSplitMonomorphism( phi );
17+
#! false
18+
IsEpimorphism( phi );
19+
#! false
20+
IsSplitEpimorphism( phi );
21+
#! false
22+
pi := CoimageProjection( phi );
23+
#! |3| → |2|
24+
iota := AstrictionToCoimage( phi );
25+
#! |2| → |3|
26+
PreCompose( pi, iota ) = phi;
27+
#! true
28+
Display( iota );
29+
#! { 0, 1 } ⱶ[ 1, 0 ]→ { 0, 1, 2 }
30+
Display( ImageEmbedding( phi ) );
31+
#! { 0, 1 } ⱶ[ 0, 1 ]→ { 0, 1, 2 }
32+
#! @EndExample

gap/SkeletalFinSets.gi

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,6 @@ AddPreCompose( SkeletalFinSets,
356356

357357
end );
358358

359-
##
360-
AddImageObject( SkeletalFinSets,
361-
function ( cat, phi )
362-
363-
return ObjectConstructor( cat, BigInt( Length( Set( AsList( phi ) ) ) ) );
364-
365-
end );
366-
367359
## the function SKELETAL_FIN_SETS_IsEpimorphism
368360
## has linear runtime complexity
369361
AddIsEpimorphism( SkeletalFinSets,
@@ -484,36 +476,32 @@ AddColift( SkeletalFinSets,
484476
end );
485477

486478
##
487-
AddImageEmbeddingWithGivenImageObject( SkeletalFinSets,
488-
function ( cat, phi, image )
479+
AddImageEmbedding( SkeletalFinSets,
480+
function ( cat, phi )
481+
local map;
482+
483+
map := Set( AsList( phi ) );
484+
485+
return MorphismConstructor( cat, ObjectConstructor( cat, BigInt( Length( map ) ) ), map, Range( phi ) );
489486

490-
return MorphismConstructor( cat, image, Set( AsList( phi ) ), Range( phi ) );
491-
492487
end );
493488

494489
##
495-
AddCoastrictionToImageWithGivenImageObject( SkeletalFinSets,
496-
function ( cat, phi, image_object )
497-
local G, images, s, L, l, pi;
498-
499-
G := AsList( phi );
500-
501-
images := Set( G );
502-
503-
s := Source( phi );
504-
505-
L := List( s, i -> -1 + BigInt( SafePosition( images, G[1 + i] ) ) );
490+
AddAstrictionToCoimage( SkeletalFinSets,
491+
function ( cat, phi )
492+
local L, map;
506493

507-
pi := MorphismConstructor( cat, s, L, image_object );
494+
L := AsList( phi );
508495

509-
#% CAP_JIT_DROP_NEXT_STATEMENT
510-
Assert( 3, IsEpimorphism( cat, pi ) );
496+
## unlike ImageObject which is a subobject of the range,
497+
## the CoimageObject is a factor object of the source,
498+
## and we want to retain the sorting of the source:
499+
map := DuplicateFreeList( L );
511500

512-
return pi;
501+
return MorphismConstructor( cat, ObjectConstructor( cat, BigInt( Length( map ) ) ), map, Range( phi ) );
513502

514503
end );
515504

516-
517505
## Limits
518506

519507
##

gap/precompiled_categories/SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled.gi

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@
55
#
66
BindGlobal( "ADD_FUNCTIONS_FOR_SkeletalCategoryOfFiniteSetsWithMorphismsGivenByListsPrecompiled", function ( cat )
77

8+
##
9+
AddAstrictionToCoimage( cat,
10+
11+
########
12+
function ( cat_1, alpha_1 )
13+
local deduped_1_1;
14+
deduped_1_1 := DuplicateFreeList( AsList( alpha_1 ) );
15+
return CreateCapCategoryMorphismWithAttributes( cat_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( Length( deduped_1_1 ) ) ), Range( alpha_1 ), AsList, deduped_1_1 );
16+
end
17+
########
18+
19+
, 100 );
20+
821
##
922
AddCartesianBraidingInverseWithGivenDirectProducts( cat,
1023

@@ -157,21 +170,21 @@ end
157170
, 100 );
158171

159172
##
160-
AddCoastrictionToImageWithGivenImageObject( cat,
173+
AddCoastrictionToImage( cat,
161174

162175
########
163-
function ( cat_1, alpha_1, I_1 )
164-
local hoisted_2_1, deduped_3_1, deduped_4_1;
165-
deduped_4_1 := AsList( alpha_1 );
166-
deduped_3_1 := Source( alpha_1 );
167-
hoisted_2_1 := SSortedList( deduped_4_1 );
168-
return CreateCapCategoryMorphismWithAttributes( cat_1, deduped_3_1, I_1, AsList, List( [ 0 .. Length( deduped_3_1 ) - 1 ], function ( i_2 )
169-
return -1 + BigInt( SafePosition( hoisted_2_1, deduped_4_1[(1 + i_2)] ) );
176+
function ( cat_1, alpha_1 )
177+
local deduped_3_1, deduped_4_1, deduped_5_1;
178+
deduped_5_1 := AsList( alpha_1 );
179+
deduped_4_1 := Source( alpha_1 );
180+
deduped_3_1 := SSortedList( deduped_5_1 );
181+
return CreateCapCategoryMorphismWithAttributes( cat_1, deduped_4_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( Length( deduped_3_1 ) ) ), AsList, List( [ 0 .. Length( deduped_4_1 ) - 1 ], function ( x_2 )
182+
return -1 + BigInt( SafePosition( deduped_3_1, deduped_5_1[(1 + x_2)] ) );
170183
end ) );
171184
end
172185
########
173186

174-
, 100 );
187+
, 202 : IsPrecompiledDerivation := true );
175188

176189
##
177190
AddCoequalizer( cat,
@@ -184,6 +197,23 @@ end
184197

185198
, 100 );
186199

200+
##
201+
AddCoimageProjection( cat,
202+
203+
########
204+
function ( cat_1, alpha_1 )
205+
local deduped_3_1, deduped_4_1, deduped_5_1;
206+
deduped_5_1 := AsList( alpha_1 );
207+
deduped_4_1 := Source( alpha_1 );
208+
deduped_3_1 := DuplicateFreeList( deduped_5_1 );
209+
return CreateCapCategoryMorphismWithAttributes( cat_1, deduped_4_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( Length( deduped_3_1 ) ) ), AsList, List( [ 0 .. Length( deduped_4_1 ) - 1 ], function ( x_2 )
210+
return -1 + BigInt( SafePosition( deduped_3_1, deduped_5_1[(1 + x_2)] ) );
211+
end ) );
212+
end
213+
########
214+
215+
, 202 : IsPrecompiledDerivation := true );
216+
187217
##
188218
AddColift( cat,
189219

@@ -345,22 +375,13 @@ end
345375
, 100 );
346376

347377
##
348-
AddImageEmbeddingWithGivenImageObject( cat,
378+
AddImageEmbedding( cat,
349379

350380
########
351-
function ( cat_1, alpha_1, I_1 )
352-
return CreateCapCategoryMorphismWithAttributes( cat_1, I_1, Range( alpha_1 ), AsList, SSortedList( AsList( alpha_1 ) ) );
353-
end
354-
########
355-
356-
, 100 );
357-
358-
##
359-
AddImageObject( cat,
360-
361-
########
362-
function ( cat_1, arg2_1 )
363-
return CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( Length( SSortedList( AsList( arg2_1 ) ) ) ) );
381+
function ( cat_1, alpha_1 )
382+
local deduped_1_1;
383+
deduped_1_1 := SSortedList( AsList( alpha_1 ) );
384+
return CreateCapCategoryMorphismWithAttributes( cat_1, CreateCapCategoryObjectWithAttributes( cat_1, Length, BigInt( Length( deduped_1_1 ) ) ), Range( alpha_1 ), AsList, deduped_1_1 );
364385
end
365386
########
366387

@@ -816,7 +837,7 @@ function ( cat_1, l_1, m_1 )
816837
end
817838
########
818839

819-
, 19767 : IsPrecompiledDerivation := true );
840+
, 19464 : IsPrecompiledDerivation := true );
820841

821842
##
822843
AddSomeInjectiveObject( cat,

0 commit comments

Comments
 (0)