32#include "Substitution.hpp"
45using UPair = pair<Term* ,Term*>;
50enum class UnificationOutcome {Succeed, ConflictFail, OccursFail};
55ostream& operator<<(ostream&,
const UnificationOutcome&);
150 UnificationOutcome
operator()(
const vector<Term*>&,
151 const vector<Term*>&);
169 if (params::poly_unification) {
172 for (
size_t i = 0; i <
s; i++) {
173 to_do.push_back(UPair(l1[i], l2[i]));
180 UnificationOutcome outcome =
unify_terms(term1, *i);
181 if (outcome != UnificationOutcome::Succeed) {
187 return UnificationOutcome::Succeed;
204 friend ostream& operator<<(ostream&,
const Unifier&);
Basic representation of literals, bundling together (pointers to) a Predicate, a collection of argume...
const vector< Term * > & get_args() const
Basic get method.
Arity get_arity() const
Basic get method.
General representation of a substitution.
string to_string(bool=false) const
Make a string representation.
General representation of terms.
Wrap up various applications of unificiation into a single class: all the unification you need to do ...
void backtrack()
Apply the backtracking process to the substitution that has been constructed.
UnificationOutcome unify(Term *, Term *)
Implementation of unification for a pair of Terms.
string to_string(bool subbed=false) const
Make a nice string representation.
UnificationOutcome operator()(const Literal &l1, const Literal &l2)
Substitution get_substitution() const
Trivial get methods for the result.
UnificationOutcome operator()(Term *, Term *)
Implementation of unification for a pair of Terms.
Unifier()
There isn't really much to initialize.
Unifier(const Unifier &)=delete
You really only need one Unifier!
vector< UPair > to_do
Queue used by complete_unification method.
UnificationOutcome unify_terms(Term *, Term *)
Main method implementing the traditional unification algorithm.
UnificationOutcome complete_unification()
Implementation of unification: for the polynomial-time approach. All the real work happens here.
Substitution s
Build the resulting substitution here.