static Call combineAndSimplify(Operator operator, Expression leftExpr, Expression rightExpr) {
    Objects.requireNonNull(operator, "operator");
    if (!(leftExpr instanceof Call && rightExpr instanceof Call)) {
      // regular call which can't be simplified
      return Expressions.binaryCall(operator, leftExpr, rightExpr);
    }

    Call left = (Call) leftExpr;
    Call right = (Call) rightExpr;

    if (!(left.operator() == operator && right.operator() == operator)) {
      if (left.operator() == operator) {
        List<Expression> args = new ArrayList<>(left.arguments());
        args.add(right);
        return Expressions.call(operator, args);
      }

      return Expressions.binaryCall(operator, left, right);
    }

    // combine expressions with same operator (AND / OR) into single expression
    // with multiple arguments
    List<Expression> args = new ArrayList<>();
    args.addAll(left.arguments());
    args.addAll(right.arguments());
    return Expressions.call(operator, args);
  }
Combines expression using <a href="https://en.wikipedia.org/wiki/Disjunctive_normal_form">DNF logic</a>
criteria/common/src/org/immutables/criteria/matcher/Combiner.java