type variable = string module VariableMap : Map.S with type key = variable type t_exp = Integer of int | Boolean of bool | Variable of variable | Function of variable list * t_exp | Application of t_exp * t_exp list | Plus of t_exp * t_exp | Minus of t_exp * t_exp | Times of t_exp * t_exp | Division of t_exp * t_exp | Modulo of t_exp * t_exp | Power of t_exp * t_exp | PowerMod of t_exp * t_exp * t_exp | Rand of t_exp | BAnd of t_exp * t_exp | BOr of t_exp * t_exp | BNot of t_exp | Cmp of t_exp * t_exp | CmpLess of t_exp * t_exp | CmpLessEq of t_exp * t_exp | CmpGreater of t_exp * t_exp | CmpGreaterEq of t_exp * t_exp | IfThenElse of t_exp * t_exp * t_exp | LetIn of variable * t_exp * t_exp | LetFun of variable * variable list * t_exp * t_exp type permittedValues = IntegerPermitted of int | BooleanPermitted of bool | FunctionPermitted of closure and closure = { inputList: variable list; body: t_exp; assignments: permittedValues VariableMap.t; recursiveness: variable option } type memory = { assignments: permittedValues VariableMap.t } exception AbsentAssignment of string exception WrongType of string exception DivisionByZero of string exception WrongAriety of string val reduce : t_exp -> int -> int