package term-tools
Parameter Make.T
include Intf.Term_core with type prim = P.t
type prim = P.tThe type of primitives, i.e. the symbols. Each value of type prim has a definite arity.
val pp : Format.formatter -> t -> unitPretty-printing of terms.
val pp_sexp : Format.formatter -> t -> unitPretty-printing of terms in s-exp format.
prim p ts constructs a term with head equal to p and subterms equal to ts
Raises Invalid_argument if the length of ts does not match the arity of p.
val var : int -> tvar v construcst a variable v
destruct ifprim ifvar t performs case analysis on the term t
val destruct2 :
(prim -> t array -> prim -> t array -> 'a) ->
(prim -> t array -> int -> 'a) ->
(int -> prim -> t array -> 'a) ->
(int -> int -> 'a) ->
t ->
t ->
'adestruct2 fpp fpv fvp fvv t1 t2 performs case analysis on a pair of terms t1, t2
val is_var : t -> int optionis_var t is equal to var v if equal t (var v) or None if it is not the case
val is_ground : t -> boolis_ground t is true if and only if t does not contain any variable.
val ub : t -> Int_option.tub t is an upper bound on the absolute value of variables contained in t. Equal to Int_option.none if t does not contain variables.
map_variables f t replaces all variables var i present in t by f i.
get_subterm t pth is the subterm of t at position defined by the path pth.
Raise Get_subterm_oob if the path is out of bounds.
subst ~term ~path f replaces the subterm of term at path by f (get_subterm term path).
fold_variables f acc t folds f over the variables of t
canon t gen canonicalizes the term t using the variable generator gen. Returns the canonicalized term as well as a map from old to canonicalized variables.
val uid : t -> intuid t returns a unique integer attached to t. It is guaranteed that if two terms have the same uid, they are equal.