deMorganIntersection<T> static method

bool deMorganIntersection<T>(
  1. CustomSet<T> a,
  2. CustomSet<T> b,
  3. CustomSet<T> universal
)

Verifies De Morgan's Law for Intersection.

Law: (A ∩ B)' = A' ∪ B'

The complement of an intersection equals the union of the complements.

Implementation

static bool deMorganIntersection<T>(
  CustomSet<T> a,
  CustomSet<T> b,
  CustomSet<T> universal,
) {
  final intersection = SetOperations.intersection(a, b);
  final complementIntersection = SetOperations.complement(
    intersection,
    universal,
  );
  final complementA = SetOperations.complement(a, universal);
  final complementB = SetOperations.complement(b, universal);
  final unionComplements = SetOperations.union(complementA, complementB);
  return complementIntersection.equals(unionComplements);
}