distributiveUnion<T> static method

bool distributiveUnion<T>(
  1. CustomSet<T> a,
  2. CustomSet<T> b,
  3. CustomSet<T> c
)

Verifies the Distributive Law for Union over Intersection.

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

Union distributes over intersection.

Implementation

static bool distributiveUnion<T>(
  CustomSet<T> a,
  CustomSet<T> b,
  CustomSet<T> c,
) {
  final left = SetOperations.union(a, SetOperations.intersection(b, c));
  final right = SetOperations.intersection(
    SetOperations.union(a, b),
    SetOperations.union(a, c),
  );
  return left.equals(right);
}