|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectai.krr.fol.Sentence
ai.krr.fol.TruthValue
public final class TruthValue
A TruthValue is one of the most basic building blocks for a Sentence. It simply consists of a BooleanSymbol.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ai.krr.fol.Sentence |
---|
Sentence.SubSentenceIterator |
Field Summary | |
---|---|
static TruthValue |
FALSE
the TruthValue for FALSE |
protected BooleanSymbol |
theSy
the BooleanSymbol representing the TruthValue |
static TruthValue |
TRUE
the TruthValue for TRUE |
Method Summary | |
---|---|
protected void |
addBoundVariables(java.util.Set<Variable> bound)
This function adds the bound Variables in this Sentence to the given Set. |
protected void |
addConstants(java.util.Set<Symbol> sys)
This function adds all the constant Symbols used in this Sentence to the given Set. |
protected void |
addFreeVariables(java.util.Set<Variable> free,
java.util.Set<Variable> bound)
This function adds the free Variables in this Sentence to the first given Set. |
protected void |
addFunctions(java.util.Map<Symbol,java.lang.Integer> sys)
This function adds all the function Symbols used in this Sentence to the given Set. |
protected void |
addPredicates(java.util.Map<NamedSymbol,java.lang.Integer> sys)
This function adds all the predicate Symbols used in this Sentence to the given Set. |
boolean |
booleanValue()
This function returns the boolean value of the BooleanSymbol that represents this TruthValue. |
TruthValue |
clone()
Cloning a TruthValue returns this Object. |
TruthValue |
clone(Substitution s)
Cloning a TruthValue returns this Object. |
int |
compareTo(Sentence stmt)
This function compares this Sentence to the given Sentence. |
int |
compareTo(TruthValue other)
This function compares this TruthValue to the given TruthValue. |
BooleanSymbol |
evaluate(Interpretation ipt,
Substitution s)
This function evaluates this Sentence under the given Interpretation and Substitution for Variables. |
boolean |
exceedsDepth(int depth)
This function tests whether this Sentence exceeds the given depth which should be a non-negative integer. |
int |
getClassOrderIndex()
This function returns the index used for ordering Sentences across different classes. |
int |
getDepth()
This function returns the nesting depth of this Sentence. |
BooleanSymbol |
getSymbol()
This function returns the Symbol that represents this TruthValue. |
int |
hashCode()
This function returns the hash code of this TruthValue. |
protected Sentence |
skolemize(boolean isNegated,
Term[] uqVars,
Substitution s)
This function computes a skolemized version of this Sentence. |
protected Sentence |
toCNF(boolean isNegated)
This function returns a new TruthValue which contains the same BooleanSymbol or its negation, depending on the given boolean. |
protected Sentence |
toDNF(boolean isNegated)
This function returns a new TruthValue which contains the same BooleanSymbol or its negation, depending on the given boolean. |
java.lang.String |
toString()
A TruthValue is printed as the contained symbol. |
Methods inherited from class ai.krr.fol.Sentence |
---|
allSubSentences, getBoundVariables, getConstants, getFreeVariables, getFunctions, getPredicates, prettyPrint, read, skolemize, toClauseForm, toCNF, toDNF, write |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final TruthValue FALSE
public static final TruthValue TRUE
protected final BooleanSymbol theSy
Method Detail |
---|
public final TruthValue clone()
Cloning a TruthValue returns this Object.
clone
in class Sentence
public final TruthValue clone(Substitution s)
Cloning a TruthValue returns this Object. The given Substitution is ignored.
clone
in class Sentence
s
- the Substitution that tells us how to replace Variables
public final int getDepth()
This function returns the nesting depth of this Sentence. The depth of a TruthValue is defined to be 0.
getDepth
in class Sentence
public final boolean exceedsDepth(int depth)
This function tests whether this Sentence exceeds the given depth which should be a non-negative integer.
exceedsDepth
in class Sentence
depth
- the depth value that is tested for
public final int getClassOrderIndex()
This function returns the index used for ordering Sentences across different classes. This index of this class is defined to be 0.
getClassOrderIndex
in class Sentence
public int compareTo(Sentence stmt)
This function compares this Sentence to the given Sentence. The order between different kinds of Sentence is arbitrarily defined as (ascending): Atom, Literal, NegatedSentence, ConnectedSentence, BinaryConnectedSentence, QuantifiedSentence.
compareTo
in interface java.lang.Comparable<Sentence>
compareTo
in class Sentence
stmt
- the Sentence to which this Sentence is to be compared
public BooleanSymbol evaluate(Interpretation ipt, Substitution s)
This function evaluates this Sentence under the given Interpretation and Substitution for Variables. Note that the given Substitution must ground all the free Variables occurring in this Sentence. If this Sentence is already ground the given Substitution may be null. If all Atoms and Terms occurring in the Sentence have a value assigned by the Interpretation the result will be a BooleanSymbol. Otherwise it will be null.
evaluate
in class Sentence
ipt
- the Interpretation giving values for Atoms and Termss
- the Substitution for Variables occurring in this Term
public final BooleanSymbol getSymbol()
This function returns the Symbol that represents this TruthValue.
public int compareTo(TruthValue other)
This function compares this TruthValue to the given TruthValue. The order between TruthValues is defined by the order of the BooleanSymbols they contain.
other
- the TruthValue to which this TruthValue is to be compared
public final boolean booleanValue()
This function returns the boolean value of the BooleanSymbol that represents this TruthValue.
protected final void addConstants(java.util.Set<Symbol> sys)
This function adds all the constant Symbols used in this Sentence to the given Set.
addConstants
in class Sentence
sys
- the Set that will contain all the Constantsprotected final void addFunctions(java.util.Map<Symbol,java.lang.Integer> sys)
This function adds all the function Symbols used in this Sentence to the given Set.
addFunctions
in class Sentence
sys
- the Set that will contain all the function namesprotected final void addPredicates(java.util.Map<NamedSymbol,java.lang.Integer> sys)
This function adds all the predicate Symbols used in this Sentence to the given Set.
addPredicates
in class Sentence
sys
- the Set that will contain all the predicate namesprotected final void addFreeVariables(java.util.Set<Variable> free, java.util.Set<Variable> bound)
This function adds the free Variables in this Sentence to the first given Set. Variables in the second given Set are bound and will not be added.
addFreeVariables
in class Sentence
free
- a Set of free Variables that will be extendedbound
- a Set of bound Variablesprotected final void addBoundVariables(java.util.Set<Variable> bound)
This function adds the bound Variables in this Sentence to the given Set. This implementation does not modify the given Set.
addBoundVariables
in class Sentence
bound
- a Set of bound Variables that will be extendedprotected Sentence skolemize(boolean isNegated, Term[] uqVars, Substitution s)
This function computes a skolemized version of this Sentence. The given Variables and Substitution will be ignored. Only the negation is worked into this Sentence.
skolemize
in class Sentence
isNegated
- whether the Sentence is negateduqVars
- the known universally quantified Variables at this points
- the Substitution for Variable replacements
protected Sentence toCNF(boolean isNegated)
This function returns a new TruthValue which contains the same BooleanSymbol or its negation, depending on the given boolean.
toCNF
in class Sentence
isNegated
- whether the TruthValue has to be negated
protected Sentence toDNF(boolean isNegated)
This function returns a new TruthValue which contains the same BooleanSymbol or its negation, depending on the given boolean.
toDNF
in class Sentence
isNegated
- whether the TruthValue has to be negated
public java.lang.String toString()
A TruthValue is printed as the contained symbol.
toString
in class java.lang.Object
public final int hashCode()
This function returns the hash code of this TruthValue.
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |