associativeIntersection<T> static method

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

Verifies the Associative Law for Intersection.

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

The grouping of sets in an intersection operation does not matter.

Implementation

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