ai.krr.propositions
Class Interpretation

java.lang.Object
  extended by ai.krr.propositions.Interpretation

public class Interpretation
extends java.lang.Object

An Interpretation in the propositional logic is an assignment of truth values to propositional Atom. In the case of this implementation, this is a hash map from NamedSymbols to BooleanSymbols.

Author:
Gerhard Wickler

Nested Class Summary
static class Interpretation.InterpretationIterator
           
 
Field Summary
protected  java.util.HashMap<NamedSymbol,BooleanSymbol> values
          the Map contained in this Interpretation
 
Constructor Summary
Interpretation()
           This constructor creates a new, empty Interpretation.
 
Method Summary
 boolean assignsAll(Sentence stmt)
           This function tests whether all the NamedSymbols in the given Sentence are assigned a truth value by this Interpretation.
 Interpretation clone()
           This function creates a copy of this Interpretation.
 boolean equals(Interpretation ipt)
           This function compares this Interpretation to the given Interpretation.
 boolean equals(java.lang.Object obj)
           This function compares this Interpretation to the given Object.
 boolean falsifies(Sentence stmt)
           This function tests whether the given propositional Sentence evaluates to false under this Interpretation.
 BooleanSymbol getValue(NamedSymbol prop)
           This function retrieves a previously assigned truth value for the given propositional symbol from this Interpretation.
 int hashCode()
           This function returns the hash code of the contained Map.
 boolean satisfies(Sentence stmt)
           This function tests whether the given propositional Sentence evaluates to true under this Interpretation.
 void setValue(NamedSymbol prop, BooleanSymbol val)
           This function can be used assign the given truth value to the given NamedSymbol.
 java.lang.String toString()
           This function returns a printable representation of this Interpretation.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

values

protected java.util.HashMap<NamedSymbol,BooleanSymbol> values
the Map contained in this Interpretation

Constructor Detail

Interpretation

public Interpretation()

This constructor creates a new, empty Interpretation. Initially it contains no assignments of truth values to any NamedSymbols. Such assignment must be added using the function setValue(...).

Method Detail

clone

public Interpretation clone()

This function creates a copy of this Interpretation. The copy will contain the same NamedSymbols as the original, but modifications to their truth values will not effect each other.

Overrides:
clone in class java.lang.Object
Returns:
a semi-shallow copy of this Interpretation

setValue

public void setValue(NamedSymbol prop,
                     BooleanSymbol val)

This function can be used assign the given truth value to the given NamedSymbol. If the NamedSymbol had a previously assigned truth value in this Interpretation, this will be replaced. Neither the given the given NamedSymbol nor the truth value must not be null.

Parameters:
prop - the NamedSymbol representing a propositional Atom
val - the BooleanSymbol representing the truth value of this proposition

getValue

public BooleanSymbol getValue(NamedSymbol prop)

This function retrieves a previously assigned truth value for the given propositional symbol from this Interpretation. This function will return null if no assignment to the given NamedSymbol was made. The given NamedSymbol must not be null.

Parameters:
prop - the NamedSymbol for which the truth value is sought
Returns:
the truth value of the given symbol in this Interpretation or null if there was no assignment

satisfies

public boolean satisfies(Sentence stmt)

This function tests whether the given propositional Sentence evaluates to true under this Interpretation. Note that all NamedSymbols in the given Sentence should be assigned a truth value under this Interpretation.

Parameters:
stmt - the Sentence to be tested
Returns:
whether the given Sentence is satisfied by this Interpretation

falsifies

public boolean falsifies(Sentence stmt)

This function tests whether the given propositional Sentence evaluates to false under this Interpretation. Note that all NamedSymbols in the given Sentence should be assigned a truth value under this Interpretation.

Parameters:
stmt - the Sentence to be tested
Returns:
whether the given Sentence is falsified by this Interpretation

assignsAll

public boolean assignsAll(Sentence stmt)

This function tests whether all the NamedSymbols in the given Sentence are assigned a truth value by this Interpretation. If so, evaluating this Sentence under this Interpretation is guaranteed to succeed.

Parameters:
stmt - the Sentence to be tested
Returns:
true if all NamedSymbols are assigned a value here

toString

public java.lang.String toString()

This function returns a printable representation of this Interpretation.

Overrides:
toString in class java.lang.Object
Returns:
the String representing this Interpretation

equals

public boolean equals(java.lang.Object obj)

This function compares this Interpretation to the given Object. Interpretations can only be equal to other Interpretations.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the Object to compare this to
Returns:
true iff the given Object is an equal Interpretation

equals

public boolean equals(Interpretation ipt)

This function compares this Interpretation to the given Interpretation. Two Interpretations are equal if they contain the same NamedSymbols and assign the same truth values to each.

Parameters:
ipt - the Interpretation to compare this to
Returns:
whether the contained value assignments are equal

hashCode

public int hashCode()

This function returns the hash code of the contained Map.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash value of this Interpretation