Expand set-logic capabilities to use additional laws to simplify defineComparison requirements
justinbmeyer opened this issue · comments
Currently, one needs to define a union
, intersection
, difference
and reverse difference
between two set types. One should also define the difference between the universal set and the set type:
defineComparison(TypeA, TypeB,{union, intersection, difference})
defineComparison(TypeB, TypeA, {difference})
defineComparison(set.UNIVERSAL, TypeA, {difference})
There's some set algebra laws that could simplify these requirements:
B \ A = Aᶜ ∩ B
- IfUNIVERSAL \ TypeA
is defined and the type of that resultTypeC
has an intersection withTypeB
, thenTypeB \ TypeA
doesn't need to be defined.A ∩ B = A \ (A \ B)
- Intersection doesn't need to be defined if the difference betweenTypeA
and the result of(TypeA \ TypeB)
is defined.