Class InferenceRule<T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable>

  • Type Parameters:
    T - is the type of the language that the ASPIC theory's rules range over
    All Implemented Interfaces:
    net.sf.tweety.commons.Formula, net.sf.tweety.commons.util.rules.Rule<T,​T>, net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula, net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure, net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
    Direct Known Subclasses:
    DefeasibleInferenceRule, StrictInferenceRule

    public abstract class InferenceRule<T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable>
    extends Object
    implements net.sf.tweety.commons.util.rules.Rule<T,​T>, net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
    Author:
    Nils Geilen This stands for an inference rule or for a premise if premises has length 0. If this is a premise and defeasible it is an ordinary premise else it is an axiom.
    • Constructor Detail

      • InferenceRule

        public InferenceRule()
        Creates an empty instance
      • InferenceRule

        public InferenceRule​(T conclusion,
                             Collection<T> premise)
        Constructs a new inference rule of rule p -> c if strict or p => c else
        Parameters:
        conclusion - ^= p
        premise - ^= c
    • Method Detail

      • 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
      • isDefeasible

        public abstract boolean isDefeasible()
        Returns:
        true iff this rule is defeasible
      • getIdentifier

        public String getIdentifier()
        Returns the name if it has one, else it returns the hashcode
        Returns:
        an identifier for this rule
      • getName

        public String getName()
        Returns the name
        Returns:
        this rul's name
      • setName

        public void setName​(String name)
        Sets the name
        Parameters:
        name - new name
      • isFact

        public boolean isFact()
        Specified by:
        isFact in interface net.sf.tweety.commons.util.rules.Rule<T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable,​T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable>
      • isConstraint

        public boolean isConstraint()
        Specified by:
        isConstraint in interface net.sf.tweety.commons.util.rules.Rule<T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable,​T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable>
      • setConclusion

        public void setConclusion​(T conclusion)
        Specified by:
        setConclusion in interface net.sf.tweety.commons.util.rules.Rule<T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable,​T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable>
      • addPremise

        public void addPremise​(T premise)
        Specified by:
        addPremise in interface net.sf.tweety.commons.util.rules.Rule<T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable,​T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable>
      • addPremises

        public void addPremises​(Collection<? extends T> premises)
        Specified by:
        addPremises in interface net.sf.tweety.commons.util.rules.Rule<T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable,​T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable>
      • getSignature

        public net.sf.tweety.commons.Signature getSignature()
        Specified by:
        getSignature in interface net.sf.tweety.commons.Formula
        Specified by:
        getSignature in interface net.sf.tweety.commons.util.rules.Rule<T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable,​T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable>
      • getPremise

        public Collection<? extends T> getPremise()
        Specified by:
        getPremise in interface net.sf.tweety.commons.util.rules.Rule<T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable,​T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable>
      • getConclusion

        public T getConclusion()
        Specified by:
        getConclusion in interface net.sf.tweety.commons.util.rules.Rule<T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable,​T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable>
      • allGroundInstances

        public Set<InferenceRule<T>> allGroundInstances​(Set<net.sf.tweety.logics.commons.syntax.Constant> constants)
      • substitute

        public abstract InferenceRule<T> substitute​(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v,
                                                    net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t)
                                             throws IllegalArgumentException
        Specified by:
        substitute in interface net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
        Throws:
        IllegalArgumentException
      • substitute

        public InferenceRule<T> substitute​(Map<? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>,​? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> map)
                                    throws IllegalArgumentException
        Specified by:
        substitute in interface net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
        Throws:
        IllegalArgumentException
      • clone

        public abstract InferenceRule<T> 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
        Overrides:
        clone in class Object
      • allSubstitutions

        public Set<Map<net.sf.tweety.logics.commons.syntax.Variable,​net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>> allSubstitutions​(Collection<? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> terms)
                                                                                                                                             throws IllegalArgumentException
        Computes all possible substitutions, i.e. maps from variables to terms, of unbound variables of this formula's inner fol formulas to terms in "terms".
        Parameters:
        terms - a set of terms.
        Returns:
        a set of maps from variables to terms.
        Throws:
        IllegalArgumentException - if there is an unbound variable in this formula for which there is no term in "terms" with the same sort.
      • getUnboundVariables

        public Set<net.sf.tweety.logics.commons.syntax.Variable> getUnboundVariables()
      • exchange

        public InferenceRule<T> exchange​(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v,
                                         net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t)
                                  throws IllegalArgumentException
        Specified by:
        exchange in interface net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
        Throws:
        IllegalArgumentException
      • isGround

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

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

        public Set<? extends net.sf.tweety.logics.commons.syntax.interfaces.Atom> getAtoms()
        Specified by:
        getAtoms in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
      • getPredicateCls

        public Class<? extends net.sf.tweety.logics.commons.syntax.Predicate> getPredicateCls()
        Specified by:
        getPredicateCls in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
      • isLiteral

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

        public <C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> boolean containsTermsOfType​(Class<C> cls)
        Specified by:
        containsTermsOfType in interface net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure
      • getPredicates

        public Set<? extends net.sf.tweety.logics.commons.syntax.Predicate> getPredicates()
        Specified by:
        getPredicates in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
      • getTerms

        public Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getTerms()
        Specified by:
        getTerms in interface net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure
      • getTerms

        public <C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> Set<C> getTerms​(Class<C> cls)
        Specified by:
        getTerms in interface net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure