Class CLaw
- java.lang.Object
-
- net.sf.tweety.action.description.syntax.CLaw
-
- All Implemented Interfaces:
CausalLaw,net.sf.tweety.commons.Formula
- Direct Known Subclasses:
DynamicLaw,StaticLaw
public abstract class CLaw extends Object implements CausalLaw
The action description language C consists of two distinct expressions: static laws and dynamic laws. Both share some common functionalities which are implemented in this base class.- Author:
- Sebastian Homann
-
-
Field Summary
Fields Modifier and Type Field Description protected net.sf.tweety.logics.fol.syntax.FolFormulaheadFormulaprotected net.sf.tweety.logics.fol.syntax.FolFormulaifFormulaprotected Set<GroundingRequirement>requirements
-
Constructor Summary
Constructors Constructor Description CLaw()Creates an empty causal law.CLaw(net.sf.tweety.logics.fol.syntax.FolFormula headFormula)Creates a causal law of the form caused headFormula if TrueCLaw(net.sf.tweety.logics.fol.syntax.FolFormula headFormula, Set<GroundingRequirement> requirements)Creates a causal law of the form caused headFormula if True requires requirementsCLaw(net.sf.tweety.logics.fol.syntax.FolFormula headFormula, net.sf.tweety.logics.fol.syntax.FolFormula ifFormula)Creates a causal law of the form caused headFormula if ifFormulaCLaw(net.sf.tweety.logics.fol.syntax.FolFormula headFormula, net.sf.tweety.logics.fol.syntax.FolFormula ifFormula, Set<GroundingRequirement> requirements)Creates a causal law of the form caused headFormula if ifFormula requires requirements
-
Method Summary
Modifier and Type Method Description voidaddGroundingRequirement(GroundingRequirement c)abstract Set<CLaw>getAllGrounded()Returns the set of all grounded instances of this causal law.abstract Set<net.sf.tweety.logics.fol.syntax.FolAtom>getAtoms()Returns the set of propositions in all formulas in this law.abstract Set<net.sf.tweety.logics.fol.syntax.FolFormula>getFormulas()Returns the set of formulas contained in this causal law, e.g.net.sf.tweety.logics.fol.syntax.FolFormulagetHeadFormula()Returns the headFormula of this causal law.net.sf.tweety.logics.fol.syntax.FolFormulagetIfFormula()Returns the ifFormula of this causal law.abstract net.sf.tweety.commons.SignaturegetSignature()protected booleanisConjunctiveClause(net.sf.tweety.logics.fol.syntax.FolFormula pl)a conjunctive clause is either a literal or a conjunction of literals.abstract booleanisDefinite()Returns true iff this law is definite.booleanisGround()protected booleanisValidDefiniteHead(net.sf.tweety.logics.commons.syntax.RelationalFormula pl)Checks if a propositional formula is a valid head formula for a definite causal law, which means either a contradiction, a fluent or the negation of a fluent.abstract Set<CLaw>toDefinite()Returns an equivalent definite causal law.
-
-
-
Field Detail
-
headFormula
protected net.sf.tweety.logics.fol.syntax.FolFormula headFormula
-
ifFormula
protected net.sf.tweety.logics.fol.syntax.FolFormula ifFormula
-
requirements
protected Set<GroundingRequirement> requirements
-
-
Constructor Detail
-
CLaw
public CLaw()
Creates an empty causal law.
-
CLaw
public CLaw(net.sf.tweety.logics.fol.syntax.FolFormula headFormula)
Creates a causal law of the form caused headFormula if True- Parameters:
headFormula- some FOL formula
-
CLaw
public CLaw(net.sf.tweety.logics.fol.syntax.FolFormula headFormula, Set<GroundingRequirement> requirements)Creates a causal law of the form caused headFormula if True requires requirements- Parameters:
headFormula- some FOL formularequirements- a set of requirements
-
CLaw
public CLaw(net.sf.tweety.logics.fol.syntax.FolFormula headFormula, net.sf.tweety.logics.fol.syntax.FolFormula ifFormula, Set<GroundingRequirement> requirements)Creates a causal law of the form caused headFormula if ifFormula requires requirements- Parameters:
headFormula- some FOL formulaifFormula- some FOL formularequirements- a set of requirements
-
CLaw
public CLaw(net.sf.tweety.logics.fol.syntax.FolFormula headFormula, net.sf.tweety.logics.fol.syntax.FolFormula ifFormula)Creates a causal law of the form caused headFormula if ifFormula- Parameters:
headFormula- some FOL formulaifFormula- some FOL formula
-
-
Method Detail
-
getSignature
public abstract net.sf.tweety.commons.Signature getSignature()
- Specified by:
getSignaturein interfacenet.sf.tweety.commons.Formula
-
isDefinite
public abstract boolean isDefinite()
Returns true iff this law is definite. A causal law is definite if it's head is a literal or a contradiction and all formulas are conjunctions of literals.- Returns:
- true, if this law is definite, false otherwise.
-
toDefinite
public abstract Set<CLaw> toDefinite() throws IllegalStateException
Returns an equivalent definite causal law. A causal law is definite if it's head is a literal or a contradiction and all formulas are conjunctions of literals.- Returns:
- the equivalent definite causal law if one exists.
- Throws:
IllegalStateException- when there is no equivalent definite causal law.
-
getAtoms
public abstract Set<net.sf.tweety.logics.fol.syntax.FolAtom> getAtoms()
Returns the set of propositions in all formulas in this law.- Returns:
- the set of propositions in all formulas in this law.
-
getFormulas
public abstract Set<net.sf.tweety.logics.fol.syntax.FolFormula> getFormulas()
Returns the set of formulas contained in this causal law, e.g. in a static law, this contains the head formula and the if formula.- Returns:
- the set of formulas contained in this causal law.
-
addGroundingRequirement
public void addGroundingRequirement(GroundingRequirement c)
-
getHeadFormula
public net.sf.tweety.logics.fol.syntax.FolFormula getHeadFormula()
Returns the headFormula of this causal law.- Returns:
- the headFormula of this causal law.
-
getIfFormula
public net.sf.tweety.logics.fol.syntax.FolFormula getIfFormula()
Returns the ifFormula of this causal law.- Returns:
- the ifFormula of this causal law.
-
isGround
public boolean isGround()
-
getAllGrounded
public abstract Set<CLaw> getAllGrounded()
Returns the set of all grounded instances of this causal law.- Returns:
- the set of all grounded instances of this causal law.
-
isValidDefiniteHead
protected boolean isValidDefiniteHead(net.sf.tweety.logics.commons.syntax.RelationalFormula pl)
Checks if a propositional formula is a valid head formula for a definite causal law, which means either a contradiction, a fluent or the negation of a fluent.- Parameters:
pl- a propositional formula- Returns:
- true, if pl is a valid definite head formula
-
isConjunctiveClause
protected boolean isConjunctiveClause(net.sf.tweety.logics.fol.syntax.FolFormula pl)
a conjunctive clause is either a literal or a conjunction of literals.- Parameters:
pl- a propositional formula- Returns:
- true, if pl is a conjunctive clause
-
-