6 #include "knowrob/Logger.h"
7 #include "knowrob/terms/Unifier.h"
8 #include "knowrob/formulas/Bottom.h"
9 #include "knowrob/terms/Function.h"
12 #define USE_OCCURS_CHECK
20 exists_(unify(t0, t1)) {
26 return unify(std::static_pointer_cast<Variable>(t1), t0);
28 switch (t0->termType()) {
30 return unify(std::static_pointer_cast<Variable>(t0), t1);
42 if (*p0->functor() != *p1->functor() ||
43 p0->arity() != p1->arity()) {
47 for (std::size_t i = 0; i < p0->arity(); ++i) {
48 if (!
unify(p0->arguments()[i], p1->arguments()[i])) {
61 #ifdef USE_OCCURS_CHECK
62 if (t->variables().find(
var->name()) != t->variables().end()) {
69 #ifdef USE_OCCURS_CHECK
87 t0_->variables().size() <
t1_->variables().size() ?
91 KB_WARN(
"something went wrong during unification.");
void set(const std::shared_ptr< Variable > &var, const TermPtr &term)
static const std::shared_ptr< Bottom > & get()
Unifier(const TermPtr &t0, const TermPtr &t1)
bool unify(const TermPtr &t0, const TermPtr &t1)
std::shared_ptr< Term > TermPtr
FirstOrderLiteralPtr applyBindings(const FirstOrderLiteralPtr &lit, const Bindings &bindings)