// checks that the atom has the form f(x) = t[x], // where f is a function symbol and t[x] is a term of x not containing f // 09/05/2002, Manchester bool Atom::isDefinition (Term& lhs, Term& rhs) const { TRACER ( "Atom::isDefinition" ); if ( ! isEquality() ) { return false; } // the atom is an equality Term l (args().head()); Term r (args().second()); if ( l.isvar() || r.isvar() ) { return false; } // l=r, both l and r are non-variables if ( r.defines(l) ) { lhs = l; rhs = r; return true; } if ( l.defines(r) ) { rhs = l; lhs = r; return true; } return false; } // Term* Atom::isDefinition
// return true if the atoms are x = y, P[x] and P[y] // 29/04/2002 Manchester bool Atom::predicateMonotonicity (Atom a1, Atom a2, Atom a3) { TRACER("Atom::predicateMonotonicity"); if ( ! a1.isEquality() ) return false; if ( a2.isEquality() ) return false; if ( a3.isEquality() ) return false; Term x (a1.args().head()); Term y (a1.args().second()); if ( ! x.isvar() || ! y.isvar() ) return false; Var vx = x.var(); Var vy = y.var(); // variables must be different if ( vx == vy ) return false; if ( a2.functor() != a3.functor() ) return false; return a2.args().equalUpTo (a3.args(),vx,vy); } // Atom::predicateMonotonicity