CAP_project icon indicating copy to clipboard operation
CAP_project copied to clipboard

Extending the range of a homomorphism structure of a category instance multiple times signals an error

Open mohamed-barakat opened this issue 2 years ago • 3 comments

gap> LoadPackage("FunctorCategories");
true
gap> FiniteStrictCoproductCocompletion( FinBouquets );
FiniteStrictCoproductCocompletion( FinBouquets )
gap> FiniteStrictCoproductCocompletion( ModelingCategory( FinBouquets ) );
Error, there is already a method known for DistinguishedObjectOfHomomorphismStructureExtendedByFullEmbedding with a category filter which implies the current category filter or is implied by it at /Users/mo/.gap/pkg/CAP_project/CAP//gap/ToolsForCategories.gi:941 called from
CapJitAddKnownMethod( operation, filters, method ); at /Users/mo/.gap/pkg/CAP_project/CAP//gap/ToolsForCategories.gi:844 called from
InstallMethodForCompilerForCAP( DistinguishedObjectOfHomomorphismStructureExtendedByFullEmbedding,
 [ IsCapCategory and CategoryFilter( C ), IsCapCategory and CategoryFilter( E ) ], function ( C, E )
      return object_function( C, E, DistinguishedObjectOfHomomorphismStructure( C ) );
  end ); at /Users/mo/.gap/pkg/CAP_project/CAP//gap/CategoryMorphisms.gi:666 called from
ExtendRangeOfHomomorphismStructureByFullEmbedding( C, RangeCategoryOfHomomorphismStructure( C ), object_function, morphism_function, object_function_inverse,
 morphism_function_inverse ); at /Users/mo/.gap/pkg/CAP_project/CAP//gap/CategoryMorphisms.gi:764 called from
ExtendRangeOfHomomorphismStructureByIdentityAsFullEmbedding( C
 ); at /Users/mo/.gap/pkg/CategoricalTowers/FiniteCocompletion//gap/FiniteStrictCoproductCocompletion.gi:765 called from
<function "FiniteStrictCoproductCocompletion for a CAP category">( <arguments> )
 called from read-eval loop at *stdin*:2
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk>

mohamed-barakat avatar Feb 28 '23 19:02 mohamed-barakat

You are extending the hom structure of the same category instance twice. You can trigger the same error as follows:

gap> LoadPackage( "FinSetsForCAP" );
gap> WrapperCategory( FinSets, rec( ) );
gap> WrapperCategory( FinSets, rec( ) );

When designing the interface of ExtendRangeOfHomomorphismStructureByFullEmbedding, I thought about this, as can be seen in the documentation:

Note: To distinguish embeddings in different categories, in addition to $C$ also $E$ is passed to the operations. When using this with different embeddings with the range category $E$, only the last embedding will be used.

However, I did not recognize that this would not be compatible with CompilerForCAP's method selection which only uses the first argument for method selection.

No easy fix comes to my mind right now, so for now the question is: Do you actually have a setting where the range of the hom structure of the same instance of a category has to be extended twice?

zickgraf avatar Mar 01 '23 08:03 zickgraf

I ran into this error when using CategoryOfQuivers applied to FinBouquets but then I wanted for debugging purposes to apply it to ModelingCategory( FinBouquets ) and ModelingCategory( ModelingCategory( FinBouquets ) ) and both failed. So these constructions are not my final goal, but I needed them for experiments.

mohamed-barakat avatar Mar 01 '23 09:03 mohamed-barakat

I see. For debugging/experiments you can replace all occurrences of InstallMethodForCompilerForCAP by InstallMethod in the installation of ExtendRangeOfHomomorphismStructureByFullEmbedding in CAP/gap/CategoryMorphisms.gi and everything should be fine (as long as you do not extend to the same range with different embeddings). I could also turn the error into a warning if you like.

In any case, this should be fixed in a general way -> I will transfer this issue to CAP_project.

zickgraf avatar Mar 01 '23 10:03 zickgraf