Page
Library
Module
Module type
Parameter
Class
Class type
Source
Libabsolute.ExprThis module defines the numerical language and some basic operations over it
numeric expressions (function call, unary negation, binary operations, variables and constants)
and 'a annot_t = 'a annot * 'aval one : tval zero : tval two : tval of_int : int -> tbuilds an expression from an integer
val of_float : float -> tbuilds an expression from an float
val var : string -> tvariables constructor
val has_variable : t -> boolchecks if an expression contains a variable
val is_linear : t -> boolchecks if an expression is linear:
convert a binary operator to a rational function. The resulting function may raise Division_by_zero or Non_integer_exposant when the binary operator is respectivelly DIV or POW
bottom-up partial evaluation of expressions when operations involving only constants are involved:
val collect_vars : t -> int Tools.VarMap.tReturns all the variables appearing in an expression as a map where to each variable is associated the integer number of its occurences
replace expr var value builds a new expression identical to expr where all the occurences of the variable var are replaced by the expression value.
if simplify is true (default behaviour), a round of constant propagation is applied on the resulting expression
fix_var expr var cst builds a new expression identical to expr where all the occurences of the variable var are replaced by the constant cst
if simplify is true (default behaviour), a round of constant propagation is applied on the resulting expression
val eval : t -> Instance.t -> Q.tEvaluates the expression at the given point.
val pp_var : Format.formatter -> string -> unitvariables printing
val pp_binop : Format.formatter -> binop -> unitbinary operators printing
val print : Format.formatter -> t -> unitexpression printer
val to_string : t -> stringConversion to a string