Class DefaultNegation

  • All Implemented Interfaces:
    net.sf.tweety.commons.Formula, net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula, net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure, net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula

    public class DefaultNegation
    extends ASPBodyElement
    This class represents a default negated literal, i.e. "not a", where a is a classical atom or an aggregate atom.

    In answer set programming, the body of a rule is usually composed of a set of positive and negative literals, where this valuation refers to default negation or negation as failure. When implementing a rule, there are two opportunities:

    • implement the rule with two distinct lists, representing the sets of positive and negative literals
    • implement the rule with one set containing super literals, where a super literal can be positive or strictly negated, with or without default negation.

    This library takes the second approach, which allows more flexibility, but comes at the cost that malformed constructs like "not not a" are not intercepted by the library.

    Author:
    Tim Janus, Thomas Vengels, Anna Gessler
    • Constructor Detail

      • DefaultNegation

        public DefaultNegation​(ASPBodyElement at)
        Creates new default negation with the given literal.
        Parameters:
        at - a classical atom or an aggregate atom
    • Method Detail

      • getLiterals

        public SortedSet<ASPLiteral> getLiterals()
        Description copied from class: ASPBodyElement
        Returns all literals in this element in form of a SortedSet. Literals are atoms or strict negations of atoms.
        Specified by:
        getLiterals in class ASPBodyElement
        Returns:
        all the literals used in the rule element
      • getPredicates

        public Set<net.sf.tweety.logics.commons.syntax.Predicate> getPredicates()
        Specified by:
        getPredicates in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        getPredicates in class ASPElement
      • getAtoms

        public Set<ASPAtom> getAtoms()
        Specified by:
        getAtoms in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        getAtoms in class ASPElement
      • substitute

        public ASPBodyElement substitute​(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t,
                                         net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v)
        Specified by:
        substitute in interface net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
        Specified by:
        substitute in class ASPBodyElement
      • getSignature

        public net.sf.tweety.logics.fol.syntax.FolSignature getSignature()
        Specified by:
        getSignature in interface net.sf.tweety.commons.Formula
        Specified by:
        getSignature in class ASPElement
      • isWellFormed

        public boolean isWellFormed()
        Specified by:
        isWellFormed in interface net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
        Overrides:
        isWellFormed in class ASPElement
      • isLiteral

        public boolean isLiteral()
      • getTerms

        public Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getTerms()
      • getTerms

        public <C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> Set<C> getTerms​(Class<C> cls)
      • clone

        public DefaultNegation clone()
        Specified by:
        clone in interface net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
        Specified by:
        clone in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        clone in class ASPElement
      • hashCode

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

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