Class DefaultRule
java.lang.Object
org.tweetyproject.logics.commons.syntax.RelationalFormula
org.tweetyproject.logics.rdl.syntax.DefaultRule
- All Implemented Interfaces:
Formula
,ClassicalFormula
,ComplexLogicalFormula
,Conjunctable
,Disjunctable
,Invertable
,LogicStructure
,ProbabilityAware
,QuantifiedFormula
,SimpleLogicalFormula
Models a default rule in Reiter's default logic, see [R. Reiter. A logic for
default reasoning. Artificial Intelligence, 13:81–132, 1980].
- Author:
- Matthias Thimm, Nils Geilen
-
Constructor Summary
ConstructorDescriptionan empty Default RuleDefaultRule
(FolFormula pre, Collection<FolFormula> jus, FolFormula conc) Creates a new DefaultRuleDefaultRule
(FolFormula pre, FolFormula jus, FolFormula conc) Creates a new DefaultRule -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates a deep copy of this formulacombineWithAnd
(Conjunctable formula) Returns a conjunction of this and the given formula.combineWithOr
(Disjunctable formula) boolean
Checks whether this formula contains any quantification.boolean
getAtoms()
Processes the set of all atoms which appear in this formulaReturn the default's conclusionReturn the default's justificationProcesses the set of all predicates which appear in this formulaReturn the default's prerequisiteReturns the signature of the language of this formula.getTerms()
Processes the set containing all terms of type C.int
hashCode()
boolean
isClosed()
Checks whether this formula is closed, i.e.boolean
Checks whether this formula is closed, i.e.boolean
boolean
Tests, whether the default is normal normal ^= a:c/cboolean
Checks whether this formula is well-bound, i.e.boolean
isWellBound
(Set<Variable> boundVariables) Checks whether this formula is well-bound, i.e.substitute
(Term<?> v, Term<?> t) Substitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.toString()
Methods inherited from class org.tweetyproject.logics.commons.syntax.RelationalFormula
allGroundInstances, allSubstitutions, containsTermsOfType, exchange, getFormula, getPredicateCls, getSatisfactionRatio, isGround, isWellFormed, substitute
-
Constructor Details
-
DefaultRule
public DefaultRule()an empty Default Rule -
DefaultRule
Creates a new DefaultRule- Parameters:
pre
- the prerequsitejus
- the justificationconc
- the conclusion- Throws:
IllegalArgumentException
- if there is some issue with the argumentsParserException
- when a parameter is missing
-
DefaultRule
public DefaultRule(FolFormula pre, Collection<FolFormula> jus, FolFormula conc) throws IllegalArgumentException Creates a new DefaultRule- Parameters:
pre
- the prerequsitejus
- the justificationsconc
- the conclusion- Throws:
IllegalArgumentException
- if there is some issue with the arguments
-
-
Method Details
-
isNormal
Tests, whether the default is normal normal ^= a:c/c- Parameters:
dt
- a default theory- Returns:
- true iff the theory is normal
-
getPrerequisite
Return the default's prerequisite- Returns:
- the default's prerequisite
-
getJustification
Return the default's justification- Returns:
- the default's justification
-
getConclusion
-
getPredicates
Description copied from interface:SimpleLogicalFormula
Processes the set of all predicates which appear in this formula- Returns:
- all predicates that appear in this formula
-
isLiteral
public boolean isLiteral()- Returns:
- true if the formula represents a literal in the language or false otherwise
-
getQuantifierVariables
-
getUnboundVariables
-
containsQuantifier
public boolean containsQuantifier()Description copied from interface:QuantifiedFormula
Checks whether this formula contains any quantification.- Returns:
- "true" if this formula contains a quantification.
-
isWellBound
public boolean isWellBound()Description copied from interface:QuantifiedFormula
Checks whether this formula is well-bound, i.e. whether no variable bound by a quantifier is again bound by another quantifier within the first quantifier's range.- Returns:
- "true" if this formula is well-bound, "false" otherwise.
-
isWellBound
Description copied from interface:QuantifiedFormula
Checks whether this formula is well-bound, i.e. whether no variable bound by a quantifier is again bound by another quantifier within the first quantifier range. Every variable in "boundVariables" is assumed to be bound already.- Parameters:
boundVariables
- the variables assumed to be bound.- Returns:
- "true" if this formula is well-bound, "false" otherwise.
-
isClosed
public boolean isClosed()Description copied from interface:QuantifiedFormula
Checks whether this formula is closed, i.e. whether every variables occurring in the formula is bound by a quantifier.- Returns:
- "true" if this formula is closed, "false" otherwise.
-
isClosed
Description copied from interface:QuantifiedFormula
Checks whether this formula is closed, i.e. whether every variables occurring in the formula is bound by a quantifier. Every variable in "boundVariables" is already assumed to be bound.- Parameters:
boundVariables
- the variables assumed to be bound.- Returns:
- "true" if this formula is closed wrt. "boundVariables", "false" otherwise.
-
getTerms
-
getTerms
Description copied from interface:LogicStructure
Processes the set containing all terms of type C. This method uses the equals method of the given Class and therefore does not add terms which are sub classes of type C to the set.- Type Parameters:
C
- the type of terms- Parameters:
cls
- The Class structure containing type information about the searched term- Returns:
- A set containing all terms of type C of this logical structure
-
getAtoms
Description copied from interface:SimpleLogicalFormula
Processes the set of all atoms which appear in this formula- Specified by:
getAtoms
in interfaceSimpleLogicalFormula
- Specified by:
getAtoms
in classRelationalFormula
- Returns:
- all atoms that appear in this formula.
-
getFunctors
- Specified by:
getFunctors
in classRelationalFormula
- Returns:
- all functors that appear in this formula.
-
substitute
Description copied from class:RelationalFormula
Substitutes all occurrences of term "v" in this formula by term "t" and returns the new formula. NOTE: if "v" is a variable and bound to a quantifier then "v" is not substituted in that quantifiers inner formula.- Specified by:
substitute
in interfaceComplexLogicalFormula
- Specified by:
substitute
in classRelationalFormula
- Parameters:
v
- the term to be substituted.t
- the term to substitute.- Returns:
- a formula where every occurrence of "v" is replaced by "t".
- Throws:
IllegalArgumentException
- if "v" and "t" are of different sorts (NOTE: this exception is only thrown when "v" actually appears in this formula).
-
getUniformProbability
- Specified by:
getUniformProbability
in interfaceProbabilityAware
- Specified by:
getUniformProbability
in classRelationalFormula
- Returns:
- this formula's probability in the uniform distribution.
-
complement
- Specified by:
complement
in interfaceInvertable
- Specified by:
complement
in classRelationalFormula
- Returns:
- the complement of this formula.
-
combineWithOr
- Specified by:
combineWithOr
in interfaceDisjunctable
- Specified by:
combineWithOr
in classRelationalFormula
- Parameters:
formula
- a formula to be combined with OR and this.- Returns:
- a disjunction of this and the given formula.
-
combineWithAnd
Description copied from interface:Conjunctable
Returns a conjunction of this and the given formula.- Specified by:
combineWithAnd
in interfaceConjunctable
- Specified by:
combineWithAnd
in classRelationalFormula
- Parameters:
formula
- a formula to be combined with AND and this.- Returns:
- a conjunction of this and the given formula.
-
getSignature
Description copied from interface:Formula
Returns the signature of the language of this formula.- Returns:
- the signature of the language of this formula.
-
toString
- Specified by:
toString
in classRelationalFormula
-
clone
Description copied from interface:SimpleLogicalFormula
Creates a deep copy of this formula- Specified by:
clone
in interfaceComplexLogicalFormula
- Specified by:
clone
in interfaceSimpleLogicalFormula
- Specified by:
clone
in classRelationalFormula
- Returns:
- the cloned formula
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceSimpleLogicalFormula
- Overrides:
hashCode
in classObject
-
equals
- Specified by:
equals
in interfaceSimpleLogicalFormula
- Overrides:
equals
in classObject
-