Term.Positions

tamarin-prover-term-1.2.2: Term manipulation library for the tamarin prover.

Copyright | (c) 2010-12 Benedikt Schmidt
License | GPL v3 (see LICENSE)
Maintainer | Benedikt Schmidt <beschmi@gmail.com>
Safe Haskell | None
Language | Haskell98

Term.Positions

Description

Positions and replacement in terms.

Synopsis

- type Position = [Int]
- atPos :: Ord a => Term a -> Position -> Term a
- replacePos :: Ord a => Term a -> (Term a, Position) -> Term a
- positionsNonVar :: VTerm a b -> [Position]
- positions :: (Show a, Show b) => VTerm a b -> [Position]

# Documentation

type Position = [Int] #

A position in a term is a list of integers.

atPos :: Ord a => Term a -> Position -> Term a #

`t `atPos` p` returns the subterm of term `t` at position `p`. The standard notation for `t `atPos` p` is `t|_p`. `atPos` accounts for AC symbols by interpreting n-ary operator applications `*[t1,t2,..tk-1,tk]` as binary applications `t1*(t2*..(tk-1*tk)..)`.

replacePos :: Ord a => Term a -> (Term a, Position) -> Term a #

`t `replacePos` (s,p)` returns the term `t'` where the subterm at position `p` is replaced by `s`. The standard notation for `t `replacePos` (s,p)` is `t[s]_p`. `replacePos` accounts for AC symbols in the same ways as `atPos`. FIXME: The AC can be optimized.

positionsNonVar :: VTerm a b -> [Position] #

`positionsNonVar t` returns all the non-variable positions in the term `t`. `positionsNonVar` accounts for AC symbols in the same ways as `atPos`.

positions :: (Show a, Show b) => VTerm a b -> [Position] #

`positions t` returns all the positions in the term `t`. `positions` accounts for AC symbols in the same ways as `atPos`.