reverse_eval

Function reverse_eval 

Source
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 evaluate
  • output_constraint - The constraint that the output must satisfy
  • env - Environment with constant values (for evaluating constant subexpressions)

§Returns

  • Some(Constraint) - The constraint on the single variable in the expression
  • None - 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