Class RelationalConditional
java.lang.Object
org.tweetyproject.logics.commons.syntax.RelationalFormula
org.tweetyproject.logics.rcl.syntax.RelationalConditional
- All Implemented Interfaces:
Formula
,Rule<FolFormula,
,FolFormula> ClassicalFormula
,ComplexLogicalFormula
,Conjunctable
,Disjunctable
,Invertable
,LogicStructure
,ProbabilityAware
,QuantifiedFormula
,SimpleLogicalFormula
- Direct Known Subclasses:
RelationalProbabilisticConditional
Instances of this class represent relational conditionals.
Premise and conclusion of this conditional must confirm to a fol language without quantifiers and without functions (@see org.tweetyproject.logics.firstorderlogic.lang.FolLanguageNoQuantifiersNoFunctions)
Premise and conclusion of this conditional must confirm to a fol language without quantifiers and without functions (@see org.tweetyproject.logics.firstorderlogic.lang.FolLanguageNoQuantifiersNoFunctions)
- Author:
- Matthias Thimm TODO dont use relation formula cause it is a Quantified formula that not support or and etc.
-
Constructor Summary
ConstructorDescriptionRelationalConditional
(FolFormula conclusion) Creates a new conditional with the given conclusion and a tautological premise.RelationalConditional
(FolFormula premise, FolFormula conclusion) Creates a new conditional with the given premise and conclusion. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPremise
(FolFormula premise) Add the given premise to this rule.void
addPremises
(Collection<? extends FolFormula> premises) Add the given premises to this rule.clone()
Creates a deep copy of this formulaReturns a conjunction of this and the given formula.boolean
Checks whether this formula contains any quantification.boolean
getAtoms()
Processes the set of all atoms which appear in this formulaReturns the conclusion of this rule.Processes the set of all predicates which appear in this formulaCollection
<? extends FolFormula> Returns the premise of this rule.Returns 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
isConstraintboolean
isFact()
Checks whether this conditional is a fact, i.e.boolean
boolean
Checks whether this formula is well-bound, i.e.boolean
isWellBound
(Set<Variable> boundVariables) Checks whether this formula is well-bound, i.e.void
setConclusion
(FolFormula conclusion) Set the conclusion of this rule.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
-
RelationalConditional
Creates a new conditional with the given premise and conclusion.- Parameters:
premise
- a fol formula.conclusion
- a fol formula.
-
RelationalConditional
Creates a new conditional with the given conclusion and a tautological premise.- Parameters:
conclusion
- a fol formula.
-
-
Method Details
-
containsQuantifier
public boolean containsQuantifier()Description copied from interface:QuantifiedFormula
Checks whether this formula contains any quantification.- Specified by:
containsQuantifier
in interfaceQuantifiedFormula
- Returns:
- "true" if this formula contains a quantification.
-
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.
-
getPredicates
Description copied from interface:SimpleLogicalFormula
Processes the set of all predicates which appear in this formula- Specified by:
getPredicates
in interfaceSimpleLogicalFormula
- Returns:
- all predicates that appear in this formula
-
getUnboundVariables
- Specified by:
getUnboundVariables
in interfaceQuantifiedFormula
- Returns:
- a set of of unbound variables
-
isFact
public boolean isFact()Checks whether this conditional is a fact, i.e. has a tautological premise.- Specified by:
isFact
in interfaceRule<FolFormula,
FolFormula> - Returns:
- "true" iff this conditional is a fact.
-
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.- Specified by:
isClosed
in interfaceQuantifiedFormula
- 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.- Specified by:
isClosed
in interfaceQuantifiedFormula
- Parameters:
boundVariables
- the variables assumed to be bound.- Returns:
- "true" if this formula is closed wrt. "boundVariables", "false" otherwise.
-
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.- Specified by:
isWellBound
in interfaceQuantifiedFormula
- 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.- Specified by:
isWellBound
in interfaceQuantifiedFormula
- Parameters:
boundVariables
- the variables assumed to be bound.- Returns:
- "true" if this formula is well-bound, "false" otherwise.
-
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).
-
toString
- Specified by:
toString
in classRelationalFormula
-
getFunctors
- Specified by:
getFunctors
in classRelationalFormula
- Returns:
- all functors that appear in this formula.
-
getConclusion
Description copied from interface:Rule
Returns the conclusion of this rule.- Specified by:
getConclusion
in interfaceRule<FolFormula,
FolFormula> - Returns:
- the conclusion of this rule.
-
getPremise
Description copied from interface:Rule
Returns the premise of this rule.- Specified by:
getPremise
in interfaceRule<FolFormula,
FolFormula> - Returns:
- the premise of this rule.
-
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:
f
- a formula to be combined with AND and this.- Returns:
- a conjunction of this and the given formula.
-
combineWithOr
- Specified by:
combineWithOr
in interfaceDisjunctable
- Specified by:
combineWithOr
in classRelationalFormula
- Parameters:
f
- a formula to be combined with OR and this.- Returns:
- a disjunction of this and the given formula.
-
complement
- Specified by:
complement
in interfaceInvertable
- Specified by:
complement
in classRelationalFormula
- Returns:
- the complement of this formula.
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceSimpleLogicalFormula
- Overrides:
hashCode
in classObject
-
equals
- Specified by:
equals
in interfaceSimpleLogicalFormula
- Overrides:
equals
in classObject
-
getUniformProbability
- Specified by:
getUniformProbability
in interfaceProbabilityAware
- Specified by:
getUniformProbability
in classRelationalFormula
- Returns:
- this formula's probability in the uniform distribution.
-
isLiteral
public boolean isLiteral()- Specified by:
isLiteral
in interfaceSimpleLogicalFormula
- Returns:
- true if the formula represents a literal in the language or false otherwise
-
getTerms
- Specified by:
getTerms
in interfaceLogicStructure
- Returns:
- a set containing all terms of this logical structure
-
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.- Specified by:
getTerms
in interfaceLogicStructure
- 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
-
getQuantifierVariables
- Specified by:
getQuantifierVariables
in interfaceQuantifiedFormula
- Returns:
- a set containing all quantified variables
-
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
-
isConstraint
public boolean isConstraint()Description copied from interface:Rule
isConstraint- Specified by:
isConstraint
in interfaceRule<FolFormula,
FolFormula> - Returns:
- whether the rule is a constraint
-
setConclusion
Description copied from interface:Rule
Set the conclusion of this rule.- Specified by:
setConclusion
in interfaceRule<FolFormula,
FolFormula> - Parameters:
conclusion
- some formula
-
addPremise
Description copied from interface:Rule
Add the given premise to this rule.- Specified by:
addPremise
in interfaceRule<FolFormula,
FolFormula> - Parameters:
premise
- some formula
-
addPremises
Description copied from interface:Rule
Add the given premises to this rule.- Specified by:
addPremises
in interfaceRule<FolFormula,
FolFormula> - Parameters:
premises
- some formulas
-
getSignature
Description copied from interface:Formula
Returns the signature of the language of this formula.- Specified by:
getSignature
in interfaceFormula
- Specified by:
getSignature
in interfaceRule<FolFormula,
FolFormula> - Returns:
- the signature of the language of this formula.
-