Class Proposition
java.lang.Object
org.tweetyproject.logics.pl.syntax.PlFormula
org.tweetyproject.logics.pl.syntax.Proposition
- All Implemented Interfaces:
Comparable<Proposition>,Formula,Atom,ClassicalFormula,Conjunctable,Disjunctable,Invertable,ProbabilityAware,SimpleLogicalFormula
- Direct Known Subclasses:
QueryProposition
This class represents a simple proposition in propositional logic.
- Author:
- Matthias Thimm, Tim Janus
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.Atom
Atom.AtomImpl, Atom.RETURN_SET_PREDICATE -
Constructor Summary
ConstructorsConstructorDescriptionDefault-Ctor for dynamic instantiationProposition(String name) Creates a new proposition of the given name.Proposition(Proposition other) constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArgument(Term<?> arg) Adds an argument to the atom's argument listclone()Creates a deep copy of this formulaThis method collapses all associative operations appearing in this term, e.g.intbooleangetAtoms()Processes the set of all atoms which appear in this formulaReturns all literals, i.e.getModels(PlSignature sig) Returns the set of models of this formula wrt.getName()Processes the set of all predicates which appear in this formulaReturns the signature of the language of this formula.inthashCode()booleanbooleanintReturns 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.setPredicate(Predicate predicate) Changes the predicate of the atom.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, toDnfMethods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.SimpleLogicalFormula
getPredicateCls
-
Constructor Details
-
Proposition
public Proposition()Default-Ctor for dynamic instantiation -
Proposition
Creates a new proposition of the given name.- Parameters:
name- the name of the proposition.
-
Proposition
constructor- Parameters:
other- another proposition
-
-
Method Details
-
getName
-
getPredicate
- Specified by:
getPredicatein interfaceAtom- Returns:
- the predicate of the atom
-
getPredicates
Description copied from interface:SimpleLogicalFormulaProcesses the set of all predicates which appear in this formula- Specified by:
getPredicatesin interfaceSimpleLogicalFormula- Specified by:
getPredicatesin classPlFormula- Returns:
- all predicates that appear in this formula
-
toString
-
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.
-
getSignature
Description copied from interface:FormulaReturns the signature of the language of this formula.- Specified by:
getSignaturein interfaceFormula- Overrides:
getSignaturein classPlFormula- Returns:
- the signature of the language of this formula.
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceSimpleLogicalFormula- Specified by:
hashCodein classPlFormula
-
equals
- Specified by:
equalsin interfaceSimpleLogicalFormula- Specified by:
equalsin classPlFormula
-
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. -
clone
Description copied from interface:SimpleLogicalFormulaCreates a deep copy of this formula- Specified by:
clonein interfaceSimpleLogicalFormula- Specified by:
clonein classPlFormula- Returns:
- the cloned formula
-
trim
Description copied from class:PlFormulaRemoves duplicates (identical formulas) from conjunctions and disjunctions and removes duplicate negations. Simplifies equivalences and implications with equivalent formulas (A=>A, A<=>A) to tautologies. -
addArgument
Description copied from interface:AtomAdds an argument to the atom's argument list- Specified by:
addArgumentin interfaceAtom- Parameters:
arg- The next argument
-
getArguments
- Specified by:
getArgumentsin interfaceAtom- Returns:
- A list containing all the arguments of this specific atom
-
isComplete
public boolean isComplete()- Specified by:
isCompletein interfaceAtom- Returns:
- true if the size of the argument list is equal to the arity of the predicate
-
getAtoms
Description copied from interface:SimpleLogicalFormulaProcesses the set of all atoms which appear in this formula- Specified by:
getAtomsin interfaceSimpleLogicalFormula- Specified by:
getAtomsin classPlFormula- Returns:
- The set of all atoms
-
isLiteral
public boolean isLiteral()- Specified by:
isLiteralin interfaceSimpleLogicalFormula- Overrides:
isLiteralin classPlFormula- Returns:
- true if the formula represents a literal in the language or false otherwise
-
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.
-
setPredicate
Description copied from interface:AtomChanges the predicate of the atom. Given an old Predicate po and a new predicate pn with their list of arguments types at(po) and at(pn) and the arguments of this Atom: arg(this) this method distinguishes between three cases: 1. The predicate only differ in the names, returning RSP_SUCCESS 2. The old predicates argument types is a sub-list of the new argument types then the method returns RSP_INCOMPLETE and the atoms isComplete() method returns false 3. The new predicates argument types is a sub-list of the old argument types then the method returns RSP_TRUNCATED and the arguments of this atom are truncated too and isComplete() returns true. 4. The old and new predicates' argument types differ then the list of arguments of the atom get cleared and isComplete() returns false.- Specified by:
setPredicatein interfaceAtom- Parameters:
predicate- some predicate- Returns:
- Depends on the cases described above: 1. RSP_SUCCESS 2. RSP_INCOMPLETE 3. RSP_TRUNCATED 4. RSP_CLEARED
-
compareTo
- Specified by:
compareToin interfaceComparable<Proposition>
-
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. The CNF generated by this method is not necessarily minimal. -
numberOfOccurrences
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
Description copied from class:PlFormulaReplaces the ith instance of the proposition p by f. -
getModels
Description copied from class:PlFormulaReturns the set of models of this formula wrt. the given signature.
-