Class Negation
java.lang.Object
org.tweetyproject.logics.pl.syntax.PlFormula
org.tweetyproject.logics.pl.syntax.Negation
- All Implemented Interfaces:
Formula
,ClassicalFormula
,Conjunctable
,Disjunctable
,Invertable
,ProbabilityAware
,SimpleLogicalFormula
This class models classical negation of propositional logic.
- Author:
- Matthias Thimm, Tim Janus
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates a deep copy of this formulaThis method collapses all associative operations appearing in this term, e.g.boolean
getAtoms()
Processes the set of all atoms which appear in this formulaReturns the formula within this negation.Returns all literals, i.e.getModels
(PlSignature sig) Returns the set of models of this formula wrt.Processes the set of all predicates which appear in this formulaReturns the signature of the language of this formula.int
hashCode()
boolean
hasLowerBindingPriority
(PlFormula other) boolean
int
Returns the number of occurrences of the given proposition within this formulareplace
(Proposition p, PlFormula f, int i) Replaces the ith instance of the proposition p by f.toCnf()
This method returns this formula in conjunctive normal form (CNF).toNnf()
This method returns this formula in negation normal form (NNF).toString()
trim()
Removes duplicates (identical formulas) from conjunctions and disjunctions and removes duplicate negations.Methods inherited from class org.tweetyproject.logics.pl.syntax.PlFormula
combineWithAnd, combineWithOr, complement, getModels, getPredicateCls, getPrimeImplicants, getUniformProbability, isClause, isConjunctiveClause, resolvableWith, resolveWith, toBlakeCanonicalForm, toDnf
-
Constructor Details
-
Negation
Creates a new negation with the given formula.- Parameters:
formula
- the formula within the negation.
-
-
Method Details
-
getFormula
Returns the formula within this negation.- Returns:
- the formula within this negation.
-
collapseAssociativeFormulas
Description copied from class:PlFormula
This method collapses all associative operations appearing in this term, e.g. every a||(b||c) becomes a||b||c.- Specified by:
collapseAssociativeFormulas
in classPlFormula
- Returns:
- the collapsed formula.
-
hasLowerBindingPriority
- Parameters:
other
- another formula- Returns:
- whether the formula has a lower binding priority
-
toString
-
toNnf
Description copied from class:PlFormula
This method returns this formula in negation normal form (NNF). A formula is in NNF iff negations occur only directly in front of a proposition. -
trim
Description copied from class:PlFormula
Removes duplicates (identical formulas) from conjunctions and disjunctions and removes duplicate negations. Simplifies equivalences and implications with equivalent formulas (A=>A, A<=>A) to tautologies. -
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceSimpleLogicalFormula
- Specified by:
hashCode
in classPlFormula
-
equals
- Specified by:
equals
in interfaceSimpleLogicalFormula
- Specified by:
equals
in classPlFormula
-
getPredicates
Description copied from interface:SimpleLogicalFormula
Processes the set of all predicates which appear in this formula- Specified by:
getPredicates
in interfaceSimpleLogicalFormula
- Specified by:
getPredicates
in classPlFormula
- Returns:
- all predicates that appear in this formula
-
clone
Description copied from interface:SimpleLogicalFormula
Creates a deep copy of this formula- Specified by:
clone
in interfaceSimpleLogicalFormula
- Specified by:
clone
in classPlFormula
- Returns:
- the cloned formula
-
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 classPlFormula
- Returns:
- The set of all atoms
-
isLiteral
public boolean isLiteral()- Specified by:
isLiteral
in interfaceSimpleLogicalFormula
- Overrides:
isLiteral
in classPlFormula
- Returns:
- true if the formula represents a literal in the language or false otherwise
-
getLiterals
Description copied from class:PlFormula
Returns all literals, i.e. all formulas of the form "a" or "!a" where "a" is a proposition, that appear in this formula.- Specified by:
getLiterals
in classPlFormula
- Returns:
- all literals appearing in this formula.
-
getSignature
Description copied from interface:Formula
Returns the signature of the language of this formula.- Specified by:
getSignature
in interfaceFormula
- Overrides:
getSignature
in classPlFormula
- Returns:
- the signature of the language of this formula.
-
toCnf
Description copied from class:PlFormula
This method returns this formula in conjunctive normal form (CNF). A formula is in CNF iff it is a conjunction of disjunctions and in NNF. The CNF generated by this method is not necessarily minimal. -
getModels
Description copied from class:PlFormula
Returns the set of models of this formula wrt. the given signature. -
numberOfOccurrences
Description copied from class:PlFormula
Returns the number of occurrences of the given proposition within this formula- Specified by:
numberOfOccurrences
in classPlFormula
- Parameters:
p
- some proposition- Returns:
- the number of occurrences of the given proposition within this formula
-
replace
Description copied from class:PlFormula
Replaces the ith instance of the proposition p by f.
-