Page
Library
Module
Module type
Parameter
Class
Class type
Source
Libabsolute.Expr
This 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 * 'a
val one : t
val zero : t
val two : t
val of_int : int -> t
builds an expression from an integer
val of_float : float -> t
builds an expression from an float
val var : string -> t
variables constructor
val has_variable : t -> bool
checks if an expression contains a variable
val is_linear : t -> bool
checks 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.t
Returns 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.t
Evaluates the expression at the given point.
val pp_var : Format.formatter -> string -> unit
variables printing
val pp_binop : Format.formatter -> binop -> unit
binary operators printing
val print : Format.formatter -> t -> unit
expression printer
val to_string : t -> string
Conversion to a string