code: public static boolean reduce(AbstractExpression expr, Predicate<AbstractExpression> pred) {
          final boolean current = pred.test(expr);
          if (current) {
              return true;
          } else if (expr == null) {
              return pred.test(null);
          } else {
              return pred.test(expr.getLeft()) || pred.test(expr.getRight()) ||
                      expr.getArgs() != null && expr.getArgs().stream().anyMatch(pred);
          }
  
      }
docs: Check if any node of given expression tree satisfies given predicate
  @param expr source expression tree
  @param pred predicate to check against any expression node to find if any node satisfies.
  Note that it should be able to handle null.
  @return true if there exists a node that satisfies the predicate