public static FilterPredicate rewrite(FilterPredicate pred) {
    Objects.requireNonNull(pred, "pred cannot be null");
    return pred.accept(INSTANCE);
  }
@Test
  public void testComplex() {
    assertEquals(complexCollapsed, rewrite(complex));
  }