package term-indexing
Module Make.TermSource
First-order terms.
include Intf.Term_core with type prim = P.t
The type of primitives, i.e. the symbols. Each value of type prim has a definite arity.
The type of terms
Pretty-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.
destruct t ifprim ifvar performs case analysis on the term t
is_var t is equal to var v if equal t (var v) or None if it is not the case
fold f acc term folds f over the subterms of t
get_subterm_fwd t fpth is the subterm of t at position defined by the forward path fpth.
Raises Get_subterm_oob if the path is out of bounds.
The type of polymorphic maps indexed by variables
include Intf.Hashed with type t := t
pp fmt s prints a representation of s to the formatter fmt.
ub 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 position 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.