|
||||||||||
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.NegatedSentence
public class NegatedSentence
A NegatedSentence is the simplest kind of complex Sentence. It simply contains the Sentence that is negated. Note that a negated Atom can also be represented as a Literal, but a negative Literal is not equal to a negated sentence containing the same Atom.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ai.krr.fol.Sentence |
---|
Sentence.SubSentenceIterator |
Field Summary | |
---|---|
protected Sentence |
contained
the contained Sentence that is negated |
Constructor Summary | |
---|---|
NegatedSentence(Sentence stmt)
This constructor for a NegatedSentence simply takes the Sentence that is negated. |
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. |
NegatedSentence |
clone()
Cloning a NegatedSentence returns a new NegatedSentence containing the same contained Sentence. |
NegatedSentence |
clone(Substitution s)
Returns a deep copy of this NegatedSentence with Variables replaced according to the given Substitution. |
int |
compareTo(NegatedSentence other)
This function compares this NegatedSentence to the given NegatedSentence. |
int |
compareTo(Sentence other)
This function compares this Sentence to the given Sentence. |
boolean |
equals(NegatedSentence other)
A NegatedSentence is equal to another NegatedSentence that contains an equal Sentence. |
boolean |
equals(java.lang.Object obj)
A NegatedSentence is equal to another NegatedSentence that contains an equal Sentence. |
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. |
Sentence |
getContainedSentence()
This function returns the Sentence that is contained in this NegatedSentence. |
int |
getDepth()
This function returns the nesting depth of this Sentence. |
int |
hashCode()
This function returns the hash code of this NegatedSentence. |
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 Literal which contains the proposition contained in this Atom. |
protected Sentence |
toDNF(boolean isNegated)
This function returns a new Literal which contains the proposition contained in this Atom. |
java.lang.String |
toString()
A NegatedSentence is printed as the tilde symbol '~' followed by the contained Sentence. |
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 |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Sentence contained
Constructor Detail |
---|
public NegatedSentence(Sentence stmt)
This constructor for a NegatedSentence simply takes the Sentence that is negated. The given Sentence must not be null.
stmt
- the negated SentenceMethod Detail |
---|
public final NegatedSentence clone()
Cloning a NegatedSentence returns a new NegatedSentence containing the same contained Sentence.
clone
in class Sentence
public NegatedSentence clone(Substitution s)
Returns a deep copy of this NegatedSentence with Variables replaced according to the given Substitution. Symbols in the copy will be the same as the original ones but Variables will be replaced by the respective Terms in the given Substitution. A Variable not occurring in the Substitution will be replaced by a new (different) Variable with the same name. The given Substitution will be extended to include the mappings of old Variables to new ones.
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 negated sentence is the depth of the contained Sentence plus one.
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 3.
getClassOrderIndex
in class Sentence
public int compareTo(Sentence other)
This function compares this Sentence to the given Sentence. The order between different kinds of Sentence is arbitrarily defined as (ascending): TruthValue, Atom, Literal, NegatedSentence, ConnectedSentence, BinaryConnectedSentence, QuantifiedSentence.
compareTo
in interface java.lang.Comparable<Sentence>
compareTo
in class Sentence
other
- 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 Sentence getContainedSentence()
This function returns the Sentence that is contained in this NegatedSentence.
public int compareTo(NegatedSentence other)
This function compares this NegatedSentence to the given NegatedSentence. The order between NegatedSentences is defined by the order of the Sentences they contain.
other
- the Sentence to which this Sentence is to be compared
protected 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 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 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 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 void addBoundVariables(java.util.Set<Variable> bound)
This function adds the bound Variables in this Sentence to 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. It replaces all the existentially quantified variables in this Sentence by appropriate Skolem constants and functions. It all so removes all quantification from this sentence meaning that all remaining Variables are implicitly universally quantified. The given boolean determines whether this sub-Sentence is negated, which is necessary to determine the effective type of quantifier in a QuantifiedSentence. The given Term must all be Variables and represent all the universally quantified Variables at this point. These will be arguments to a potentially introduced Skolem function. Finally, the given Substitution must store mappings from existentially quantified Variables to Skolem Terms.
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 Literal which contains the proposition contained in this Atom. The given boolean indicates whether the new Literal is to be negated.
toCNF
in class Sentence
isNegated
- whether the Literal has to be negated
protected Sentence toDNF(boolean isNegated)
This function returns a new Literal which contains the proposition contained in this Atom. The given boolean indicates whether the new Literal is to be negated.
toDNF
in class Sentence
isNegated
- whether the Literal has to be negated
public java.lang.String toString()
A NegatedSentence is printed as the tilde symbol '~' followed by the contained Sentence.
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
A NegatedSentence is equal to another NegatedSentence that contains an equal Sentence.
equals
in class java.lang.Object
obj
- the Object this NegatedSentence is compared to
public boolean equals(NegatedSentence other)
A NegatedSentence is equal to another NegatedSentence that contains an equal Sentence.
other
- the NegatedSentence this NegatedSentence is compared to
public int hashCode()
This function returns the hash code of this NegatedSentence.
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |