Class 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 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:
        getName in interface net.sf.tweety.logics.commons.syntax.interfaces.Atom
        Returns:
        the name of this proposition.
      • getPredicate

        public PlPredicate getPredicate()
        Specified by:
        getPredicate in interface net.sf.tweety.logics.commons.syntax.interfaces.Atom
      • getPredicates

        public Set<PlPredicate> getPredicates()
        Specified by:
        getPredicates in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        getPredicates in class PlFormula
      • collapseAssociativeFormulas

        public PlFormula 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 class PlFormula
        Returns:
        the collapsed formula.
      • getSignature

        public PlSignature getSignature()
        Specified by:
        getSignature in interface net.sf.tweety.commons.Formula
        Overrides:
        getSignature in class PlFormula
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        hashCode in class PlFormula
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        equals in class PlFormula
      • toNnf

        public PlFormula 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.
        Specified by:
        toNnf in class PlFormula
        Returns:
        the formula in NNF.
      • clone

        public Proposition clone()
        Specified by:
        clone in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        clone in class PlFormula
      • trim

        public PlFormula 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.
        Specified by:
        trim in class PlFormula
        Returns:
        an equivalent formula without duplicates.
      • addArgument

        public void addArgument​(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> arg)
        Specified by:
        addArgument in interface net.sf.tweety.logics.commons.syntax.interfaces.Atom
      • getArguments

        public List<? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getArguments()
        Specified by:
        getArguments in interface net.sf.tweety.logics.commons.syntax.interfaces.Atom
      • isComplete

        public boolean isComplete()
        Specified by:
        isComplete in interface net.sf.tweety.logics.commons.syntax.interfaces.Atom
      • getAtoms

        public Set<Proposition> getAtoms()
        Specified by:
        getAtoms in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        getAtoms in class PlFormula
      • isLiteral

        public boolean isLiteral()
        Specified by:
        isLiteral in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Overrides:
        isLiteral in class PlFormula
      • getLiterals

        public Set<PlFormula> 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 class PlFormula
        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:
        setPredicate in interface net.sf.tweety.logics.commons.syntax.interfaces.Atom
      • toCnf

        public Conjunction 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.
        Specified by:
        toCnf in class PlFormula
        Returns:
        the formula in CNF.
      • numberOfOccurrences

        public int numberOfOccurrences​(Proposition p)
        Description copied from class: PlFormula
        Returns the number of occurrences of the given proposition within this formula
        Specified by:
        numberOfOccurrences in class PlFormula
        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: PlFormula
        Replaces the ith instance of the proposition p by f.
        Specified by:
        replace in class PlFormula
        Parameters:
        p - some proposition
        f - some formula
        i - the index of the proposition
        Returns:
        a new formula with the ith instance of the proposition p replaced by f.
      • getModels

        public Set<PossibleWorld> getModels​(PlSignature sig)
        Description copied from class: PlFormula
        Returns the set of models of this formula wrt. the given signature.
        Specified by:
        getModels in class PlFormula
        Parameters:
        sig - some propositional signature
        Returns:
        the set of models of this formula wrt. the given signature.