Package net.sf.tweety.arg.aspic.syntax
Class InferenceRule<T extends net.sf.tweety.logics.commons.syntax.interfaces.Invertable>
- java.lang.Object
-
- net.sf.tweety.arg.aspic.syntax.InferenceRule<T>
-
- 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 Summary
Constructors Constructor Description InferenceRule()Creates an empty instanceInferenceRule(T conclusion, Collection<T> premise)Constructs a new inference rule of rule p -> c if strict or p => c else
-
Method Summary
Modifier and Type Method Description voidaddPremise(T premise)voidaddPremises(Collection<? extends T> premises)Set<InferenceRule<T>>allGroundInstances(Set<net.sf.tweety.logics.commons.syntax.Constant> constants)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)Computes all possible substitutions, i.e.abstract InferenceRule<T>clone()<C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>
booleancontainsTermsOfType(Class<C> cls)booleanequals(Object obj)InferenceRule<T>exchange(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t)Set<? extends net.sf.tweety.logics.commons.syntax.interfaces.Atom>getAtoms()TgetConclusion()StringgetIdentifier()Returns the name if it has one, else it returns the hashcodeStringgetName()Returns the nameClass<? extends net.sf.tweety.logics.commons.syntax.Predicate>getPredicateCls()Set<? extends net.sf.tweety.logics.commons.syntax.Predicate>getPredicates()Collection<? extends T>getPremise()net.sf.tweety.commons.SignaturegetSignature()Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>getTerms()<C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>
Set<C>getTerms(Class<C> cls)Set<net.sf.tweety.logics.commons.syntax.Variable>getUnboundVariables()inthashCode()booleanisConstraint()abstract booleanisDefeasible()booleanisFact()booleanisGround()booleanisLiteral()booleanisWellFormed()voidsetConclusion(T conclusion)voidsetName(String name)Sets the nameInferenceRule<T>substitute(Map<? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>,? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> map)abstract InferenceRule<T>substitute(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t)DefeasibleInferenceRule<T>toDefeasible()StrictInferenceRule<T>toStrict()StringtoString()
-
-
-
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- ^= ppremise- ^= c
-
-
Method Detail
-
hashCode
public int hashCode()
-
equals
public boolean equals(Object obj)
-
isDefeasible
public abstract boolean isDefeasible()
- Returns:
- true iff this rule is defeasible
-
toStrict
public StrictInferenceRule<T> toStrict()
- Returns:
- a strict instance of this rule
-
toDefeasible
public DefeasibleInferenceRule<T> toDefeasible()
- Returns:
- a defeasible instance of this rule
-
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()
-
isConstraint
public boolean isConstraint()
-
setConclusion
public void setConclusion(T conclusion)
-
addPremise
public void addPremise(T premise)
-
addPremises
public void addPremises(Collection<? extends T> premises)
-
getSignature
public net.sf.tweety.commons.Signature getSignature()
-
getPremise
public Collection<? extends T> getPremise()
-
getConclusion
public T getConclusion()
-
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:
substitutein interfacenet.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:
substitutein interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Throws:
IllegalArgumentException
-
clone
public abstract InferenceRule<T> clone()
-
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:
exchangein interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Throws:
IllegalArgumentException
-
isGround
public boolean isGround()
- Specified by:
isGroundin interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
-
isWellFormed
public boolean isWellFormed()
- Specified by:
isWellFormedin interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
-
getAtoms
public Set<? extends net.sf.tweety.logics.commons.syntax.interfaces.Atom> getAtoms()
- Specified by:
getAtomsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
-
getPredicateCls
public Class<? extends net.sf.tweety.logics.commons.syntax.Predicate> getPredicateCls()
- Specified by:
getPredicateClsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
-
isLiteral
public boolean isLiteral()
- Specified by:
isLiteralin interfacenet.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:
containsTermsOfTypein interfacenet.sf.tweety.logics.commons.syntax.interfaces.LogicStructure
-
getPredicates
public Set<? extends net.sf.tweety.logics.commons.syntax.Predicate> getPredicates()
- Specified by:
getPredicatesin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
-
getTerms
public Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getTerms()
- Specified by:
getTermsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.LogicStructure
-
-