public abstract class RelationalFormula extends java.lang.Object implements ClassicalFormula, QuantifiedFormula
| Constructor and Description |
|---|
RelationalFormula() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<RelationalFormula> |
allGroundInstances(java.util.Set<Constant> constants)
Computes all ground instances of this relational formula wrt.
|
java.util.Set<java.util.Map<Variable,Term<?>>> |
allSubstitutions(java.util.Collection<? extends Term<?>> terms)
Computes all possible substitutions, i.e.
|
abstract RelationalFormula |
clone()
Creates a deep copy of this formula
|
abstract Conjunction |
combineWithAnd(Conjuctable formula)
Returns a conjunction of this and the given formula.
|
abstract Disjunction |
combineWithOr(Disjunctable formula) |
abstract RelationalFormula |
complement() |
<C extends Term<?>> |
containsTermsOfType(java.lang.Class<C> cls)
Checks if this logical structure contains at least one term of type C.
|
RelationalFormula |
exchange(Term<?> v,
Term<?> t)
Substitutes all occurrences of term "v" in this formula
by term "t" and at the same time replaces all occurrences of term "t"
by term "v" and eventually returns the new formula.
|
abstract java.util.Set<FOLAtom> |
getAtoms()
Processes the set of all atoms which appear in this formula
|
RelationalFormula |
getFormula() |
abstract java.util.Set<Functor> |
getFunctors() |
java.lang.Class<Predicate> |
getPredicateCls() |
double |
getSatisfactionRatio()
Returns the ratio of worlds not satisfying this formula to
worlds satisfying this formula.
|
FolSignature |
getSignature()
Returns the signature of the language of this formula.
|
abstract Probability |
getUniformProbability() |
boolean |
isGround()
Checks whether this formula is ground, i.e.
|
boolean |
isWellFormed()
Tests whether this formula is well-formed, i.e.
|
RelationalFormula |
substitute(java.util.Map<? extends Term<?>,? extends Term<?>> map)
Substitutes all occurrences of all terms "v" in map.keyset() in this formula
by map.get(v) and returns the new formula.
NOTE: variables bound to quantifiers are not substituted in their inner formulas even if they appear in the map. |
abstract RelationalFormula |
substitute(Term<?> v,
Term<?> t)
Substitutes all occurrences of term "v" in this formula
by term "t" and returns the new formula.
|
abstract java.lang.String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontainsQuantifier, getQuantifierVariables, getUnboundVariables, isClosed, isClosed, isWellBound, isWellBoundequals, getPredicates, hashCode, isLiteralgetTerms, getTermspublic java.lang.Class<Predicate> getPredicateCls()
getPredicateCls in interface SimpleLogicalFormulapublic RelationalFormula getFormula()
getFormula in interface QuantifiedFormulapublic abstract java.util.Set<FOLAtom> getAtoms()
SimpleLogicalFormulagetAtoms in interface SimpleLogicalFormulapublic abstract java.util.Set<Functor> getFunctors()
public abstract RelationalFormula substitute(Term<?> v, Term<?> t) throws java.lang.IllegalArgumentException
substitute in interface ComplexLogicalFormulav - the term to be substituted.t - the term to substitute.java.lang.IllegalArgumentException - if "v" and "t" are of different sorts
(NOTE: this exception is only thrown when "v" actually appears in this
formula).public RelationalFormula exchange(Term<?> v, Term<?> t) throws java.lang.IllegalArgumentException
exchange in interface ComplexLogicalFormulav - a term.t - a term.java.lang.IllegalArgumentException - if "v" and "t" are of different sortspublic RelationalFormula substitute(java.util.Map<? extends Term<?>,? extends Term<?>> map) throws java.lang.IllegalArgumentException
substitute in interface ComplexLogicalFormulamap - a mapping defining which terms to be substituted.java.lang.IllegalArgumentException - if any term and its mapping are of different sorts
(NOTE: this exception is only thrown when the variable actually appears in this
formula).public java.util.Set<java.util.Map<Variable,Term<?>>> allSubstitutions(java.util.Collection<? extends Term<?>> terms) throws java.lang.IllegalArgumentException
terms - a set of terms.java.lang.IllegalArgumentException - if there is an unbound variable in this formula for
which there is no term in "terms" with the same sort.public java.util.Set<RelationalFormula> allGroundInstances(java.util.Set<Constant> constants) throws java.lang.IllegalArgumentException
constants - a set of constantsjava.lang.IllegalArgumentException - if there is an unbound variable in this formula for
which there is no constant in "constants" with the same sort.public double getSatisfactionRatio()
public abstract Probability getUniformProbability()
getUniformProbability in interface ProbabilityAwarepublic boolean isGround()
isGround in interface ComplexLogicalFormulapublic boolean isWellFormed()
isWellFormed in interface ComplexLogicalFormulapublic FolSignature getSignature()
FormulagetSignature in interface Formulapublic <C extends Term<?>> boolean containsTermsOfType(java.lang.Class<C> cls)
LogicStructurecontainsTermsOfType in interface LogicStructurecls - The class structure representing the type C of the term.public abstract RelationalFormula complement()
complement in interface Invertablepublic abstract Disjunction combineWithOr(Disjunctable formula)
combineWithOr in interface Disjunctableformula - a formula to be combined with OR and this.public abstract Conjunction combineWithAnd(Conjuctable formula)
ConjuctablecombineWithAnd in interface Conjuctableformula - a formula to be combined with AND and this.public abstract java.lang.String toString()
toString in class java.lang.Objectpublic abstract RelationalFormula clone()
SimpleLogicalFormulaclone in interface ComplexLogicalFormulaclone in interface SimpleLogicalFormulaclone in class java.lang.Object