distributiveIntersection<T> static method

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

Verifies the Distributive Law for Intersection over Union.

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

Intersection distributes over union.

Implementation

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