expr_addition <- function(x, y) {
  expr(!!x + !!y)
}

expr_subtraction <- function(x, y) {
  expr(!!x - !!y)
}

expr_multiplication <- function(x, y) {
  expr(!!x * !!y)
}

expr_division <- function(x, y) {
  expr(!!x / !!y)
}

expr_and <- function(x, y) {
  expr(!!x & !!y)
}

reduce_addition <- function(x) {
  reduce(x, expr_addition)
}

reduce_subtraction <- function(x) {
  reduce(x, expr_subtraction)
}

reduce_multiplication <- function(x) {
  reduce(x, expr_multiplication)
}

reduce_and <- function(x) {
  reduce(x, expr_and)
}

expr_or <- function(x, y) {
  expr(!!x | !!y)
}

reduce_or <- function(x) {
  reduce(x, expr_or)
}

combine_path_conditions <- function(conditions) {
  n <- length(conditions)
  if (n == 0) {
    return(TRUE)
  }
  if (n == 1) {
    return(conditions[[1]])
  }
  if (n == 2) {
    return(expr_and(conditions[[1]], conditions[[2]]))
  }
  reduce_and(conditions)
}
