Closed zickgraf closed 6 years ago
From a categorical point of view, solution 2 sounds perfect to me. You are actually still modeling the category of finite sets, since you just add more unequal but still isomorphic copies of your objects to the category.
I agree with Sebastian, that the resulting category is still equivalent to the category of finite sets and would go for 2. The behaviour FinSetNC( [ 1, 2 ] ) <> FinSetNC( [ 2, 1 ] )
should be added to the documentation of FinSetNC
.
I have just created pull request #21 which implements solution 2. @mohamed-barakat, please approve and/or merge it if you approve of the changes.
Using our current notion of equality of FinSets, we have
FinSetNC( [ 1, 2 ] ) = FinSetNC( [ 2, 1 ] )
butAsList( FinSetNC( [ 1, 2 ] ) ) <> AsList( FinSetNC( [ 2, 1 ] ) )
. In the algorithm for the coequalizer we build lists by iterating overAsList
-attributes. Thus, these lists might be different although the FinSets in the input are equal.For a concrete example, consider the following piece of code:
I can think of three solutions to the problem:
My opinion: In my master thesis I have explicitly disabled the caching of FinSets, so 1. is not a solution for me. I think we should definitely do 3., since this is closer to our mathematical intuition than the current implementation. However, currently I have no idea how to check if this issue really only applies to the coequalizer and not to other constructions, too. Thus, we might want to think about 2. since this would solve the problem everywhere. Note that for users of
FinSet
(and notFinsSetNC
) 2. would not change anything and the performance ofIsEqualForObjects
would be much better. However, we would then model the category of "tuples with pairwise different entries" instead of the category of finite sets.