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 Disjunctable |
combineWithAnd(Conjuctable f)
Returns a conjunction of this and the given formula.
|
abstract Conjuctable |
combineWithOr(Disjunctable f) |
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<? extends Atom> |
getAtoms()
Processes the set of all atoms which appear in this formula
|
RelationalFormula |
getFormula() |
abstract java.util.Set<Functor> |
getFunctors() |
java.lang.Class<? extends Predicate> |
getPredicateCls() |
double |
getSatisfactionRatio()
Returns the ratio of worlds not satisfying this formula to
worlds satisfying this formula.
|
abstract Signature |
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, wait
containsQuantifier, getQuantifierVariables, getUnboundVariables, isClosed, isClosed, isWellBound, isWellBound
equals, getPredicates, hashCode, isLiteral
getTerms, getTerms
public RelationalFormula getFormula()
getFormula
in interface QuantifiedFormula
public abstract java.util.Set<? extends Atom> getAtoms()
SimpleLogicalFormula
getAtoms
in interface SimpleLogicalFormula
public abstract java.util.Set<Functor> getFunctors()
public java.lang.Class<? extends Predicate> getPredicateCls()
getPredicateCls
in interface SimpleLogicalFormula
public abstract RelationalFormula substitute(Term<?> v, Term<?> t) throws java.lang.IllegalArgumentException
substitute
in interface ComplexLogicalFormula
v
- 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 substitute(java.util.Map<? extends Term<?>,? extends Term<?>> map) throws java.lang.IllegalArgumentException
substitute
in interface ComplexLogicalFormula
map
- 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 RelationalFormula exchange(Term<?> v, Term<?> t) throws java.lang.IllegalArgumentException
exchange
in interface ComplexLogicalFormula
v
- a term.t
- a term.java.lang.IllegalArgumentException
- if "v" and "t" are of different sortspublic 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 ProbabilityAware
public boolean isGround()
isGround
in interface ComplexLogicalFormula
public boolean isWellFormed()
isWellFormed
in interface ComplexLogicalFormula
public abstract Signature getSignature()
Formula
getSignature
in interface Formula
public <C extends Term<?>> boolean containsTermsOfType(java.lang.Class<C> cls)
LogicStructure
containsTermsOfType
in interface LogicStructure
cls
- The class structure representing the type C of the term.public abstract RelationalFormula complement()
complement
in interface Invertable
public abstract Conjuctable combineWithOr(Disjunctable f)
combineWithOr
in interface Disjunctable
f
- a formula to be combined with OR and this.public abstract Disjunctable combineWithAnd(Conjuctable f)
Conjuctable
combineWithAnd
in interface Conjuctable
f
- a formula to be combined with AND and this.public abstract java.lang.String toString()
toString
in class java.lang.Object
public abstract RelationalFormula clone()
SimpleLogicalFormula
clone
in interface ComplexLogicalFormula
clone
in interface SimpleLogicalFormula
clone
in class java.lang.Object