ai.krr.fol
Class Instantiation

java.lang.Object
  extended by ai.krr.fol.Instantiation
All Implemented Interfaces:
Substitution

public class Instantiation
extends java.lang.Object
implements Substitution

An Instantiation maps a set of Variables to a set of Terms. The resulting mapping need not be one-to-one, i.e. several Variables may be mapped to the same Variable.

Author:
Gerhard Wickler

Constructor Summary
Instantiation()
           
 
Method Summary
 boolean contains(Variable var)
           This function tests whether this Substitution maps the given Variable to a new Term.
 Term getValue(Variable aVar)
           This function returns the Term the given Variable is mapped to.
 int size()
           This function returns the number of variables bound by this Grounding.
 boolean unify(Term aTerm, Variable aVar)
           This function attempts to extend this Substitution such that the given Variable (from the "right" expression) and the given Term (from the "left") are unified and returns whether this succeeded.
 boolean unify(Variable aVar, Term aTerm)
           This function attempts to extend this Substitution such that the given Variable (from the "left" expression) and the given Term (from the "right") are unified and returns whether this succeeded.
 boolean unify(Variable leftVar, Variable rightVar)
           This function attempts to extend this Substitution such that the given Variables will be unified and returns true if this was possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Instantiation

public Instantiation()
Method Detail

size

public int size()

This function returns the number of variables bound by this Grounding.

Returns:
the number of mappings in this Grounding

unify

public boolean unify(Variable aVar,
                     Term aTerm)

This function attempts to extend this Substitution such that the given Variable (from the "left" expression) and the given Term (from the "right") are unified and returns whether this succeeded. This can only succeed if the given Term is a Constant or a Variable.

Specified by:
unify in interface Substitution
Parameters:
aVar - the Variable the given Term is to be unified with
aTerm - the Term the given Variable will be mapped to
Returns:
whether successful extension of this Substitution was possible

unify

public boolean unify(Term aTerm,
                     Variable aVar)

This function attempts to extend this Substitution such that the given Variable (from the "right" expression) and the given Term (from the "left") are unified and returns whether this succeeded. This can only succeed if the given Term is a Variable.

Specified by:
unify in interface Substitution
Parameters:
aTerm - the Term the given Variable will be mapped to
aVar - the Variable the given Term is to be unified with
Returns:
whether successful extension of this Substitution was possible

unify

public boolean unify(Variable leftVar,
                     Variable rightVar)

This function attempts to extend this Substitution such that the given Variables will be unified and returns true if this was possible. Where this matters, the first variable is considered to come from the "left" expression and the second from the "right".

Specified by:
unify in interface Substitution
Parameters:
leftVar - a Variable to be associated with the other given Variable
rightVar - a Variable to be associated with the other given Variable
Returns:
whether successful extension of this Substitution was possible

contains

public boolean contains(Variable var)

This function tests whether this Substitution maps the given Variable to a new Term.

Specified by:
contains in interface Substitution
Parameters:
var - the Variable the Term is being sought for
Returns:
whether an associated Term exists in this Substitution

getValue

public Term getValue(Variable aVar)

This function returns the Term the given Variable is mapped to. More specifically, it returns:

The given Variable is assumed to occur in the left Term.

Specified by:
getValue in interface Substitution
Parameters:
aVar - the Variable the Term is being sought for
Returns:
the instantiated Term the given Variable is mapped to