Copyright | (c) 2010-2012 Benedikt Schmidt & Simon Meier |
---|---|
License | GPL v3 (see LICENSE) |
Maintainer | Benedikt Schmidt <beschmi@gmail.com> |
Safe Haskell | None |
Language | Haskell98 |
Term.VTerm
Contents
Description
Terms with variables and constants.
- data Lit c v
- type VTerm c v = Term (Lit c v)
- varTerm :: v -> VTerm c v
- constTerm :: c -> VTerm c v
- varsVTerm :: Ord v => VTerm c v -> [v]
- occursVTerm :: Eq v => v -> VTerm c v -> Bool
- constsVTerm :: IsConst c => VTerm c v -> [c]
- isVar :: VTerm c v -> Bool
- termVar :: VTerm c v -> Maybe v
- termVar' :: (Show c, Show v) => VTerm c v -> v
- class (Ord v, Eq v, Show v) => IsVar v
- class (Ord c, Eq c, Show c, Data c) => IsConst c
- prettyTerm :: (Document d, Show l) => (l -> d) -> Term l -> d
- showFunSymName :: FunSym -> String
- lits :: Term a -> [a]
- fAppOne :: Term a
- fAppDiff :: (Term a, Term a) -> Term a
- fAppExp :: (Term a, Term a) -> Term a
- fAppInv :: Term a -> Term a
- fAppPMult :: (Term a, Term a) -> Term a
- fAppEMap :: Ord a => (Term a, Term a) -> Term a
- fAppPair :: (Term a, Term a) -> Term a
- fAppFst :: Term a -> Term a
- fAppSnd :: Term a -> Term a
- isPair :: Show a => Term a -> Bool
- isDiff :: Show a => Term a -> Bool
- isInverse :: Show a => Term a -> Bool
- isProduct :: Show a => Term a -> Bool
- isUnion :: Show a => Term a -> Bool
- isEMap :: Show a => Term a -> Bool
- isNullaryPublicFunction :: Term a -> Bool
- isPrivateFunction :: Term a -> Bool
- getLeftTerm :: Term a -> Term a
- getRightTerm :: Term a -> Term a
- data FunSym
- data ACSym
- data CSym = EMap
- data Privacy
- type NoEqSym = (ByteString, (Int, Privacy))
- type FunSig = Set FunSym
- type NoEqFunSig = Set NoEqSym
- diffSymString :: ByteString
- expSymString :: ByteString
- invSymString :: ByteString
- pmultSymString :: ByteString
- emapSymString :: ByteString
- unionSymString :: ByteString
- diffSym :: NoEqSym
- expSym :: NoEqSym
- pmultSym :: NoEqSym
- dhFunSig :: FunSig
- bpFunSig :: FunSig
- msetFunSig :: FunSig
- pairFunSig :: NoEqFunSig
- dhReducibleFunSig :: FunSig
- bpReducibleFunSig :: FunSig
- implicitFunSig :: FunSig
- class Sized a where
- data Term a
- data TermView a
- viewTerm :: Term a -> TermView a
- data TermView2 a
- viewTerm2 :: Show a => Term a -> TermView2 a
- termViewToTerm :: TermView a -> Term a
- data DiffType
- traverseTerm :: (Applicative f, Ord a, Ord b) => (a -> f b) -> Term a -> f (Term b)
- fmapTerm :: Ord b => (a -> b) -> Term a -> Term b
- bindTerm :: Ord b => Term a -> (a -> Term b) -> Term b
- lit :: a -> Term a
- fApp :: Ord a => FunSym -> [Term a] -> Term a
- fAppAC :: Ord a => ACSym -> [Term a] -> Term a
- fAppC :: Ord a => CSym -> [Term a] -> Term a
- fAppNoEq :: NoEqSym -> [Term a] -> Term a
- fAppList :: [Term a] -> Term a
- unsafefApp :: FunSym -> [Term a] -> Term a
Terms with constants and variables
A Lit is either a constant or a variable. (Const
is taken by Control.Applicative)
Instances
Apply BLTerm # | |
Apply LNTerm # | |
Monad (Lit c) # | Monad instance in the variable |
Functor (Lit c) # | Functor instance in the variable. |
Applicative (Lit c) # | Applicative instance in the variable. |
Foldable (Lit c) # | Foldable instance in the variable. |
Traversable (Lit c) # | Traversable instance in the variable. |
(Eq v, Eq c) => Eq (Lit c v) # | |
(Data v, Data c) => Data (Lit c v) # | |
(Ord v, Ord c) => Ord (Lit c v) # | |
(Show v, Show c) => Show (Lit c v) # | |
Generic (Lit c v) # | |
(Binary v, Binary c) => Binary (Lit c v) # | |
(NFData v, NFData c) => NFData (Lit c v) # | |
Sized (Lit c v) # | |
HasFrees v => HasFrees (Lit c v) # | |
type Rep (Lit c v) # | |
varsVTerm :: Ord v => VTerm c v -> [v] #
vars t
returns a duplicate-free list of variables that occur in t
.
occursVTerm :: Eq v => v -> VTerm c v -> Bool #
occurs v t
returns True
if v
occurs in t
constsVTerm :: IsConst c => VTerm c v -> [c] #
constsVTerm t
returns a duplicate-free list of constants that occur in t
.
Destructors
termVar' :: (Show c, Show v) => VTerm c v -> v #
Extract just the variable from a term that must be variable, throw an error if this fails.
Pretty printing and query functions.
prettyTerm :: (Document d, Show l) => (l -> d) -> Term l -> d #
Pretty print a term.
showFunSymName :: FunSym -> String #
Convert a function symbol to its name.
lits t
returns all literals that occur in term t
. List can contain duplicates.
Smart constructors
Destructors and classifiers
isNullaryPublicFunction :: Term a -> Bool #
True
iff the term is a nullary, public function.
isPrivateFunction :: Term a -> Bool #
getLeftTerm :: Term a -> Term a #
getRightTerm :: Term a -> Term a #
AC, C, and NonAC funcion symbols
Function symbols
AC function symbols.
C(ommutative) function symbols
Constructors
EMap |
A function symbol can be either Private (unknown to adversary) or Public.
Arguments
= (ByteString, (Int, Privacy)) | operator name, arity, private |
NoEq function symbols (with respect to the background theory).
Signatures
type NoEqFunSig = Set NoEqSym #
NoEq function signatures.
concrete symbols strings
Function symbols
concrete signatures
msetFunSig :: FunSig #
The signature for the multiset function symbols.
The signature for pairing.
Reducible function symbols for DH.
Reducible function symbols for BP.
Implicit function symbols.
Minimal complete definition
Terms
Instances
Foldable Term # | |
Apply BLTerm # | |
Apply LNTerm # | |
Eq a => Eq (Term a) # | |
Data a => Data (Term a) # | |
Ord a => Ord (Term a) # | |
Show a => Show (Term a) # | |
Generic (Term a) # | |
Binary a => Binary (Term a) # | |
NFData a => NFData (Term a) # | |
Sized a => Sized (Term a) # | |
(HasFrees l, Ord l) => HasFrees (Term l) # | |
type Rep (Term a) # | |
View on terms that corresponds to representation.
View on terms that distinguishes function application of builtin symbols like exp.
termViewToTerm :: TermView a -> Term a #
Return the term of the given TermView.
Diff Type
Standard function
traverseTerm :: (Applicative f, Ord a, Ord b) => (a -> f b) -> Term a -> f (Term b) #
Smart constructors
fApp :: Ord a => FunSym -> [Term a] -> Term a #
fApp fsym as
creates an application of fsym
to as
. The function
ensures that the resulting term is in AC-normal-form.
unsafefApp :: FunSym -> [Term a] -> Term a #
unsafefApp fsym as
creates an application of fsym
to as. The
caller has to ensure that the resulting term is in AC-normal-form.