Package net.sf.tweety.logics.ml.syntax
Class MlFormula
- java.lang.Object
-
- net.sf.tweety.logics.commons.syntax.RelationalFormula
-
- net.sf.tweety.logics.fol.syntax.FolFormula
-
- net.sf.tweety.logics.ml.syntax.MlFormula
-
- All Implemented Interfaces:
Formula
,ClassicalFormula
,ComplexLogicalFormula
,Conjunctable
,Disjunctable
,Invertable
,LogicStructure
,ProbabilityAware
,QuantifiedFormula
,SimpleLogicalFormula
- Direct Known Subclasses:
Necessity
,Possibility
public abstract class MlFormula extends FolFormula
This class models a modal formula, i.e. it encapsulates an modal operator and a formula (either a modal formula or a FolFormula).- Author:
- Matthias Thimm
-
-
Constructor Summary
Constructors Constructor Description MlFormula(RelationalFormula formula)
-
Method Summary
Modifier and Type Method Description Conjunction
combineWithAnd(Conjunctable f)
Returns a conjunction of this and the given formula.Disjunction
combineWithOr(Disjunctable f)
RelationalFormula
complement()
boolean
containsModalityOperator()
Checks whether this formula contains a modal operator ("necessity" operator or "possibility" operator).boolean
containsQuantifier()
Checks whether this formula contains any quantification.boolean
equals(java.lang.Object obj)
java.util.Set<FolAtom>
getAtoms()
Processes the set of all atoms which appear in this formulaRelationalFormula
getFormula()
Returns the inner formula of this modal formula.java.util.Set<Functor>
getFunctors()
java.util.Set<? extends Predicate>
getPredicates()
Processes the set of all predicates which appear in this formulajava.util.Set<Variable>
getQuantifierVariables()
FolSignature
getSignature()
Returns the signature of the language of this formula.java.util.Set<Term<?>>
getTerms()
<C extends Term<?>>
java.util.Set<C>getTerms(java.lang.Class<C> cls)
Processes the set containing all terms of type C.java.util.Set<Variable>
getUnboundVariables()
Probability
getUniformProbability()
int
hashCode()
boolean
isClosed()
Checks whether this formula is closed, i.e.boolean
isClosed(java.util.Set<Variable> boundVariables)
Checks whether this formula is closed, i.e.boolean
isLiteral()
boolean
isWellBound()
Checks whether this formula is well-bound, i.e.boolean
isWellBound(java.util.Set<Variable> boundVariables)
Checks whether this formula is well-bound, i.e.-
Methods inherited from class net.sf.tweety.logics.fol.syntax.FolFormula
clone, collapseAssociativeFormulas, isDnf, substitute, toDnf, toNnf
-
Methods inherited from class net.sf.tweety.logics.commons.syntax.RelationalFormula
allGroundInstances, allSubstitutions, containsTermsOfType, exchange, getPredicateCls, getSatisfactionRatio, isGround, isWellFormed, substitute, toString
-
-
-
-
Constructor Detail
-
MlFormula
public MlFormula(RelationalFormula formula)
-
-
Method Detail
-
getSignature
public FolSignature getSignature()
Description copied from interface:Formula
Returns the signature of the language of this formula.- Specified by:
getSignature
in interfaceFormula
- Overrides:
getSignature
in classFolFormula
- Returns:
- the signature of the language of this formula.
-
getUniformProbability
public Probability getUniformProbability()
- Specified by:
getUniformProbability
in interfaceProbabilityAware
- Overrides:
getUniformProbability
in classFolFormula
- Returns:
- this formula's probability in the uniform distribution.
-
getFormula
public RelationalFormula getFormula()
Returns the inner formula of this modal formula.- Specified by:
getFormula
in interfaceQuantifiedFormula
- Overrides:
getFormula
in classRelationalFormula
- Returns:
- the inner formula of this modal formula.
-
getPredicates
public java.util.Set<? extends Predicate> getPredicates()
Description copied from interface:SimpleLogicalFormula
Processes the set of all predicates which appear in this formula- Returns:
- all predicates that appear in this formula
-
getFunctors
public java.util.Set<Functor> getFunctors()
- Specified by:
getFunctors
in classRelationalFormula
- Returns:
- all functors that appear in this formula.
-
getAtoms
public java.util.Set<FolAtom> getAtoms()
Description copied from interface:SimpleLogicalFormula
Processes the set of all atoms which appear in this formula- Specified by:
getAtoms
in interfaceSimpleLogicalFormula
- Specified by:
getAtoms
in classRelationalFormula
- Returns:
- all atoms that appear in this formula.
-
containsQuantifier
public boolean containsQuantifier()
Description copied from interface:QuantifiedFormula
Checks whether this formula contains any quantification.- Returns:
- "true" if this formula contains a quantification.
-
isClosed
public boolean isClosed()
Description copied from interface:QuantifiedFormula
Checks whether this formula is closed, i.e. whether every variables occurring in the formula is bound by a quantifier.- Returns:
- "true" if this formula is closed, "false" otherwise.
-
isClosed
public boolean isClosed(java.util.Set<Variable> boundVariables)
Description copied from interface:QuantifiedFormula
Checks whether this formula is closed, i.e. whether every variables occurring in the formula is bound by a quantifier. Every variable in "boundVariables" is already assumed to be bound.- Parameters:
boundVariables
- the variables assumed to be bound.- Returns:
- "true" if this formula is closed wrt. "boundVariables", "false" otherwise.
-
getUnboundVariables
public java.util.Set<Variable> getUnboundVariables()
- Returns:
- a set of of unbound variables
-
isWellBound
public boolean isWellBound()
Description copied from interface:QuantifiedFormula
Checks whether this formula is well-bound, i.e. whether no variable bound by a quantifier is again bound by another quantifier within the first quantifier's range.- Returns:
- "true" if this formula is well-bound, "false" otherwise.
-
isWellBound
public boolean isWellBound(java.util.Set<Variable> boundVariables)
Description copied from interface:QuantifiedFormula
Checks whether this formula is well-bound, i.e. whether no variable bound by a quantifier is again bound by another quantifier within the first quantifier range. Every variable in "boundVariables" is assumed to be bound already.- Parameters:
boundVariables
- the variables assumed to be bound.- Returns:
- "true" if this formula is well-bound, "false" otherwise.
-
combineWithAnd
public Conjunction combineWithAnd(Conjunctable f)
Description copied from interface:Conjunctable
Returns a conjunction of this and the given formula.- Specified by:
combineWithAnd
in interfaceConjunctable
- Overrides:
combineWithAnd
in classFolFormula
- Parameters:
f
- a formula to be combined with AND and this.- Returns:
- a conjunction of this and the given formula.
-
combineWithOr
public Disjunction combineWithOr(Disjunctable f)
- Specified by:
combineWithOr
in interfaceDisjunctable
- Overrides:
combineWithOr
in classFolFormula
- Parameters:
f
- a formula to be combined with OR and this.- Returns:
- a disjunction of this and the given formula.
-
complement
public RelationalFormula complement()
- Specified by:
complement
in interfaceInvertable
- Overrides:
complement
in classFolFormula
- Returns:
- the complement of this formula.
-
isLiteral
public boolean isLiteral()
- Returns:
- true if the formula represents a literal in the language or false otherwise
-
getTerms
public java.util.Set<Term<?>> getTerms()
- Returns:
- a set containing all terms of this logical structure
-
getTerms
public <C extends Term<?>> java.util.Set<C> getTerms(java.lang.Class<C> cls)
Description copied from interface:LogicStructure
Processes the set containing all terms of type C. This method uses the equals method of the given Class and therefore does not add terms which are sub classes of type C to the set.- Type Parameters:
C
- the type of terms- Parameters:
cls
- The Class structure containing type information about the searched term- Returns:
- A set containing all terms of type C of this logical structure
-
getQuantifierVariables
public java.util.Set<Variable> getQuantifierVariables()
- Specified by:
getQuantifierVariables
in interfaceQuantifiedFormula
- Overrides:
getQuantifierVariables
in classFolFormula
- Returns:
- a set containing all quantified variables
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceSimpleLogicalFormula
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfaceSimpleLogicalFormula
- Overrides:
equals
in classjava.lang.Object
-
containsModalityOperator
public boolean containsModalityOperator()
Checks whether this formula contains a modal operator ("necessity" operator or "possibility" operator).- Returns:
- true if formula contains modality, false otherwise
-
-