docs: private static DimFilter doSimplify(final List<DimFilter> children, boolean disjunction)
    {
      // Copy children list
      final List<DimFilter> newChildren = Lists.newArrayList(children);
  
      // Group Bound filters by dimension, extractionFn, and comparator and compute a RangeSet for each one.
      final Map<BoundRefKey, List<BoundDimFilter>> bounds = new HashMap<>();
  
      final Iterator<DimFilter> iterator = newChildren.iterator();
      while (iterator.hasNext()) {
        final DimFilter child = iterator.next();
  
        if (child.equals(Filtration.matchNothing())) {
          // Child matches nothing, equivalent to FALSE
          // OR with FALSE => ignore
          // AND with FALSE => always false, short circuit
          if (disjunction) {
            iterator.remove();
          } else {
            return Filtration.matchNothing();
          }
        } else if (child.equals(Filtration.matchEverything())) {
          // Child matches everything, equivalent to TRUE
          // OR with TRUE => always true, short circuit
          // AND with TRUE => ignore
          if (disjunction) {
            return Filtration.matchEverything();
          } else {
            iterator.remove();
          }
        } else if (child instanceof BoundDimFilter) {
          final BoundDimFilter bound = (BoundDimFilter) child;
          final BoundRefKey boundRefKey = BoundRefKey.from(bound);
          List<BoundDimFilter> filterList = bounds.get(boundRefKey);
          if (filterList == null) {
            filterList = new ArrayList<>();
            bounds.put(boundRefKey, filterList);
          }
          filterList.add(bound);
        }
      }
  
      // Try to simplify filters within each group.
      for (Map.Entry<BoundRefKey, List<BoundDimFilter>> entry : bounds.entrySet()) {
        final BoundRefKey boundRefKey = entry.getKey();
        final List<BoundDimFilter> filterList = entry.getValue();
  
        // Create a RangeSet for this group.
        final RangeSet<BoundValue> rangeSet = disjunction
                                              ? RangeSets.unionRanges(Bounds.toRanges(filterList))
                                              : RangeSets.intersectRanges(Bounds.toRanges(filterList));
  
        if (rangeSet.asRanges().size() < filterList.size()) {
          // We found a simplification. Remove the old filters and add new ones.
          for (final BoundDimFilter bound : filterList) {
            if (!newChildren.remove(bound)) {
              throw new ISE("WTF?! Tried to remove bound but couldn't?");
            }
          }
  
          if (rangeSet.asRanges().isEmpty()) {
            // range set matches nothing, equivalent to FALSE
            // OR with FALSE => ignore
            // AND with FALSE => always false, short circuit
            if (disjunction) {
              newChildren.add(Filtration.matchNothing());
            } else {
              return Filtration.matchNothing();
            }
          }
  
          for (final Range<BoundValue> range : rangeSet.asRanges()) {
            if (!range.hasLowerBound() && !range.hasUpperBound()) {
              // range matches all, equivalent to TRUE
              // AND with TRUE => ignore
              // OR with TRUE => always true; short circuit
              if (disjunction) {
                return Filtration.matchEverything();
              } else {
                newChildren.add(Filtration.matchEverything());
              }
            } else {
              newChildren.add(Bounds.toFilter(boundRefKey, range));
            }
          }
        }
      }
  
      Preconditions.checkState(newChildren.size() > 0, "newChildren.size > 0");
      if (newChildren.size() == 1) {
        return newChildren.get(0);
      } else {
        return disjunction ? new OrDimFilter(newChildren) : new AndDimFilter(newChildren);
      }
    }