Package net.sf.tweety.logics.pl.syntax
Class Proposition
- java.lang.Object
-
- net.sf.tweety.logics.pl.syntax.PlFormula
-
- net.sf.tweety.logics.pl.syntax.Proposition
-
- All Implemented Interfaces:
Comparable<Proposition>,net.sf.tweety.commons.Formula,net.sf.tweety.logics.commons.syntax.interfaces.Atom,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
public class Proposition extends PlFormula implements net.sf.tweety.logics.commons.syntax.interfaces.Atom, Comparable<Proposition>
This class represents a simple proposition in propositional logic.- Author:
- Matthias Thimm, Tim Janus
-
-
Constructor Summary
Constructors Constructor Description Proposition()Default-Ctor for dynamic instantiationProposition(String name)Creates a new proposition of the given name.Proposition(Proposition other)
-
Method Summary
Modifier and Type Method Description voidaddArgument(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> arg)Propositionclone()PlFormulacollapseAssociativeFormulas()This method collapses all associative operations appearing in this term, e.g.intcompareTo(Proposition o)booleanequals(Object obj)List<? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>getArguments()Set<Proposition>getAtoms()Set<PlFormula>getLiterals()Returns all literals, i.e.Set<PossibleWorld>getModels(PlSignature sig)Returns the set of models of this formula wrt.StringgetName()PlPredicategetPredicate()Set<PlPredicate>getPredicates()PlSignaturegetSignature()inthashCode()booleanisComplete()booleanisLiteral()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.net.sf.tweety.logics.commons.syntax.interfaces.Atom.RETURN_SET_PREDICATEsetPredicate(net.sf.tweety.logics.commons.syntax.Predicate predicate)ConjunctiontoCnf()This method returns this formula in conjunctive normal form (CNF).PlFormulatoNnf()This method returns this formula in negation normal form (NNF).StringtoString()PlFormulatrim()Removes duplicates (identical formulas) from conjunctions and disjunctions and removes duplicate negations.-
Methods inherited from class net.sf.tweety.logics.pl.syntax.PlFormula
combineWithAnd, combineWithOr, complement, getModels, getPredicateCls, getPrimeImplicants, getUniformProbability, isClause, isConjunctiveClause, resolvableWith, resolveWith, toBlakeCanonicalForm, toDnf
-
-
-
-
Constructor Detail
-
Proposition
public Proposition()
Default-Ctor for dynamic instantiation
-
Proposition
public Proposition(String name)
Creates a new proposition of the given name.- Parameters:
name- the name of the proposition.
-
Proposition
public Proposition(Proposition other)
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getNamein interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom- Returns:
- the name of this proposition.
-
getPredicate
public PlPredicate getPredicate()
- Specified by:
getPredicatein interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom
-
getPredicates
public Set<PlPredicate> getPredicates()
- Specified by:
getPredicatesin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Specified by:
getPredicatesin classPlFormula
-
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.
-
getSignature
public PlSignature getSignature()
- Specified by:
getSignaturein interfacenet.sf.tweety.commons.Formula- Overrides:
getSignaturein classPlFormula
-
hashCode
public int hashCode()
-
equals
public boolean equals(Object obj)
-
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.
-
clone
public Proposition clone()
-
trim
public PlFormula 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
public void addArgument(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> arg)
- Specified by:
addArgumentin interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom
-
getArguments
public List<? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getArguments()
- Specified by:
getArgumentsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom
-
isComplete
public boolean isComplete()
- Specified by:
isCompletein interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom
-
getAtoms
public Set<Proposition> getAtoms()
-
isLiteral
public boolean isLiteral()
-
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.
-
setPredicate
public net.sf.tweety.logics.commons.syntax.interfaces.Atom.RETURN_SET_PREDICATE setPredicate(net.sf.tweety.logics.commons.syntax.Predicate predicate)
- Specified by:
setPredicatein interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom
-
compareTo
public int compareTo(Proposition o)
- Specified by:
compareToin interfaceComparable<Proposition>
-
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.
-
getModels
public Set<PossibleWorld> getModels(PlSignature sig)
Description copied from class:PlFormulaReturns the set of models of this formula wrt. the given signature.
-
-