|
||||||||||
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.ConnectedSentence
ai.krr.fol.BinaryConnectedSentence
public class BinaryConnectedSentence
This class represents a Sentence that consists of a Connective that connects two sub-Sentences. The Connective that may be given to the public constructor must be IMPLIES, IFF or XOR. ConnectedSentences based on AND or OR must be constructed as ConnectedSentences.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ai.krr.fol.ConnectedSentence |
---|
ConnectedSentence.Connective |
Nested classes/interfaces inherited from class ai.krr.fol.Sentence |
---|
Sentence.SubSentenceIterator |
Field Summary |
---|
Fields inherited from class ai.krr.fol.ConnectedSentence |
---|
connective, sentences |
Constructor Summary | |
---|---|
BinaryConnectedSentence(Sentence lhs,
ConnectedSentence.Connective connective,
Sentence rhs)
This constructor for a BinaryConnectedSentence takes a Connective and two Sentences which are the Sentences that are connected by the given connective. |
Method Summary | |
---|---|
BinaryConnectedSentence |
clone()
This function generates a deep copy of this BinaryConnectedSentence. |
BinaryConnectedSentence |
clone(Substitution s)
Returns a copy of this Sentence with Variables replaced according to the given Substitution. |
int |
compareTo(ConnectedSentence other)
This function compares this BinaryConnectedSentence to the given ConnectedSentence. |
boolean |
equals(ConnectedSentence other)
This function tests whether this and the given Object are equal. |
BooleanSymbol |
evaluate(Interpretation ipt,
Substitution s)
This function evaluates this Sentence under the given Interpretation. |
boolean |
exceedsDepth(int depth)
This function tests whether this Sentence exceeds the given depth which should be a non-negative integer. |
int |
getDepth()
This function returns the nesting depth of this Sentence. |
Sentence |
getLeftHandSide()
This function returns the left-hand side sub-Sentence of this BinaryConnectedSentence. |
Sentence |
getRightHandSide()
This function returns the right-hand side sub-Sentence of this BinaryConnectedSentence. |
int |
hashCode()
This function returns the hash code of this ConnectedSentence. |
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 Sentence which is the CNF of this Sentence. |
protected Sentence |
toDNF(boolean isNegated)
This function returns a new Sentence which is the DNF of this Sentence. |
Methods inherited from class ai.krr.fol.ConnectedSentence |
---|
addBoundVariables, addConstants, addFreeVariables, addFunctions, addPredicates, compareTo, equals, getClassOrderIndex, getConnective, getSubSentences, isConjunction, isDisjunction, multiplyS, toString |
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 |
Constructor Detail |
---|
public BinaryConnectedSentence(Sentence lhs, ConnectedSentence.Connective connective, Sentence rhs)
This constructor for a BinaryConnectedSentence takes a Connective and two Sentences which are the Sentences that are connected by the given connective. The first Sentence is taken to be the left hand side where that matters. The connective should be IMPLIES, IFF or XOR.
lhs
- the left hand side sub-Sentenceconnective
- the connective (e.g. Connective.AND)rhs
- the right hand side sub-SentenceMethod Detail |
---|
public BinaryConnectedSentence clone()
This function generates a deep copy of this BinaryConnectedSentence. The copy will contain the same Symbols as the original.
clone
in class ConnectedSentence
public BinaryConnectedSentence clone(Substitution s)
Returns a copy of this Sentence 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 ConnectedSentence
s
- the Substitution that tells us how to replace Variables
public int getDepth()
This function returns the nesting depth of this Sentence. The depth of a implication is the maximum depth of the sub-Sentences plus 1. The depth of a co-implication or exclusive disjunction is the maximum depth of the sub-Sentences plus 2.
getDepth
in class ConnectedSentence
public boolean exceedsDepth(int depth)
This function tests whether this Sentence exceeds the given depth which should be a non-negative integer.
exceedsDepth
in class ConnectedSentence
depth
- the depth value that is tested for
public BooleanSymbol evaluate(Interpretation ipt, Substitution s)
This function evaluates this Sentence under the given Interpretation. If all propositions occurring in the Sentence have a truth value assigned by the Interpretation the result will be either BooleanSymbol.TRUE or BooleanSymbol.FALSE. Otherwise the result may be null, indicating the truth value of this Sentence is undefined under the given Interpretation. For a BinaryConnectedSentence the returned truth value depends on the connective. It will be BooleanSymbol.TRUE iff:
evaluate
in class ConnectedSentence
ipt
- the Interpretation giving truth values for propositionss
- the Substitution for Variables occurring in this Term
public Sentence getLeftHandSide()
This function returns the left-hand side sub-Sentence of this BinaryConnectedSentence. This could be for example, the premise of an implication.
public Sentence getRightHandSide()
This function returns the right-hand side sub-Sentence of this BinaryConnectedSentence. This could be for example, the conclusion of an implication.
public int compareTo(ConnectedSentence other)
This function compares this BinaryConnectedSentence to the given ConnectedSentence. The order between ConnectedSentences is primarily defined by the order of the Connectives they contain. If they use the same connective a lexical ordering is used, i.e. first the first sub-Sentences are compared. If they are different this determines the overall result, otherwise the second sub-Sentences are compared, etc.
compareTo
in class ConnectedSentence
other
- the ConnectedSentence to which this BinaryConnectedSentence
is to be compared
protected 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 ConnectedSentence
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 Sentence which is the CNF of this Sentence. The given boolean indicates whether the Sentence is to be treated as negated at this point.
toCNF
in class ConnectedSentence
isNegated
- whether the Sentence is negated
protected Sentence toDNF(boolean isNegated)
This function returns a new Sentence which is the DNF of this Sentence. The given boolean indicates whether the Sentence is to be treated as negated at this point.
toDNF
in class ConnectedSentence
isNegated
- whether the Sentence is negated
public boolean equals(ConnectedSentence other)
This function tests whether this and the given Object are equal. In general, two ConnectedSentences are equal if they have the same connective and all the sub-Sentences are in the same order and equal.
equals
in class ConnectedSentence
other
- the Sentence this one is to be compared to
public int hashCode()
This function returns the hash code of this ConnectedSentence.
hashCode
in class ConnectedSentence
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |