pub fn reverse_eval(
expr: &TypedExpression,
output_constraint: Constraint,
env: &Environment,
) -> EvalResult<Option<Constraint>>Expand description
Main entry point for reverse evaluation
Takes a typed expression and an output constraint, then calculates the constraint on the input variable that would produce outputs satisfying that constraint.
This function only supports expressions with a single variable. Expressions with multiple variables will return an error.
§Arguments
expr- The typed expression to reverse evaluateoutput_constraint- The constraint that the output must satisfyenv- Environment with constant values (for evaluating constant subexpressions)
§Returns
Some(Constraint)- The constraint on the single variable in the expressionNone- The expression contains no variables (e.g., it’s a literal)Err- The constraints are unsatisfiable, multiple variables exist, or the operation is not supported