Suppose that I have two sets of items, and a function to check the equivalence of two items (not strict equality so that one item may be equivalent to multiple items in the other set), I want to determine whether there is a one-to-one correspondence such that the equivalence holds for each of the pairs.
Is there any established/optimal solution for this problem?
This problem comes originally from determining whether two C union types are compatible, for which the standard requires such correspondence, however things get tricky as union members can be anonymous so the equivalent item for an item can have multiple possibilities. Currently I'm going with a naive approach but I wonder if there is any establish discussion/solution of it.