Term.Rewriting.Definitions

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

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

Term.Rewriting.Definitions

Contents

- Equalities
- Matching problems
- Rewriting rules

Description

Term Equalities, Matching Problems, and Subterm Rules.

Synopsis

- data Equal a = Equal {
  - eqLHS :: a
  - eqRHS :: a
  }
- evalEqual :: Eq a => Equal a -> Bool
- data Match a
  - = NoMatch
  - | DelayedMatches [(a, a)]
- flattenMatch :: Match a -> Maybe [(a, a)]
- matchWith :: a -> a -> Match a
- matchOnlyIf :: Bool -> Match a
- data RRule a = RRule a a

# Equalities

data Equal a #

An equality.

Constructors

Equal |
Fields eqLHS :: a eqRHS :: a

Instances

Functor Equal # |
Methods fmap :: (a -> b) -> Equal a -> Equal b # (<$) :: a -> Equal b -> Equal a #
Applicative Equal # |
Methods pure :: a -> Equal a # (<*>) :: Equal (a -> b) -> Equal a -> Equal b # (*>) :: Equal a -> Equal b -> Equal b # (<*) :: Equal a -> Equal b -> Equal a #
Foldable Equal # |
Methods fold :: Monoid m => Equal m -> m # foldMap :: Monoid m => (a -> m) -> Equal a -> m # foldr :: (a -> b -> b) -> b -> Equal a -> b # foldr' :: (a -> b -> b) -> b -> Equal a -> b # foldl :: (b -> a -> b) -> b -> Equal a -> b # foldl' :: (b -> a -> b) -> b -> Equal a -> b # foldr1 :: (a -> a -> a) -> Equal a -> a # foldl1 :: (a -> a -> a) -> Equal a -> a # toList :: Equal a -> [a] # null :: Equal a -> Bool # length :: Equal a -> Int # elem :: Eq a => a -> Equal a -> Bool # maximum :: Ord a => Equal a -> a # minimum :: Ord a => Equal a -> a # sum :: Num a => Equal a -> a # product :: Num a => Equal a -> a #
Traversable Equal # |
Methods traverse :: Applicative f => (a -> f b) -> Equal a -> f (Equal b) # sequenceA :: Applicative f => Equal (f a) -> f (Equal a) # mapM :: Monad m => (a -> m b) -> Equal a -> m (Equal b) # sequence :: Monad m => Equal (m a) -> m (Equal a) #
Eq a => Eq (Equal a) # |
Methods (==) :: Equal a -> Equal a -> Bool # (/=) :: Equal a -> Equal a -> Bool #
Show a => Show (Equal a) # |
Methods showsPrec :: Int -> Equal a -> ShowS # show :: Equal a -> String # showList :: [Equal a] -> ShowS #
Monoid a => Monoid (Equal a) # |
Methods mempty :: Equal a # mappend :: Equal a -> Equal a -> Equal a # mconcat :: [Equal a] -> Equal a #
HasFrees a => HasFrees (Equal a) # |
Methods foldFrees :: Monoid m => (LVar -> m) -> Equal a -> m # foldFreesOcc :: Monoid m => (Occurence -> LVar -> m) -> Occurence -> Equal a -> m # mapFrees :: Applicative f => MonotoneFunction f -> Equal a -> f (Equal a) #
Apply t => Apply (Equal t) # |
Methods apply :: LNSubst -> Equal t -> Equal t #

evalEqual :: Eq a => Equal a -> Bool #

True iff the two sides of the equality are equal with respect to their `Eq` instance.

# Matching problems

data Match a #

Matching problems. Use the `Monoid` instance to compose matching problems.

Constructors

NoMatch | No matcher exists.
DelayedMatches [(a, a)] | A bunch of delayed (term,pattern) pairs.

Instances

Functor Match # |
Methods fmap :: (a -> b) -> Match a -> Match b # (<$) :: a -> Match b -> Match a #
Foldable Match # |
Methods fold :: Monoid m => Match m -> m # foldMap :: Monoid m => (a -> m) -> Match a -> m # foldr :: (a -> b -> b) -> b -> Match a -> b # foldr' :: (a -> b -> b) -> b -> Match a -> b # foldl :: (b -> a -> b) -> b -> Match a -> b # foldl' :: (b -> a -> b) -> b -> Match a -> b # foldr1 :: (a -> a -> a) -> Match a -> a # foldl1 :: (a -> a -> a) -> Match a -> a # toList :: Match a -> [a] # null :: Match a -> Bool # length :: Match a -> Int # elem :: Eq a => a -> Match a -> Bool # maximum :: Ord a => Match a -> a # minimum :: Ord a => Match a -> a # sum :: Num a => Match a -> a # product :: Num a => Match a -> a #
Traversable Match # |
Methods traverse :: Applicative f => (a -> f b) -> Match a -> f (Match b) # sequenceA :: Applicative f => Match (f a) -> f (Match a) # mapM :: Monad m => (a -> m b) -> Match a -> m (Match b) # sequence :: Monad m => Match (m a) -> m (Match a) #
Eq a => Eq (Match a) # |
Methods (==) :: Match a -> Match a -> Bool # (/=) :: Match a -> Match a -> Bool #
Show a => Show (Match a) # |
Methods showsPrec :: Int -> Match a -> ShowS # show :: Match a -> String # showList :: [Match a] -> ShowS #
Monoid (Match a) # |
Methods mempty :: Match a # mappend :: Match a -> Match a -> Match a # mconcat :: [Match a] -> Match a #
HasFrees a => HasFrees (Match a) # |
Methods foldFrees :: Monoid m => (LVar -> m) -> Match a -> m # foldFreesOcc :: Monoid m => (Occurence -> LVar -> m) -> Occurence -> Match a -> m # mapFrees :: Applicative f => MonotoneFunction f -> Match a -> f (Match a) #

flattenMatch :: Match a -> Maybe [(a, a)] #

Flatten a matching problem to a list of (term,pattern) pairs. If no matcher exists, then `Nothing` is returned.

matchWith #

Arguments

:: a | Term
-> a | Pattern
-> Match a | Matching problem.

Match a term with a pattern.

matchOnlyIf :: Bool -> Match a #

Ensure that matching only succeeds if the condition holds.

# Rewriting rules

data RRule a #

A rewrite rule.

Constructors

RRule a a |

Instances

Functor RRule # |
Methods fmap :: (a -> b) -> RRule a -> RRule b # (<$) :: a -> RRule b -> RRule a #
Applicative RRule # |
Methods pure :: a -> RRule a # (<*>) :: RRule (a -> b) -> RRule a -> RRule b # (*>) :: RRule a -> RRule b -> RRule b # (<*) :: RRule a -> RRule b -> RRule a #
Foldable RRule # |
Methods fold :: Monoid m => RRule m -> m # foldMap :: Monoid m => (a -> m) -> RRule a -> m # foldr :: (a -> b -> b) -> b -> RRule a -> b # foldr' :: (a -> b -> b) -> b -> RRule a -> b # foldl :: (b -> a -> b) -> b -> RRule a -> b # foldl' :: (b -> a -> b) -> b -> RRule a -> b # foldr1 :: (a -> a -> a) -> RRule a -> a # foldl1 :: (a -> a -> a) -> RRule a -> a # toList :: RRule a -> [a] # null :: RRule a -> Bool # length :: RRule a -> Int # elem :: Eq a => a -> RRule a -> Bool # maximum :: Ord a => RRule a -> a # minimum :: Ord a => RRule a -> a # sum :: Num a => RRule a -> a # product :: Num a => RRule a -> a #
Traversable RRule # |
Methods traverse :: Applicative f => (a -> f b) -> RRule a -> f (RRule b) # sequenceA :: Applicative f => RRule (f a) -> f (RRule a) # mapM :: Monad m => (a -> m b) -> RRule a -> m (RRule b) # sequence :: Monad m => RRule (m a) -> m (RRule a) #
Eq a => Eq (RRule a) # |
Methods (==) :: RRule a -> RRule a -> Bool # (/=) :: RRule a -> RRule a -> Bool #
Ord a => Ord (RRule a) # |
Methods compare :: RRule a -> RRule a -> Ordering # (<) :: RRule a -> RRule a -> Bool # (<=) :: RRule a -> RRule a -> Bool # (>) :: RRule a -> RRule a -> Bool # (>=) :: RRule a -> RRule a -> Bool # max :: RRule a -> RRule a -> RRule a # min :: RRule a -> RRule a -> RRule a #
Show a => Show (RRule a) # |
Methods showsPrec :: Int -> RRule a -> ShowS # show :: RRule a -> String # showList :: [RRule a] -> ShowS #
Monoid a => Monoid (RRule a) # |
Methods mempty :: RRule a # mappend :: RRule a -> RRule a -> RRule a # mconcat :: [RRule a] -> RRule a #
HasFrees a => HasFrees (RRule a) # |
Methods foldFrees :: Monoid m => (LVar -> m) -> RRule a -> m # foldFreesOcc :: Monoid m => (Occurence -> LVar -> m) -> Occurence -> RRule a -> m # mapFrees :: Applicative f => MonotoneFunction f -> RRule a -> f (RRule a) #