term-rewriting 0.1.2.2 → 0.2
raw patch · 5 files changed
+30/−13 lines, 5 files
Files
- Changelog +14/−0
- src/Data/Rewriting/Rule/Ops.hs +4/−4
- src/Data/Rewriting/Substitution/Ops.hs +1/−1
- src/Data/Rewriting/Term/Ops.hs +7/−7
- term-rewriting.cabal +4/−1
+ Changelog view
@@ -0,0 +1,14 @@+version 0.2+ - fix argument order of Data.Rewriting.Rule.isVariantOf++version 0.1.2.2+ - fix build with ghc-7.10.1++version 0.1.2.1+ - fix Data.Rewriting.CriticalPair.cpsIn and cpsOut++version 0.1.2+ - update to parsec >= 3.1.6 API (thanks alpako!)++version 0.1.1+ - no changelog (yet?)
src/Data/Rewriting/Rule/Ops.hs view
@@ -144,17 +144,17 @@ isExpanding :: Rule f v -> Bool isExpanding = Term.isVar . lhs --- | Check whether rule is non-creating and non-expanding.+-- | Check whether the given rule is non-creating and non-expanding. -- See also 'isCreating' and 'isExpanding' isValid :: Ord v => Rule f v -> Bool isValid r = not (isCreating r) && not (isExpanding r) --- | Check whether a rule is an instance of another.+-- | Check whether the first rule is an instance of the second rule. isInstanceOf :: (Eq f, Ord v, Ord v') => Rule f v -> Rule f v' -> Bool-isInstanceOf r r' = case (match (lhs r) (lhs r'), match (rhs r) (rhs r')) of+isInstanceOf r r' = case (match (lhs r') (lhs r), match (rhs r') (rhs r)) of (Just s, Just s') -> isJust (merge s s') _ -> False --- | Check whether a rule is a variant of another.+-- | Check whether two rules are variants of each other. isVariantOf :: (Eq f, Ord v, Ord v') => Rule f v -> Rule f v' -> Bool isVariantOf t u = isInstanceOf t u && isInstanceOf u t
src/Data/Rewriting/Substitution/Ops.hs view
@@ -6,7 +6,7 @@ module Data.Rewriting.Substitution.Ops ( apply, applyRule,- applyCtxt, + applyCtxt, gApply, compose, merge,
src/Data/Rewriting/Term/Ops.hs view
@@ -48,15 +48,15 @@ subtermAt _ _ = Nothing -- | Return the list of all proper subterms.--- +-- -- >>> properSubterms (Fun 'g' [Fun 'f' [Var 1], Fun 'f' [Var 1]]) -- [Fun 'f' [Var 1],Var 1,Fun 'f' [Var 1],Var 1] properSubterms :: Term f v -> [Term f v] properSubterms (Var _) = [] properSubterms (Fun _ ts) = concatMap subterms ts --- | Return the list of all subterm.--- +-- | Return the list of all subterms.+-- -- prop> subterms t = t : properSubterms t subterms :: Term f v -> [Term f v] subterms t = t : properSubterms t@@ -130,17 +130,17 @@ isLinear :: Ord v => Term f v -> Bool isLinear = all (\(_, c) -> c == 1) . MS.toOccurList . MS.fromList . vars --- | Check whether a term is an instance of another.+-- | Check whether the first term is an instance of the second term. isInstanceOf :: (Eq f, Ord v, Ord v') => Term f v -> Term f v' -> Bool isInstanceOf t u = isJust (match u t) --- | Check whether a term is a variant of another.+-- | Check whether two terms are variants of each other. isVariantOf :: (Eq f, Ord v, Ord v') => Term f v -> Term f v' -> Bool isVariantOf t u = isInstanceOf t u && isInstanceOf u t -- | Rename the variables in a term.--- +-- -- >>> rename (+ 1) (Fun 'f' [Var 1, Fun 'g' [Var 2]]) -- (Fun 'f' [Var 2, Fun 'g' [Var 3]]) rename :: (v -> v') -> Term f v -> Term f v'-rename = Term.map id +rename = Term.map id
term-rewriting.cabal view
@@ -1,5 +1,5 @@ name: term-rewriting-version: 0.1.2.2+version: 0.2 stability: experimental author: Martin Avanzini, Bertram Felgenhauer,@@ -18,6 +18,9 @@ term rewriting. build-type: Simple cabal-version: >= 1.8++extra-source-files:+ Changelog source-repository head type: git