Safe Haskell | Safe-Inferred |
---|
- funs :: Term f v -> [f]
- funsDL :: Term f v -> [f] -> [f]
- vars :: Term f v -> [v]
- varsDL :: Term f v -> [v] -> [v]
- withArity :: Term f v -> Term (f, Int) v
- subtermAt :: Term f v -> Pos -> Maybe (Term f v)
- replaceAt :: Term f v -> Pos -> Term f v -> Maybe (Term f v)
- isVar :: Term f v -> Bool
- isFun :: Term f v -> Bool
- isGround :: Term f v -> Bool
- isLinear :: Ord v => Term f v -> Bool
- isInstanceOf :: (Eq f, Ord v, Ord v') => Term f v -> Term f v' -> Bool
- isVariantOf :: (Eq f, Ord v, Ord v') => Term f v -> Term f v' -> Bool
Operations on Terms
Return the list of all function symbols in the term, from left to right.
>>>
funs (Fun 'f' [Var 3, Fun 'g' [Fun 'f' []]])
"fgf"
funsDL :: Term f v -> [f] -> [f]Source
Difference List version of funs
.
We have funsDL t vs = funs t ++ vs
.
Return the list of all variables in the term, from left to right.
>>>
vars (Fun 'g' [Var 3, Fun 'f' [Var 1, Var 2, Var 3]])
[3,1,2,3]
varsDL :: Term f v -> [v] -> [v]Source
Difference List version of vars
.
We have varsDL t vs = vars t ++ vs
.
withArity :: Term f v -> Term (f, Int) vSource
Annotate each occurrence of a function symbol with its actual arity, i.e., its number of arguments.
>>>
withArity (Fun 'f' [Var 1, Fun 'f' []])
Fun ('f',2) [Var 1,Fun ('f',0) []]
replaceAt :: Term f v -> Pos -> Term f v -> Maybe (Term f v)Source
replace a subterm at a given position.
Predicates on Terms
isGround :: Term f v -> BoolSource
Check whether the term is a ground term, i.e., contains no variables.
isLinear :: Ord v => Term f v -> BoolSource
Check whether the term is linear, i.e., contains each variable at most once.