Safe Haskell | Safe-Infered |
---|
- class WithTerms a where
- isSubtermOf :: WithTerms a => Term -> a -> Bool
- nonVariableSubterms :: WithTerms a => a -> Set Term
- data Term
- depth :: Term -> Int
- size :: Term -> Int
- fsize :: Term -> Int
- root :: Term -> Either Variable Symbol
- immediateSubterms :: Term -> [Term]
- properSubterms :: Term -> [Term]
- isSupertermOf :: Term -> Term -> Bool
- cardinality :: Either Variable Symbol -> Term -> Int
- isUnifiable :: Term -> Term -> Bool
- isRenamedUnifiable :: Term -> Term -> Bool
- matches :: Term -> Term -> Bool
- subsumes :: Term -> Term -> Bool
- encompasses :: Term -> Term -> Bool
- variant :: Term -> Term -> Bool
- isVariable :: Term -> Bool
- type Overlap = (Rule, [Int], Rule)
- data Rule = Rule {}
- isNonErasing :: Rule -> Bool
- isErasing :: Rule -> Bool
- isNonDuplicating :: Rule -> Bool
- isDuplicating :: Rule -> Bool
- invert :: Rule -> Rule
- canonise :: Rule -> Rule
- type Trs = RuleSet Rule
- emptyTrs :: Trs
- fromRules :: [Rule] -> Trs
- toRules :: Trs -> [Rule]
- union :: Trs -> Trs -> Trs
- append :: Trs -> Trs -> Trs
- (\\) :: Trs -> Trs -> Trs
- intersect :: Trs -> Trs -> Trs
- member :: Trs -> Rule -> Bool
- insert :: Rule -> Trs -> Trs
- lhss :: Trs -> [Term]
- rhss :: Trs -> [Term]
- definedSymbols :: Trs -> Set Symbol
- constructors :: Trs -> Set Symbol
- overlaps :: Trs -> [Overlap]
- isEmpty :: Trs -> Bool
- wellFormed :: Trs -> Bool
- isOverlapping :: Trs -> Bool
- isOverlay :: Trs -> Bool
- isOrthogonal :: Trs -> Bool
- isNestedRecursive :: Trs -> Bool
- filterRules :: (Rule -> Bool) -> Trs -> Trs
- mapRules :: (Rule -> Rule) -> Trs -> Trs
- data Problem = Problem {}
- data StartTerms
- = BasicTerms { }
- | TermAlgebra (Set Symbol)
- data Ruleset = Ruleset {}
- emptyRuleset :: Ruleset
- data Strategy
- weakComponents :: Problem -> Trs
- strictComponents :: Problem -> Trs
- dpComponents :: Problem -> Trs
- trsComponents :: Problem -> Trs
- allComponents :: Problem -> Trs
- isRCProblem :: Problem -> Bool
- isDCProblem :: Problem -> Bool
- isDPProblem :: Problem -> Bool
- withFreshCompounds :: Problem -> Problem
- parseFromString :: TermParser a -> String -> Problem -> (a, Problem)
Documentation
This Module provides enlists most common used functions.
Data Structures containing terms
class WithTerms a where
extracts the set of variables
extracts the set of function symbols
returns the list of subterms
isSubtermOf :: WithTerms a => Term -> a -> Bool
't `isSubtermOf
` a' checks if t
occurs in the list of subterms of a
nonVariableSubterms :: WithTerms a => a -> Set Term
filters variables from the list of subterms
Terms
data Term
Querying
returns the depth of a term. Variables and constants admit depth '0'
returns the size of a term. Variables and constants admit size '1'
returns the number of function symbols
returns the root of the term
immediateSubterms :: Term -> [Term]
returns the list of direct subterms or '[]' if argument is a variable
properSubterms :: Term -> [Term]
returns the list of subterms, excluding the argument
isSupertermOf :: Term -> Term -> Bool
converse of isSubtermOf
returns the number of occurences of the first argument
isUnifiable :: Term -> Term -> Bool
returns True
iff the arguments are unifiable
isRenamedUnifiable :: Term -> Term -> Bool
returns True
iff renamings without common variables are unifiable
's `matches
` t' returns True
iff t
is an instance of s
inverse of matches
encompasses :: Term -> Term -> Bool
's `encomapsses
` t' returns True
iff s
encompasses t
two terms are variants if they subsume eatch other
isVariable :: Term -> Bool
returns True
if the argument is a variable
Term Rewriting Rule
data Rule
Predicates
See module Termlib.Rule for further predicates. Predicates can be lifted
with all
and any
from module Foldable
to Trs
s.
isNonErasing :: Rule -> Bool
rule is non-erasing if every occurence of a variable in the left-hand side occurs in the right-hand side
inverse of isNonErasing
isNonDuplicating :: Rule -> Bool
a rule is non-duplicating if no variable appears more often in the right-hand side than in the left-hand side
isDuplicating :: Rule -> Bool
inverse of isNonDuplicating
Modification
convert a rule 'l -> r' to 'r -> l'
renames variables to a canonical form.
Two rules r1
and r2
are equal modulo variable renaming,
iff 'canonise r1' and 'canonise r2' are syntactically equal.
Term Rewrite System
A TRS is a list of Rule
.
The empty Trs
..
translates a list of rewrite rules to a Trs
.
returns the list of rewrite rules in the TRS
Set Operations
union operator on the set of rules, removing duplicates
like union, but does not remove duplicates
difference on the set of rules
intersection on the set of rules
checks if a rule is contained in the TRS, does not perform variable conversion
inserts a rule into a TRS, if the rule is not already contained
Querying
returns the list of left-hand sides
returns the list of left-hand sides
definedSymbols :: Trs -> Set Symbol
returns roots of right-hand sides
constructors :: Trs -> Set Symbol
returns all symbols which are not roots of right-hand sides
returns the Overlap
of a term rewrite system
** Predicates
| Many predicates are defined in Termlib.Rule. These can be lifted to
Trs
by all
and any
checks if the list of rules is empty
wellFormed :: Trs -> Bool
checks that no left-hand side is a variable and all variables of a right-hand side are included in the corresponding left-hand side
isOverlapping :: Trs -> Bool
returns True
iff it contains two overlapping rules
returns True
iff all overlaps are only root overlaps
isOrthogonal :: Trs -> Bool
returns True
iff the given TRS is orthogonal
isNestedRecursive :: Trs -> Bool
returns True
iff there exists a rule 'f(..) -> C[f(..C[f(..)]..)]'.
Modification
filterRules :: (Rule -> Bool) -> Trs -> Trs
removes rules from the TRS matching the predicate
map the given function over the rules
Complexity Problem
data Problem
Problem | |
|
data StartTerms
data Ruleset
Querying
weakComponents :: Problem -> Trs
returns weak dependency pairs and weak rewrite rules
strictComponents :: Problem -> Trs
returns strict dependency pairs and strict rewrite rules
dpComponents :: Problem -> Trs
returns all dependency pairs
trsComponents :: Problem -> Trs
returns all dependency rules which are not dependency pairs
allComponents :: Problem -> Trs
returns all dependency pairs and rules ** Predicates
isRCProblem :: Problem -> Bool
returns True
iff the set of start-terms is basic
isDCProblem :: Problem -> Bool
converse of isRCProblem
isDPProblem :: Problem -> Bool
returns True
iff the set of start-terms is basic, and all
defined symbols are marked in the set of basic terms
Modification
withFreshCompounds :: Problem -> Problem
replaces all compound symbols by fresh compound symbols, and removes unary compound symbols
Parsing Utilities
parseFromString :: TermParser a -> String -> Problem -> (a, Problem)