Safe Haskell | None |
---|---|
Language | Haskell98 |
Unification for first order terms.
Copyright (c) 2003-2007, John Harrison. (See "LICENSE.txt" for details.)
- class (TermOf a ~ TermOf b) => Unify a b where
- unify_terms :: (IsTerm term, v ~ TVarOf term) => [(term, term)] -> StateT (Map v term) Failing ()
- unify_literals :: (IsLiteral lit1, HasApply atom1, atom1 ~ AtomOf lit1, term ~ TermOf atom1, JustLiteral lit2, HasApply atom2, atom2 ~ AtomOf lit2, term ~ TermOf atom2, Unify atom1 atom2, v ~ TVarOf term) => lit1 -> lit2 -> StateT (Map v term) Failing ()
- unify_atoms :: (JustApply atom1, term ~ TermOf atom1, JustApply atom2, term ~ TermOf atom2, v ~ TVarOf term, PredOf atom1 ~ PredOf atom2) => (atom1, atom2) -> StateT (Map v term) Failing ()
- unify_atoms_eq :: (HasEquate atom1, term ~ TermOf atom1, HasEquate atom2, term ~ TermOf atom2, PredOf atom1 ~ PredOf atom2, v ~ TVarOf term) => atom1 -> atom2 -> StateT (Map v term) Failing ()
- solve :: (IsTerm term, v ~ TVarOf term, f ~ FunOf term) => Map v term -> Map v term
- fullunify :: (IsTerm term, v ~ TVarOf term, f ~ FunOf term) => [(term, term)] -> Failing (Map v term)
- unify_and_apply :: (IsTerm term, v ~ TVarOf term, f ~ FunOf term) => [(term, term)] -> Failing [(term, term)]
- testUnif :: Test
Documentation
class (TermOf a ~ TermOf b) => Unify a b where Source
Main unification procedure.
unify_terms :: (IsTerm term, v ~ TVarOf term) => [(term, term)] -> StateT (Map v term) Failing () Source
unify_literals :: (IsLiteral lit1, HasApply atom1, atom1 ~ AtomOf lit1, term ~ TermOf atom1, JustLiteral lit2, HasApply atom2, atom2 ~ AtomOf lit2, term ~ TermOf atom2, Unify atom1 atom2, v ~ TVarOf term) => lit1 -> lit2 -> StateT (Map v term) Failing () Source
Unify literals, perhaps of different types, but sharing term and
variable type. Note that only one needs to be JustLiteral
, if
the unification succeeds the other must have been too, if it fails,
who cares.
unify_atoms :: (JustApply atom1, term ~ TermOf atom1, JustApply atom2, term ~ TermOf atom2, v ~ TVarOf term, PredOf atom1 ~ PredOf atom2) => (atom1, atom2) -> StateT (Map v term) Failing () Source
unify_atoms_eq :: (HasEquate atom1, term ~ TermOf atom1, HasEquate atom2, term ~ TermOf atom2, PredOf atom1 ~ PredOf atom2, v ~ TVarOf term) => atom1 -> atom2 -> StateT (Map v term) Failing () Source
solve :: (IsTerm term, v ~ TVarOf term, f ~ FunOf term) => Map v term -> Map v term Source
Solve to obtain a single instantiation.
fullunify :: (IsTerm term, v ~ TVarOf term, f ~ FunOf term) => [(term, term)] -> Failing (Map v term) Source
Unification reaching a final solved form (often this isn't needed).