Safe Haskell | None |
---|---|
Language | Haskell98 |
This module is internal to QuickSpec.
Typed terms and operations on them.
- data Term f
- data Var = V {}
- class Symbolic f a | a -> f where
- class Sized a where
- isApp :: Term f -> Bool
- isVar :: Term f -> Bool
- terms :: Symbolic f a => a -> [Term f]
- funs :: Symbolic f a => a -> [f]
- vars :: Symbolic f a => a -> [Var]
- freeVar :: Symbolic f a => a -> Int
- occ :: (Eq f, Symbolic f a) => f -> a -> Int
- occVar :: Symbolic f a => Var -> a -> Int
- mapVar :: (Var -> Var) -> Term f -> Term f
- subterms :: Term f -> [Term f]
- properSubterms :: Term f -> [Term f]
- canonicalise :: Symbolic fun a => a -> a
- evalTerm :: (Typed fun, Apply a, Monad m) => (Var -> m a) -> (fun -> m a) -> Term fun -> m a
- type Measure f = (Int, Int, MeasureFuns f, Int, [Var])
- measure :: Sized f => Term f -> Measure f
- newtype MeasureFuns f = MeasureFuns (Term f)
- compareFuns :: Ord f => Term f -> Term f -> Ordering
- data a :+: b
- module Twee.Base
- module Twee.Pretty
Documentation
A typed term.
A variable, which has a type and a number.
class Symbolic f a | a -> f where Source #
A class for things that contain terms.
funs :: Symbolic f a => a -> [f] Source #
All function symbols appearing in a Symbolic
, in order of appearance,
with duplicates included.
vars :: Symbolic f a => a -> [Var] Source #
All variables appearing in a Symbolic
, in order of appearance,
with duplicates included.
freeVar :: Symbolic f a => a -> Int Source #
Compute the number of a variable which does not appear in the Symbolic
.
occ :: (Eq f, Symbolic f a) => f -> a -> Int Source #
Count how many times a given function symbol occurs.
properSubterms :: Term f -> [Term f] Source #
Find all subterms of a term. Does not include the term itself.
canonicalise :: Symbolic fun a => a -> a Source #
Renames variables so that they appear in a canonical order. Also makes sure that variables of different types have different numbers.
evalTerm :: (Typed fun, Apply a, Monad m) => (Var -> m a) -> (fun -> m a) -> Term fun -> m a Source #
Evaluate a term, given a valuation for variables and function symbols.
type Measure f = (Int, Int, MeasureFuns f, Int, [Var]) Source #
A standard term ordering - size, skeleton, generality. Satisfies the property: if measure (schema t) < measure (schema u) then t < u.
newtype MeasureFuns f Source #
A helper for Measure
.
MeasureFuns (Term f) |
Ord f => Eq (MeasureFuns f) Source # | |
Ord f => Ord (MeasureFuns f) Source # | |
Data types a la carte-ish.
A sum type. Intended to be used to build the type of function symbols. Comes with instances that are useful for QuickSpec.
(Eq b, Eq a) => Eq ((:+:) a b) Source # | |
(Ord b, Ord a) => Ord ((:+:) a b) Source # | |
(Pretty fun1, Pretty fun2) => Pretty ((:+:) fun1 fun2) Source # | |
(Arity fun1, Arity fun2) => Arity ((:+:) fun1 fun2) Source # | |
(PrettyTerm fun1, PrettyTerm fun2) => PrettyTerm ((:+:) fun1 fun2) Source # | |
(Typed fun1, Typed fun2) => Typed ((:+:) fun1 fun2) Source # | |
(Sized fun1, Sized fun2) => Sized ((:+:) fun1 fun2) Source # | |
module Twee.Base
module Twee.Pretty