Package net.sf.tweety.logics.pl.syntax
Class SpecialFormula
- java.lang.Object
-
- net.sf.tweety.logics.pl.syntax.PlFormula
-
- net.sf.tweety.logics.pl.syntax.SpecialFormula
-
- All Implemented Interfaces:
net.sf.tweety.commons.Formula,net.sf.tweety.logics.commons.syntax.interfaces.ClassicalFormula,net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable,net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable,net.sf.tweety.logics.commons.syntax.interfaces.Invertable,net.sf.tweety.logics.commons.syntax.interfaces.ProbabilityAware,net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
- Direct Known Subclasses:
Contradiction,Tautology
public abstract class SpecialFormula extends PlFormula
This class captures the common functionalities of the special formulas tautology and contradiction.- Author:
- Matthias Thimm
-
-
Constructor Summary
Constructors Constructor Description SpecialFormula()
-
Method Summary
Modifier and Type Method Description PlFormulacollapseAssociativeFormulas()This method collapses all associative operations appearing in this term, e.g.Set<Proposition>getAtoms()Set<PlFormula>getLiterals()Returns all literals, i.e.Set<PlPredicate>getPredicates()intnumberOfOccurrences(Proposition p)Returns the number of occurrences of the given proposition within this formulaPlFormulareplace(Proposition p, PlFormula f, int i)Replaces the ith instance of the proposition p by f.ConjunctiontoCnf()This method returns this formula in conjunctive normal form (CNF).PlFormulatoNnf()This method returns this formula in negation normal form (NNF).PlFormulatrim()Removes duplicates (identical formulas) from conjunctions and disjunctions and removes duplicate negations.-
Methods inherited from class net.sf.tweety.logics.pl.syntax.PlFormula
clone, combineWithAnd, combineWithOr, complement, equals, getModels, getModels, getPredicateCls, getPrimeImplicants, getSignature, getUniformProbability, hashCode, isClause, isConjunctiveClause, isLiteral, resolvableWith, resolveWith, toBlakeCanonicalForm, toDnf
-
-
-
-
Method Detail
-
collapseAssociativeFormulas
public PlFormula collapseAssociativeFormulas()
Description copied from class:PlFormulaThis method collapses all associative operations appearing in this term, e.g. every a||(b||c) becomes a||b||c.- Specified by:
collapseAssociativeFormulasin classPlFormula- Returns:
- the collapsed formula.
-
getPredicates
public Set<PlPredicate> getPredicates()
- Specified by:
getPredicatesin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Specified by:
getPredicatesin classPlFormula
-
toNnf
public PlFormula toNnf()
Description copied from class:PlFormulaThis method returns this formula in negation normal form (NNF). A formula is in NNF iff negations occur only directly in front of a proposition.
-
getAtoms
public Set<Proposition> getAtoms()
-
getLiterals
public Set<PlFormula> getLiterals()
Description copied from class:PlFormulaReturns all literals, i.e. all formulas of the form "a" or "!a" where "a" is a proposition, that appear in this formula.- Specified by:
getLiteralsin classPlFormula- Returns:
- all literals appearing in this formula.
-
toCnf
public Conjunction toCnf()
Description copied from class:PlFormulaThis method returns this formula in conjunctive normal form (CNF). A formula is in CNF iff it is a conjunction of disjunctions and in NNF.
-
numberOfOccurrences
public int numberOfOccurrences(Proposition p)
Description copied from class:PlFormulaReturns the number of occurrences of the given proposition within this formula- Specified by:
numberOfOccurrencesin classPlFormula- Parameters:
p- some proposition- Returns:
- the number of occurrences of the given proposition within this formula
-
replace
public PlFormula replace(Proposition p, PlFormula f, int i)
Description copied from class:PlFormulaReplaces the ith instance of the proposition p by f.
-
-