An issue with the existing code is that through a sequence of declare_union
calls, it is possible to obtain a situation in which two subsets must be the same, although declare_union
makes a (not very effective) attempt to stop the user from doing so (by checking whether the two arguments are the same).
In terms of the poset of subsets that is defined by the _subsets
(and _supersets
) attributes (which is visualized by the code from #31680), this is quite problematic.
This could be solved by introducing equivalence classes of subsets - for example by keeping the _subsets
relation acyclic and introducing an _equal_sets
attribute; loops that update subsets will have to be modified.
The elements of the poset introduced in #31680 then would be equivalence classes of subsets rather than subsets.