Browse Source
Merge branch 'refactorFormulas'
Merge branch 'refactorFormulas'
Conflicts:
src/counterexamples/SMTMinimalCommandSetGenerator.h
src/storm.cpp
Former-commit-id: f65836b10d
main
177 changed files with 12901 additions and 11099 deletions
-
20src/counterexamples/MILPMinimalLabelSetGenerator.h
-
167src/counterexamples/PathBasedSubsystemGenerator.h
-
41src/counterexamples/SMTMinimalCommandSetGenerator.h
-
73src/formula/AbstractFormulaChecker.h
-
31src/formula/Csl.h
-
31src/formula/Csl/AbstractCslFormula.h
-
83src/formula/Csl/AbstractNoBoundOperator.h
-
129src/formula/Csl/And.h
-
106src/formula/Csl/Ap.h
-
120src/formula/Csl/Eventually.h
-
122src/formula/Csl/Globally.h
-
120src/formula/Csl/Next.h
-
116src/formula/Csl/Not.h
-
125src/formula/Csl/Or.h
-
121src/formula/Csl/ProbabilisticBoundOperator.h
-
115src/formula/Csl/ProbabilisticNoBoundOperator.h
-
118src/formula/Csl/SteadyStateBoundOperator.h
-
100src/formula/Csl/SteadyStateNoBoundOperator.h
-
97src/formula/Csl/TimeBoundedEventually.h
-
111src/formula/Csl/TimeBoundedUntil.h
-
125src/formula/Csl/Until.h
-
150src/formula/Ltl/And.h
-
129src/formula/Ltl/Ap.h
-
146src/formula/Ltl/BoundedEventually.h
-
163src/formula/Ltl/BoundedUntil.h
-
140src/formula/Ltl/Eventually.h
-
142src/formula/Ltl/Globally.h
-
140src/formula/Ltl/Next.h
-
136src/formula/Ltl/Not.h
-
141src/formula/Ltl/Or.h
-
157src/formula/Ltl/Until.h
-
16src/formula/Ltl/visitor/AbstractLtlFormulaVisitor.cpp
-
72src/formula/Ltl/visitor/AbstractLtlFormulaVisitor.h
-
42src/formula/Prctl.h
-
83src/formula/Prctl/AbstractNoBoundOperator.h
-
31src/formula/Prctl/AbstractPrctlFormula.h
-
129src/formula/Prctl/And.h
-
106src/formula/Prctl/Ap.h
-
126src/formula/Prctl/BoundedEventually.h
-
141src/formula/Prctl/BoundedNaryUntil.h
-
131src/formula/Prctl/BoundedUntil.h
-
110src/formula/Prctl/CumulativeReward.h
-
120src/formula/Prctl/Eventually.h
-
122src/formula/Prctl/Globally.h
-
111src/formula/Prctl/InstantaneousReward.h
-
120src/formula/Prctl/Next.h
-
116src/formula/Prctl/Not.h
-
125src/formula/Prctl/Or.h
-
139src/formula/Prctl/ProbabilisticBoundOperator.h
-
115src/formula/Prctl/ProbabilisticNoBoundOperator.h
-
117src/formula/Prctl/ReachabilityReward.h
-
132src/formula/Prctl/RewardBoundOperator.h
-
108src/formula/Prctl/RewardNoBoundOperator.h
-
91src/formula/Prctl/SteadyStateReward.h
-
125src/formula/Prctl/Until.h
-
49src/formula/PrctlFormulaChecker.h
-
92src/formula/abstract/AbstractFormula.h
-
164src/formula/abstract/And.h
-
84src/formula/abstract/Ap.h
-
151src/formula/abstract/BoundedEventually.h
-
175src/formula/abstract/BoundedNaryUntil.h
-
182src/formula/abstract/BoundedUntil.h
-
101src/formula/abstract/CumulativeReward.h
-
125src/formula/abstract/Eventually.h
-
126src/formula/abstract/Globally.h
-
41src/formula/abstract/IOptimizingOperator.h
-
101src/formula/abstract/InstantaneousReward.h
-
128src/formula/abstract/Next.h
-
122src/formula/abstract/Not.h
-
72src/formula/abstract/OptimizingOperator.h
-
161src/formula/abstract/Or.h
-
194src/formula/abstract/PathBoundOperator.h
-
160src/formula/abstract/PathNoBoundOperator.h
-
114src/formula/abstract/ProbabilisticBoundOperator.h
-
104src/formula/abstract/ProbabilisticNoBoundOperator.h
-
106src/formula/abstract/RewardBoundOperator.h
-
103src/formula/abstract/RewardNoBoundOperator.h
-
174src/formula/abstract/StateBoundOperator.h
-
126src/formula/abstract/StateNoBoundOperator.h
-
77src/formula/abstract/SteadyStateBoundOperator.h
-
76src/formula/abstract/SteadyStateNoBoundOperator.h
-
62src/formula/abstract/SteadyStateReward.h
-
107src/formula/abstract/TimeBoundedEventually.h
-
112src/formula/abstract/TimeBoundedOperator.h
-
149src/formula/abstract/TimeBoundedUntil.h
-
159src/formula/abstract/Until.h
-
155src/modelchecker/csl/AbstractModelChecker.h
-
105src/modelchecker/csl/SparseMarkovAutomatonCslModelChecker.h
-
56src/modelchecker/ltl/AbstractModelChecker.h
-
181src/modelchecker/prctl/AbstractModelChecker.h
-
83src/modelchecker/prctl/SparseDtmcPrctlModelChecker.h
-
192src/modelchecker/prctl/SparseMdpPrctlModelChecker.h
-
4src/models/Dtmc.h
-
241src/parser/CslParser.cpp
-
40src/parser/CslParser.h
-
6src/parser/LtlFileParser.cpp
-
21src/parser/LtlFileParser.h
-
191src/parser/LtlParser.cpp
-
34src/parser/LtlParser.h
-
12src/parser/PrctlFileParser.cpp
@ -1,73 +0,0 @@ |
|||
#ifndef STORM_FORMULA_ABSTRACTFORMULACHECKER_H_ |
|||
#define STORM_FORMULA_ABSTRACTFORMULACHECKER_H_ |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
|
|||
template <class T> class AbstractFormulaChecker; |
|||
|
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
|
|||
/*! |
|||
* @brief Base class for all formula checkers. |
|||
* |
|||
* A formula checker is used to check if a given formula is valid in some |
|||
* logic. Hence, this pure virtual base class should be subclassed for |
|||
* every logic we support. |
|||
* |
|||
* Every subclass must implement validate(). It gets a pointer to an |
|||
* AbstractFormula object and should return if the subtree represented by |
|||
* this formula is valid in the logic. |
|||
* |
|||
* Usually, this will be implemented like this: |
|||
* @code |
|||
* if ( |
|||
* dynamic_cast<const And<T>*>(formula) || |
|||
* dynamic_cast<const Not<T>*>(formula) || |
|||
* dynamic_cast<const Or<T>*>(formula) |
|||
* ) { |
|||
* return formula->validate(*this); |
|||
* } else return false; |
|||
* @endcode |
|||
* |
|||
* Every formula class implements a validate() method itself which calls |
|||
* validate() on the given checker for every child in the formula tree. |
|||
* |
|||
* If the formula structure is not an actual tree, but an directed acyclic |
|||
* graph, the shared subtrees will be checked twice. If we have directed |
|||
* cycles, we will have infinite recursions. |
|||
*/ |
|||
template <class T> |
|||
class AbstractFormulaChecker { |
|||
public: |
|||
/*! |
|||
* Virtual destructor |
|||
* To ensure that the right destructor is called |
|||
*/ |
|||
virtual ~AbstractFormulaChecker() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the given formula is valid in some logic. |
|||
* |
|||
* Every subclass must implement this method and check, if the |
|||
* formula object is valid in the logic of the subclass. |
|||
* |
|||
* @param formula A pointer to some formula object. |
|||
* @return true iff the formula is valid. |
|||
*/ |
|||
virtual bool validate(const storm::property::abstract::AbstractFormula<T>* formula) const = 0; |
|||
}; |
|||
|
|||
} // namespace property |
|||
} // namespace storm |
|||
|
|||
#endif |
@ -1,31 +0,0 @@ |
|||
/* |
|||
* Csl.h |
|||
* |
|||
* Created on: 19.04.2013 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_H_ |
|||
#define STORM_FORMULA_CSL_H_ |
|||
|
|||
#include "src/modelchecker/csl/ForwardDeclarations.h" |
|||
|
|||
#include "Csl/And.h" |
|||
#include "Csl/Ap.h" |
|||
#include "Csl/Next.h" |
|||
#include "Csl/Not.h" |
|||
#include "Csl/Or.h" |
|||
#include "Csl/ProbabilisticNoBoundOperator.h" |
|||
#include "Csl/ProbabilisticBoundOperator.h" |
|||
#include "Csl/SteadyStateNoBoundOperator.h" |
|||
#include "Csl/SteadyStateBoundOperator.h" |
|||
|
|||
#include "Csl/Until.h" |
|||
#include "Csl/Eventually.h" |
|||
#include "Csl/Globally.h" |
|||
#include "Csl/TimeBoundedEventually.h" |
|||
#include "Csl/TimeBoundedUntil.h" |
|||
|
|||
#include "modelchecker/csl/AbstractModelChecker.h" |
|||
|
|||
#endif /* STORM_FORMULA_CSL_H_ */ |
@ -1,31 +0,0 @@ |
|||
/* |
|||
* AbstractCslFormula.h |
|||
* |
|||
* Created on: 19.04.2013 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef ABSTRACTCSLFORMULA_H_ |
|||
#define ABSTRACTCSLFORMULA_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
/*! |
|||
* Abstract base class for all CSL root formulas. |
|||
*/ |
|||
template <class T> |
|||
class AbstractCslFormula : public virtual storm::property::abstract::AbstractFormula<T>{ |
|||
public: |
|||
virtual ~AbstractCslFormula() { |
|||
// Intentionally left empty |
|||
} |
|||
}; |
|||
|
|||
} /* namespace csl */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
#endif /* ABSTRACTCSLFORMULA_H_ */ |
@ -1,83 +0,0 @@ |
|||
/* |
|||
* AbstractNoBoundOperator.h |
|||
* |
|||
* Created on: 16.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_ABSTRACTNOBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_CSL_ABSTRACTNOBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractCslFormula.h" |
|||
#include "src/formula/abstract/IOptimizingOperator.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> |
|||
class AbstractNoBoundOperator; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support PathNoBoundOperator. |
|||
* |
|||
* All model checkers that support the formula class NoBoundOperator must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class INoBoundOperatorModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates NoBoundOperator formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkNoBoundOperator(const AbstractNoBoundOperator<T>& obj) const = 0; |
|||
|
|||
|
|||
}; |
|||
|
|||
/*! |
|||
* Interface class for all CSL No Bound operators. |
|||
*/ |
|||
template <class T> |
|||
class AbstractNoBoundOperator: public AbstractCslFormula<T>, |
|||
public virtual storm::property::abstract::IOptimizingOperator { |
|||
public: |
|||
AbstractNoBoundOperator() { |
|||
// Intentionally left empty |
|||
|
|||
} |
|||
virtual ~AbstractNoBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @note This function is not implemented in this class. |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractNoBoundOperator<T>* clone() const = 0; |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @note This function is not implemented in this class. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const = 0; |
|||
}; |
|||
|
|||
} /* namespace csl */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
#endif /* STORM_FORMULA_CSL_ABSTRACTNOBOUNDOPERATOR_H_ */ |
@ -1,129 +0,0 @@ |
|||
/* |
|||
* And.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_AND_H_ |
|||
#define STORM_FORMULA_CSL_AND_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/And.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/modelchecker/csl/ForwardDeclarations.h" |
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> class And; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support And. |
|||
* |
|||
* All model checkers that support the formula class And must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IAndModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates And formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual storm::storage::BitVector checkAnd(const And<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with AND node as root. |
|||
* |
|||
* Has two Abstract state formulas as sub formulas/trees. |
|||
* |
|||
* As AND is commutative, the order is \e theoretically not important, but will influence the order in which |
|||
* the model checker works. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractCslFormula |
|||
*/ |
|||
template <class T> |
|||
class And : public storm::property::abstract::And<T, AbstractStateFormula<T>>, public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor. |
|||
* Will create an AND-node without subnotes. Will not represent a complete formula! |
|||
*/ |
|||
And() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* Creates an AND note with the parameters as subtrees. |
|||
* |
|||
* @param left The left sub formula |
|||
* @param right The right sub formula |
|||
*/ |
|||
And(AbstractStateFormula<T>* left, AbstractStateFormula<T>* right) |
|||
: storm::property::abstract::And<T, AbstractStateFormula<T>>(left, right) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* The subtrees are deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~And() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
And<T>* result = new And(); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IAndModelChecker>()->checkAnd(*this); |
|||
} |
|||
|
|||
}; |
|||
|
|||
} //namespace csl |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_CSL_AND_H_ */ |
@ -1,106 +0,0 @@ |
|||
/* |
|||
* Ap.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_AP_H_ |
|||
#define STORM_FORMULA_CSL_AP_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/Ap.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/modelchecker/csl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> class Ap; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Ap. |
|||
* |
|||
* All model checkers that support the formula class Ap must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IApModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Ap formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual storm::storage::BitVector checkAp(const Ap<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with atomic proposition as root. |
|||
* |
|||
* This class represents the leaves in the formula tree. |
|||
* |
|||
* @see AbstractCslFormula |
|||
* @see AbstractStateFormula |
|||
*/ |
|||
template <class T> |
|||
class Ap : public storm::property::abstract::Ap<T>, |
|||
public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Constructor |
|||
* |
|||
* Creates a new atomic proposition leaf, with the label Ap |
|||
* |
|||
* @param ap The string representing the atomic proposition |
|||
*/ |
|||
Ap(std::string ap) |
|||
: storm::property::abstract::Ap<T>(ap) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* At this time, empty... |
|||
*/ |
|||
virtual ~Ap() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
return new Ap(this->getAp()); |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IApModelChecker>()->checkAp(*this); |
|||
} |
|||
|
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_CSL_AP_H_ */ |
@ -1,120 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_EVENTUALLY_H_ |
|||
#define STORM_FORMULA_CSL_EVENTUALLY_H_ |
|||
|
|||
#include "src/formula/abstract/Eventually.h" |
|||
#include "src/formula/Csl/AbstractPathFormula.h" |
|||
#include "src/formula/Csl/AbstractStateFormula.h" |
|||
#include "src/modelchecker/csl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> class Eventually; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Eventually. |
|||
* |
|||
* All model checkers that support the formula class Eventually must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IEventuallyModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Eventually formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkEventually(const Eventually<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with an Eventually node as root. |
|||
* |
|||
* Has one Abstract state formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff eventually \e child holds. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to nullptr before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractCslFormula |
|||
*/ |
|||
template <class T> |
|||
class Eventually : public storm::property::abstract::Eventually<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Eventually() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Eventually(AbstractStateFormula<T>* child) |
|||
: storm::property::abstract::Eventually<T, AbstractStateFormula<T>>(child) { |
|||
|
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to nullptr before deletion) |
|||
*/ |
|||
virtual ~Eventually() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new Eventually-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
Eventually<T>* result = new Eventually<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<IEventuallyModelChecker>()->checkEventually(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace csl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_CSL_EVENTUALLY_H_ */ |
@ -1,122 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_GLOBALLY_H_ |
|||
#define STORM_FORMULA_CSL_GLOBALLY_H_ |
|||
|
|||
#include "src/formula/abstract/Globally.h" |
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/modelchecker/csl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> class Globally; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Globally. |
|||
* |
|||
* All model checkers that support the formula class Globally must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IGloballyModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Globally formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkGlobally(const Globally<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Globally node as root. |
|||
* |
|||
* Has one Abstract state formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff globally \e child holds. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to nullptr before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractCslFormula |
|||
*/ |
|||
template <class T> |
|||
class Globally : public storm::property::abstract::Globally<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Globally() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Globally(AbstractStateFormula<T>* child) |
|||
: storm::property::abstract::Globally<T, AbstractStateFormula<T>>(child) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to nullptr before deletion) |
|||
*/ |
|||
virtual ~Globally() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new Globally-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
Globally<T>* result = new Globally<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<IGloballyModelChecker>()->checkGlobally(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace csl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_CSL_GLOBALLY_H_ */ |
@ -1,120 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_NEXT_H_ |
|||
#define STORM_FORMULA_CSL_NEXT_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/Next.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> class Next; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Next. |
|||
* |
|||
* All model checkers that support the formula class Next must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class INextModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Next formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkNext(const Next<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Next node as root. |
|||
* |
|||
* Has two Abstract state formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff in the next step, \e child holds |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractCslFormula |
|||
*/ |
|||
template <class T> |
|||
class Next : public storm::property::abstract::Next<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Next() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Next(AbstractStateFormula<T>* child) |
|||
: storm::property::abstract::Next<T, AbstractStateFormula<T>>(child) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~Next() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
Next<T>* result = new Next<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<INextModelChecker>()->checkNext(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace csl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_CSL_NEXT_H_ */ |
@ -1,116 +0,0 @@ |
|||
/* |
|||
* Not.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_NOT_H_ |
|||
#define STORM_FORMULA_CSL_NOT_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/Not.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/modelchecker/csl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> class Not; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Not. |
|||
* |
|||
* All model checkers that support the formula class Not must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class INotModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Not formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual storm::storage::BitVector checkNot(const Not<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with NOT node as root. |
|||
* |
|||
* Has one Abstract state formula as sub formula/tree. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractCslFormula |
|||
*/ |
|||
template <class T> |
|||
class Not : public storm::property::abstract::Not<T, AbstractStateFormula<T>>, |
|||
public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Not() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* @param child The child node |
|||
*/ |
|||
Not(AbstractStateFormula<T>* child) : |
|||
storm::property::abstract::Not<T, AbstractStateFormula<T>>(child){ |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
* |
|||
* Also deletes the subtree |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~Not() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
Not<T>* result = new Not<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<INotModelChecker>()->checkNot(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace csl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_CSL_NOT_H_ */ |
@ -1,125 +0,0 @@ |
|||
/* |
|||
* Or.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_OR_H_ |
|||
#define STORM_FORMULA_CSL_OR_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/Or.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> class Or; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Or. |
|||
* |
|||
* All model checkers that support the formula class Or must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IOrModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Or formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual storm::storage::BitVector checkOr(const Or<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with OR node as root. |
|||
* |
|||
* Has two Abstract state formulas as sub formulas/trees. |
|||
* |
|||
* As OR is commutative, the order is \e theoretically not important, but will influence the order in which |
|||
* the model checker works. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractCslFormula |
|||
*/ |
|||
template <class T> |
|||
class Or : public storm::property::abstract::Or<T, AbstractStateFormula<T>>, |
|||
public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor. |
|||
* Will create an OR-node without subnotes. The result does not represent a complete formula! |
|||
*/ |
|||
Or() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* Creates an OR note with the parameters as subtrees. |
|||
* |
|||
* @param left The left sub formula |
|||
* @param right The right sub formula |
|||
*/ |
|||
Or(AbstractStateFormula<T>* left, AbstractStateFormula<T>* right) : |
|||
storm::property::abstract::Or<T, AbstractStateFormula<T>>(left, right) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* The subtrees are deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~Or() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
Or<T>* result = new Or(); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IOrModelChecker>()->checkOr(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace csl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_CSL_OR_H_ */ |
@ -1,121 +0,0 @@ |
|||
/* |
|||
* ProbabilisticBoundOperator.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_PROBABILISTICBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_CSL_PROBABILISTICBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "AbstractPathFormula.h" |
|||
#include "src/formula/abstract/ProbabilisticBoundOperator.h" |
|||
#include "utility/constants.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> class ProbabilisticBoundOperator; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support ProbabilisticBoundOperator. |
|||
* |
|||
* All model checkers that support the formula class PathBoundOperator must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IProbabilisticBoundOperatorModelChecker { |
|||
public: |
|||
virtual storm::storage::BitVector checkProbabilisticBoundOperator(const ProbabilisticBoundOperator<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a P (probablistic) operator node over a probability interval |
|||
* as root. |
|||
* |
|||
* Has one Abstract path formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff the probability that the path formula holds is inside the bounds |
|||
* specified in this operator |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractPathFormula |
|||
* @see ProbabilisticOperator |
|||
* @see ProbabilisticNoBoundsOperator |
|||
* @see AbstractCslFormula |
|||
*/ |
|||
template<class T> |
|||
class ProbabilisticBoundOperator : public storm::property::abstract::ProbabilisticBoundOperator<T, AbstractPathFormula<T>>, |
|||
public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
ProbabilisticBoundOperator() : storm::property::abstract::ProbabilisticBoundOperator<T, AbstractPathFormula<T>> |
|||
(LESS_EQUAL, storm::utility::constantZero<T>(), nullptr) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param comparisonRelation The relation to compare the actual value and the bound |
|||
* @param bound The bound for the probability |
|||
* @param pathFormula The child node |
|||
*/ |
|||
ProbabilisticBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, T bound, AbstractPathFormula<T>* pathFormula) |
|||
: storm::property::abstract::ProbabilisticBoundOperator<T, AbstractPathFormula<T>>(comparisonRelation, bound, pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
ProbabilisticBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, T bound, AbstractPathFormula<T>* pathFormula, bool minimumOperator) |
|||
: storm::property::abstract::ProbabilisticBoundOperator<T, AbstractPathFormula<T>>(comparisonRelation, bound, pathFormula, minimumOperator){ |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
ProbabilisticBoundOperator<T>* result = new ProbabilisticBoundOperator<T>(); |
|||
result->setComparisonOperator(this->getComparisonOperator()); |
|||
result->setBound(this->getBound()); |
|||
result->setPathFormula(this->getPathFormula().clone()); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IProbabilisticBoundOperatorModelChecker>()->checkProbabilisticBoundOperator(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace csl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_CSL_PROBABILISTICBOUNDOPERATOR_H_ */ |
@ -1,115 +0,0 @@ |
|||
/* |
|||
* ProbabilisticNoBoundOperator.h |
|||
* |
|||
* Created on: 12.12.2012 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_PROBABILISTICNOBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_CSL_PROBABILISTICNOBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractNoBoundOperator.h" |
|||
#include "src/formula/abstract/ProbabilisticNoBoundOperator.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a P (probablistic) operator without declaration of probabilities |
|||
* as root. |
|||
* |
|||
* Checking a formula with this operator as root returns the probabilities that the path formula holds |
|||
* (for each state) |
|||
* |
|||
* Has one Abstract path formula as sub formula/tree. |
|||
* |
|||
* @note |
|||
* This class is a hybrid of a state and path formula, and may only appear as the outermost operator. |
|||
* Hence, it is seen as neither a state nor a path formula, but is directly derived from AbstractFormula. |
|||
* |
|||
* @note |
|||
* This class does not contain a check() method like the other formula classes. |
|||
* The check method should only be called by the model checker to infer the correct check function for sub |
|||
* formulas. As this operator can only appear at the root, the method is not useful here. |
|||
* Use the checkProbabilisticNoBoundOperator method from the DtmccslModelChecker class instead. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractPathFormula |
|||
* @see ProbabilisticOperator |
|||
* @see ProbabilisticIntervalOperator |
|||
* @see AbstractCslFormula |
|||
*/ |
|||
template <class T> |
|||
class ProbabilisticNoBoundOperator: public storm::property::abstract::ProbabilisticNoBoundOperator<T, AbstractPathFormula<T>>, |
|||
public AbstractNoBoundOperator<T> { |
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
ProbabilisticNoBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
*/ |
|||
ProbabilisticNoBoundOperator(AbstractPathFormula<T>* pathFormula) |
|||
: storm::property::abstract::ProbabilisticNoBoundOperator<T, AbstractPathFormula<T>>(pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
*/ |
|||
ProbabilisticNoBoundOperator(AbstractPathFormula<T>* pathFormula, bool minimumOperator) |
|||
: storm::property::abstract::ProbabilisticNoBoundOperator<T, AbstractPathFormula<T>>(pathFormula, minimumOperator) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~ProbabilisticNoBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
virtual AbstractNoBoundOperator<T>* clone() const override { |
|||
ProbabilisticNoBoundOperator<T>* result = new ProbabilisticNoBoundOperator<T>(); |
|||
if (this->pathFormulaIsSet()) { |
|||
result->setPathFormula(this->getPathFormula().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @note This function is not implemented in this class. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const override { |
|||
return this->getPathFormula().check(modelChecker, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace csl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_CSL_PROBABILISTICNOBOUNDOPERATOR_H_ */ |
@ -1,118 +0,0 @@ |
|||
/* |
|||
* SteadyState.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_STEADYSTATEOPERATOR_H_ |
|||
#define STORM_FORMULA_CSL_STEADYSTATEOPERATOR_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/SteadyStateBoundOperator.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
|
|||
namespace property { |
|||
|
|||
namespace csl { |
|||
|
|||
template <class T> class SteadyStateBoundOperator; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support SteadyStateOperator. |
|||
* |
|||
* All model checkers that support the formula class SteadyStateOperator must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class ISteadyStateBoundOperatorModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates SteadyStateOperator formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual storm::storage::BitVector checkSteadyStateBoundOperator(const SteadyStateBoundOperator<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an Abstract (path) formula tree with a SteadyStateOperator node as root. |
|||
* |
|||
* Has two Abstract state formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff \e child holds SteadyStateOperator step, \e child holds |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractCslFormula |
|||
*/ |
|||
template <class T> |
|||
class SteadyStateBoundOperator : public storm::property::abstract::SteadyStateBoundOperator<T, AbstractStateFormula<T>>, |
|||
public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
SteadyStateBoundOperator() : storm::property::abstract::SteadyStateBoundOperator<T, AbstractStateFormula<T>> |
|||
(LESS_EQUAL, storm::utility::constantZero<T>(), nullptr) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param stateFormula The child node |
|||
*/ |
|||
SteadyStateBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, T bound, AbstractStateFormula<T>* stateFormula) : |
|||
storm::property::abstract::SteadyStateBoundOperator<T, AbstractStateFormula<T>>(comparisonRelation, bound, stateFormula) { |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~SteadyStateBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
SteadyStateBoundOperator<T>* result = new SteadyStateBoundOperator<T>(); |
|||
result->setStateFormula(this->getStateFormula().clone()); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<ISteadyStateBoundOperatorModelChecker>()->checkSteadyStateBoundOperator(*this); |
|||
} |
|||
|
|||
}; |
|||
|
|||
} //namespace csl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_CSL_STEADYSTATEOPERATOR_H_ */ |
@ -1,100 +0,0 @@ |
|||
/* |
|||
* SteadyStateNoBoundOperator.h |
|||
* |
|||
* Created on: 09.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_STEADYSTATENOBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_CSL_STEADYSTATENOBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "AbstractNoBoundOperator.h" |
|||
#include "src/formula/abstract/SteadyStateNoBoundOperator.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> class SteadyStateNoBoundOperator; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support SteadyStateOperator. |
|||
* |
|||
* All model checkers that support the formula class SteadyStateOperator must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class ISteadyStateNoBoundOperatorModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates SteadyStateOperator formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkSteadyStateNoBoundOperator(const SteadyStateNoBoundOperator<T>& obj) const = 0; |
|||
}; |
|||
|
|||
template <class T> |
|||
class SteadyStateNoBoundOperator: public storm::property::abstract::SteadyStateNoBoundOperator<T, AbstractStateFormula<T>>, |
|||
public AbstractNoBoundOperator<T> { |
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
SteadyStateNoBoundOperator() : storm::property::abstract::SteadyStateNoBoundOperator<T, AbstractStateFormula<T>>() { |
|||
// Intentionally left empty |
|||
|
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param stateFormula The state formula that forms the subtree |
|||
*/ |
|||
SteadyStateNoBoundOperator(AbstractStateFormula<T>* stateFormula) |
|||
: storm::property::abstract::SteadyStateNoBoundOperator<T, AbstractStateFormula<T>>(stateFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
~SteadyStateNoBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractNoBoundOperator <T>* clone() const override { |
|||
SteadyStateNoBoundOperator<T>* result = new SteadyStateNoBoundOperator<T>(); |
|||
result->setStateFormula(this->getStateFormula().clone()); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const override { |
|||
return modelChecker.template as<ISteadyStateNoBoundOperatorModelChecker>()->checkSteadyStateNoBoundOperator(*this); |
|||
} |
|||
|
|||
}; |
|||
|
|||
} /* namespace csl */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
|
|||
#endif /* STORM_FORMULA_CSL_STEADYSTATENOBOUNDOPERATOR_H_ */ |
@ -1,97 +0,0 @@ |
|||
/* |
|||
* TimeBoundedEventually.h |
|||
* |
|||
* Created on: 10.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_TIMEBOUNDEDEVENTUALLY_H_ |
|||
#define STORM_FORMULA_CSL_TIMEBOUNDEDEVENTUALLY_H_ |
|||
|
|||
#include "src/formula/abstract/TimeBoundedEventually.h" |
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template<class T> class TimeBoundedEventually; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support TimeBoundedEventually. |
|||
* |
|||
* All model checkers that support the formula class BoundedEventually must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class ITimeBoundedEventuallyModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates TimeBoundedUntil formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkTimeBoundedEventually(const TimeBoundedEventually<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
|
|||
template<class T> |
|||
class TimeBoundedEventually: public storm::property::abstract::TimeBoundedEventually<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
public: |
|||
/** |
|||
* Simple constructor: Only sets the bounds |
|||
* |
|||
* @param lowerBound |
|||
* @param upperBound |
|||
*/ |
|||
TimeBoundedEventually(T lowerBound, T upperBound) |
|||
: storm::property::abstract::TimeBoundedEventually<T, AbstractStateFormula<T>>(lowerBound, upperBound) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
TimeBoundedEventually(T lowerBound, T upperBound, AbstractStateFormula<T>* child) |
|||
: storm::property::abstract::TimeBoundedEventually<T, AbstractStateFormula<T>>(lowerBound, upperBound, child) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
virtual ~TimeBoundedEventually() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
TimeBoundedEventually<T>* result = new TimeBoundedEventually<T>(this->getLowerBound(), this->getUpperBound()); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<ITimeBoundedEventuallyModelChecker>()->checkTimeBoundedEventually(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} /* namespace csl */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
|
|||
#endif /* STORM_FORMULA_CSL_TIMEBOUNDEDEVENTUALLY_H_ */ |
@ -1,111 +0,0 @@ |
|||
/* |
|||
* TimeBoundedUntil.h |
|||
* |
|||
* Created on: 10.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_TIMEBOUNDEDUNTIL_H_ |
|||
#define STORM_FORMULA_CSL_TIMEBOUNDEDUNTIL_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/TimeBoundedUntil.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> class TimeBoundedUntil; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support TimeBoundedUntil. |
|||
* |
|||
* All model checkers that support the formula class BoundedEventually must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class ITimeBoundedUntilModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates TimeBoundedUntil formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkTimeBoundedUntil(const TimeBoundedUntil<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
template <class T> |
|||
class TimeBoundedUntil: public storm::property::abstract::TimeBoundedUntil<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
public: |
|||
/** |
|||
* Constructor providing bounds only; |
|||
* Sub formulas are set to null. |
|||
* |
|||
* @param lowerBound |
|||
* @param upperBound |
|||
*/ |
|||
TimeBoundedUntil(T lowerBound, T upperBound) : |
|||
storm::property::abstract::TimeBoundedUntil<T, AbstractStateFormula<T>>(lowerBound, upperBound) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/** |
|||
* Full constructor |
|||
* @param lowerBound |
|||
* @param upperBound |
|||
* @param left |
|||
* @param right |
|||
*/ |
|||
TimeBoundedUntil(T lowerBound, T upperBound, AbstractStateFormula<T>* left, AbstractStateFormula<T>* right) : |
|||
storm::property::abstract::TimeBoundedUntil<T, AbstractStateFormula<T>>(lowerBound, upperBound, left, right) { |
|||
|
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~TimeBoundedUntil() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
TimeBoundedUntil<T>* result = new TimeBoundedUntil<T>(this->getLowerBound(), this->getUpperBound()); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<ITimeBoundedUntilModelChecker>()->checkTimeBoundedUntil(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} /* namespace csl */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
|
|||
#endif /* STORM_FORMULA_CSL_TIMEBOUNDEDUNTIL_H_ */ |
@ -1,125 +0,0 @@ |
|||
/* |
|||
* Until.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_CSL_UNTIL_H_ |
|||
#define STORM_FORMULA_CSL_UNTIL_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/Until.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace csl { |
|||
|
|||
template <class T> class Until; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Until. |
|||
* |
|||
* All model checkers that support the formula class Until must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IUntilModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Until formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkUntil(const Until<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with an Until node as root. |
|||
* |
|||
* Has two Abstract state formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff eventually, formula \e right (the right subtree) holds, and before, |
|||
* \e left holds always. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractCslFormula |
|||
*/ |
|||
template <class T> |
|||
class Until : public storm::property::abstract::Until<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Until() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param left The left formula subtree |
|||
* @param right The left formula subtree |
|||
*/ |
|||
Until(AbstractStateFormula<T>* left, AbstractStateFormula<T>* right) |
|||
: storm::property::abstract::Until<T, AbstractStateFormula<T>>(left, right) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~Until() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
Until<T>* result = new Until(); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<IUntilModelChecker>()->checkUntil(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace csl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_CSL_UNTIL_H_ */ |
@ -1,150 +0,0 @@ |
|||
/* |
|||
* And.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_LTL_AND_H_ |
|||
#define STORM_FORMULA_LTL_AND_H_ |
|||
|
|||
#include "AbstractLtlFormula.h" |
|||
#include "src/formula/abstract/And.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/modelchecker/ltl/ForwardDeclarations.h" |
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
|
|||
template <class T> class And; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support And. |
|||
* |
|||
* All model checkers that support the formula class And must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IAndModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates And formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkAnd(const And<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief Interface class for visitors that support And. |
|||
* |
|||
* All visitors that support the formula class And must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IAndVisitor { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates And formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual void visitAnd(const And<T>& obj) = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with AND node as root. |
|||
* |
|||
* Has two Abstract LTL formulas as sub formulas/trees. |
|||
* |
|||
* As AND is commutative, the order is \e theoretically not important, but will influence the order in which |
|||
* the model checker works. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractLtlFormula |
|||
*/ |
|||
template <class T> |
|||
class And : public storm::property::abstract::And<T, AbstractLtlFormula<T>>, public AbstractLtlFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor. |
|||
* Will create an AND-node without subnotes. Will not represent a complete formula! |
|||
*/ |
|||
And() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* Creates an AND node with the parameters as subtrees. |
|||
* |
|||
* @param left The left sub formula |
|||
* @param right The right sub formula |
|||
*/ |
|||
And(AbstractLtlFormula<T>* left, AbstractLtlFormula<T>* right) |
|||
: storm::property::abstract::And<T, AbstractLtlFormula<T>>(left, right) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* The subtrees are deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~And() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractLtlFormula<T>* clone() const override { |
|||
And<T>* result = new And(); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IAndModelChecker>()->checkAnd(*this); |
|||
} |
|||
|
|||
virtual void visit(visitor::AbstractLtlFormulaVisitor<T>& visitor) const override { |
|||
visitor.template as<IAndVisitor>()->visitAnd(*this); |
|||
} |
|||
|
|||
}; |
|||
|
|||
} //namespace ltl |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_LTL_AND_H_ */ |
@ -1,129 +0,0 @@ |
|||
/* |
|||
* Ap.h |
|||
* |
|||
* Created on: 22.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_LTL_AP_H_ |
|||
#define STORM_FORMULA_LTL_AP_H_ |
|||
|
|||
#include "AbstractLtlFormula.h" |
|||
#include "src/formula/abstract/Ap.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
|
|||
template <class T> class Ap; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support And. |
|||
* |
|||
* All model checkers that support the formula class And must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IApModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates And formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkAp(const Ap<T>& obj) const = 0; |
|||
}; |
|||
|
|||
|
|||
/*! |
|||
* @brief Interface class for visitors that support Ap. |
|||
* |
|||
* All visitors that support the formula class Ap must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IApVisitor { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates And formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual void visitAp(const Ap<T>& obj) = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with atomic proposition as root. |
|||
* |
|||
* This class represents the leaves in the formula tree. |
|||
* |
|||
* @see AbstractLtlFormula |
|||
*/ |
|||
template <class T> |
|||
class Ap: public storm::property::abstract::Ap<T>, |
|||
public storm::property::ltl::AbstractLtlFormula<T> { |
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Ap() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* Creates a new atomic proposition leaf, with the label Ap |
|||
* |
|||
* @param ap The string representing the atomic proposition |
|||
*/ |
|||
Ap(std::string ap) : |
|||
storm::property::abstract::Ap<T>(ap) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~Ap() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @note This function is not implemented in this class. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IApModelChecker>()->checkAp(*this); |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractLtlFormula<T>* clone() const override { |
|||
return new Ap(this->getAp()); |
|||
} |
|||
|
|||
virtual void visit(visitor::AbstractLtlFormulaVisitor<T>& visitor) const override { |
|||
visitor.template as<IApVisitor>()->visitAp(*this); |
|||
} |
|||
}; |
|||
|
|||
} /* namespace ltl */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
#endif /* STORM_FORMULA_LTL_AP_H_ */ |
@ -1,146 +0,0 @@ |
|||
/* |
|||
* BoundedUntil.h |
|||
* |
|||
* Created on: 27.11.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_LTL_BOUNDEDEVENTUALLY_H_ |
|||
#define STORM_FORMULA_LTL_BOUNDEDEVENTUALLY_H_ |
|||
|
|||
#include "src/formula/abstract/BoundedEventually.h" |
|||
#include "AbstractLtlFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include <cstdint> |
|||
#include <string> |
|||
#include "src/modelchecker/ltl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
|
|||
template <class T> class BoundedEventually; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support BoundedEventually. |
|||
* |
|||
* All model checkers that support the formula class BoundedEventually must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IBoundedEventuallyModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates BoundedEventually formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkBoundedEventually(const BoundedEventually<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief Interface class for visitors that support BoundedEventually. |
|||
* |
|||
* All visitors that support the formula class BoundedEventually must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IBoundedEventuallyVisitor { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates BoundedEventually formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual void visitBoundedEventually(const BoundedEventually<T>& obj) = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a BoundedEventually node as root. |
|||
* |
|||
* Has one Abstract LTL formulas as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff in at most \e bound steps, formula \e child holds. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractLtlFormula |
|||
*/ |
|||
template <class T> |
|||
class BoundedEventually : public storm::property::abstract::BoundedEventually<T, AbstractLtlFormula<T>>, |
|||
public AbstractLtlFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
BoundedEventually() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child formula subtree |
|||
* @param bound The maximal number of steps |
|||
*/ |
|||
BoundedEventually(AbstractLtlFormula<T>* child, uint_fast64_t bound) : |
|||
storm::property::abstract::BoundedEventually<T, AbstractLtlFormula<T>>(child, bound){ |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~BoundedEventually() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractLtlFormula<T>* clone() const override { |
|||
BoundedEventually<T>* result = new BoundedEventually<T>(); |
|||
result->setBound(this->getBound()); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IBoundedEventuallyModelChecker>()->checkBoundedEventually(*this); |
|||
} |
|||
|
|||
virtual void visit(visitor::AbstractLtlFormulaVisitor<T>& visitor) const override { |
|||
visitor.template as<IBoundedEventuallyVisitor>()->visitBoundedEventually(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace ltl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_LTL_BOUNDEDUNTIL_H_ */ |
@ -1,163 +0,0 @@ |
|||
/* |
|||
* BoundedUntil.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_LTL_BOUNDEDUNTIL_H_ |
|||
#define STORM_FORMULA_LTL_BOUNDEDUNTIL_H_ |
|||
|
|||
#include "src/formula/abstract/BoundedUntil.h" |
|||
#include "AbstractLtlFormula.h" |
|||
#include <cstdint> |
|||
#include <string> |
|||
#include "src/modelchecker/ltl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
|
|||
template <class T> class BoundedUntil; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support BoundedUntil. |
|||
* |
|||
* All model checkers that support the formula class BoundedUntil must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IBoundedUntilModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates BoundedUntil formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkBoundedUntil(const BoundedUntil<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief Interface class for visitors that support BoundedUntil. |
|||
* |
|||
* All visitors that support the formula class BoundedUnitl must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IBoundedUntilVisitor { |
|||
public: |
|||
/*! |
|||
* @brief Visits BoundedUntil formula. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual void visitBoundedUntil(const BoundedUntil<T>& obj) = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a BoundedUntil node as root. |
|||
* |
|||
* Has two Abstract LTL formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff in at most \e bound steps, formula \e right (the right subtree) holds, and before, |
|||
* \e left holds. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractLtlFormula |
|||
*/ |
|||
template <class T> |
|||
class BoundedUntil : public storm::property::abstract::BoundedUntil<T, AbstractLtlFormula<T>>, |
|||
public AbstractLtlFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
BoundedUntil() { |
|||
//Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param left The left formula subtree |
|||
* @param right The left formula subtree |
|||
* @param bound The maximal number of steps |
|||
*/ |
|||
BoundedUntil(AbstractLtlFormula<T>* left, AbstractLtlFormula<T>* right, |
|||
uint_fast64_t bound) : |
|||
storm::property::abstract::BoundedUntil<T, AbstractLtlFormula<T>>(left,right,bound) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~BoundedUntil() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* @brief Return string representation of this formula. |
|||
* |
|||
* In LTL, brackets are needed around the until, as Until may appear nested (in other logics, Until always is the |
|||
* root of a path formula); hence this function is overwritten in this class. |
|||
* |
|||
* @return A string representation of the formula. |
|||
*/ |
|||
virtual std::string toString() const { |
|||
return "(" + storm::property::abstract::BoundedUntil<T, AbstractLtlFormula<T>>::toString() + ")"; |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractLtlFormula<T>* clone() const override { |
|||
BoundedUntil<T>* result = new BoundedUntil<T>(); |
|||
result->setBound(this->getBound()); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const { |
|||
return modelChecker.template as<IBoundedUntilModelChecker>()->checkBoundedUntil(*this); |
|||
} |
|||
|
|||
virtual void visit(visitor::AbstractLtlFormulaVisitor<T>& visitor) const override { |
|||
visitor.template as<IBoundedUntilVisitor>()->visitBoundedUntil(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace ltl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_LTL_BOUNDEDUNTIL_H_ */ |
@ -1,140 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_LTL_EVENTUALLY_H_ |
|||
#define STORM_FORMULA_LTL_EVENTUALLY_H_ |
|||
|
|||
#include "src/formula/abstract/Eventually.h" |
|||
#include "AbstractLtlFormula.h" |
|||
#include "src/modelchecker/ltl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
|
|||
template <class T> class Eventually; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Eventually. |
|||
* |
|||
* All model checkers that support the formula class Eventually must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IEventuallyModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Eventually formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkEventually(const Eventually<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief Interface class for visitors that support Eventually. |
|||
* |
|||
* All visitors that support the formula class Eventually must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IEventuallyVisitor { |
|||
public: |
|||
/*! |
|||
* @brief Visits Eventually formula. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual void visitEventually(const Eventually<T>& obj) = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with an Eventually node as root. |
|||
* |
|||
* Has one Abstract LTL formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff eventually \e child holds. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to nullptr before deletion) |
|||
* |
|||
* @see AbstractLtlFormula |
|||
*/ |
|||
template <class T> |
|||
class Eventually : public storm::property::abstract::Eventually<T, AbstractLtlFormula<T>>, |
|||
public AbstractLtlFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Eventually() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Eventually(AbstractLtlFormula<T>* child) |
|||
: storm::property::abstract::Eventually<T, AbstractLtlFormula<T>>(child) { |
|||
|
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to nullptr before deletion) |
|||
*/ |
|||
virtual ~Eventually() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new Eventually-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractLtlFormula<T>* clone() const override { |
|||
Eventually<T>* result = new Eventually<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const { |
|||
return modelChecker.template as<IEventuallyModelChecker>()->checkEventually(*this); |
|||
} |
|||
|
|||
virtual void visit(visitor::AbstractLtlFormulaVisitor<T>& visitor) const override { |
|||
visitor.template as<IEventuallyVisitor>()->visitEventually(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace ltl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_LTL_EVENTUALLY_H_ */ |
@ -1,142 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_LTL_GLOBALLY_H_ |
|||
#define STORM_FORMULA_LTL_GLOBALLY_H_ |
|||
|
|||
#include "src/formula/abstract/Globally.h" |
|||
#include "AbstractLtlFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/modelchecker/ltl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
|
|||
template <class T> class Globally; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Globally. |
|||
* |
|||
* All model checkers that support the formula class Globally must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IGloballyModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Globally formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkGlobally(const Globally<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief Interface class for visitors that support Globally. |
|||
* |
|||
* All visitors that support the formula class Globally must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IGloballyVisitor { |
|||
public: |
|||
/*! |
|||
* @brief Visits Globally formula. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual void visitGlobally(const Globally<T>& obj) = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Globally node as root. |
|||
* |
|||
* Has one Abstract LTL formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff globally \e child holds. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to nullptr before deletion) |
|||
* |
|||
* @see AbstractLtlFormula |
|||
*/ |
|||
template <class T> |
|||
class Globally : public storm::property::abstract::Globally<T, AbstractLtlFormula<T>>, |
|||
public AbstractLtlFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Globally() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Globally(AbstractLtlFormula<T>* child) |
|||
: storm::property::abstract::Globally<T, AbstractLtlFormula<T>>(child) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to nullptr before deletion) |
|||
*/ |
|||
virtual ~Globally() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new Globally-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractLtlFormula<T>* clone() const override { |
|||
Globally<T>* result = new Globally<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const { |
|||
return modelChecker.template as<IGloballyModelChecker>()->checkGlobally(*this); |
|||
} |
|||
|
|||
virtual void visit(visitor::AbstractLtlFormulaVisitor<T>& visitor) const override { |
|||
visitor.template as<IGloballyVisitor>()->visitGlobally(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace ltl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_LTL_GLOBALLY_H_ */ |
@ -1,140 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_LTL_NEXT_H_ |
|||
#define STORM_FORMULA_LTL_NEXT_H_ |
|||
|
|||
#include "AbstractLtlFormula.h" |
|||
#include "src/formula/abstract/Next.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
|
|||
template <class T> class Next; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Next. |
|||
* |
|||
* All model checkers that support the formula class Next must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class INextModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Next formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkNext(const Next<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief Interface class for visitors that support Next. |
|||
* |
|||
* All visitors that support the formula class Next must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class INextVisitor { |
|||
public: |
|||
/*! |
|||
* @brief Visits Next formula. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual void visitNext(const Next<T>& obj) = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Next node as root. |
|||
* |
|||
* Has two Abstract LTL formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff in the next step, \e child holds |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractLtlFormula |
|||
*/ |
|||
template <class T> |
|||
class Next : public storm::property::abstract::Next<T, AbstractLtlFormula<T>>, |
|||
public AbstractLtlFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Next() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Next(AbstractLtlFormula<T>* child) |
|||
: storm::property::abstract::Next<T, AbstractLtlFormula<T>>(child) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~Next() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractLtlFormula<T>* clone() const override { |
|||
Next<T>* result = new Next<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const { |
|||
return modelChecker.template as<INextModelChecker>()->checkNext(*this); |
|||
} |
|||
|
|||
virtual void visit(visitor::AbstractLtlFormulaVisitor<T>& visitor) const override { |
|||
visitor.template as<INextVisitor>()->visitNext(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace ltl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_LTL_NEXT_H_ */ |
@ -1,136 +0,0 @@ |
|||
/* |
|||
* Not.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_LTL_NOT_H_ |
|||
#define STORM_FORMULA_LTL_NOT_H_ |
|||
|
|||
#include "AbstractLtlFormula.h" |
|||
#include "src/formula/abstract/Not.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
|
|||
template <class T> class Not; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Not. |
|||
* |
|||
* All model checkers that support the formula class Not must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class INotModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Not formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkNot(const Not<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief Interface class for visitors that support Not. |
|||
* |
|||
* All visitors that support the formula class Not must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class INotVisitor { |
|||
public: |
|||
/*! |
|||
* @brief Visits Not formula. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual void visitNot(const Not<T>& obj) = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with NOT node as root. |
|||
* |
|||
* Has one Abstract LTL formula as sub formula/tree. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractLtlFormula |
|||
*/ |
|||
template <class T> |
|||
class Not : public storm::property::abstract::Not<T, AbstractLtlFormula<T>>, |
|||
public AbstractLtlFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Not() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* @param child The child node |
|||
*/ |
|||
Not(AbstractLtlFormula<T>* child) : |
|||
storm::property::abstract::Not<T, AbstractLtlFormula<T>>(child){ |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
* |
|||
* Also deletes the subtree |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~Not() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractLtlFormula<T>* clone() const override { |
|||
Not<T>* result = new Not<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<INotModelChecker>()->checkNot(*this); |
|||
} |
|||
|
|||
virtual void visit(visitor::AbstractLtlFormulaVisitor<T>& visitor) const override { |
|||
visitor.template as<INotVisitor>()->visitNot(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace ltl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_LTL_NOT_H_ */ |
@ -1,141 +0,0 @@ |
|||
/* |
|||
* Or.h |
|||
* |
|||
* Created on: 22.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_LTL_OR_H_ |
|||
#define STORM_FORMULA_LTL_OR_H_ |
|||
|
|||
#include "AbstractLtlFormula.h" |
|||
#include "src/formula/abstract/Or.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
|
|||
template <class T> class Or; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support And. |
|||
* |
|||
* All model checkers that support the formula class And must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IOrModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates And formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkOr(const Or<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief Interface class for visitors that support Or. |
|||
* |
|||
* All visitors that support the formula class Or must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IOrVisitor { |
|||
public: |
|||
/*! |
|||
* @brief Visits Or formula. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual void visitOr(const Or<T>& obj) = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with OR node as root. |
|||
* |
|||
* Has two LTL formulas as sub formulas/trees. |
|||
* |
|||
* As OR is commutative, the order is \e theoretically not important, but will influence the order in which |
|||
* the model checker works. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractLtlFormula |
|||
*/ |
|||
template <class T> |
|||
class Or: public storm::property::abstract::Or<T, AbstractLtlFormula<T>>, |
|||
public storm::property::ltl::AbstractLtlFormula<T> { |
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Or() { |
|||
// Intentionally left empty |
|||
|
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* Creates an OR node with the parameters as subtrees. |
|||
* |
|||
* @param left The left subformula |
|||
* @param right The right subformula |
|||
*/ |
|||
Or(AbstractLtlFormula<T>* left, AbstractLtlFormula<T>* right) |
|||
: storm::property::abstract::Or<T,AbstractLtlFormula<T>>(left, right) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~Or() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractLtlFormula<T>* clone() const override { |
|||
Or<T>* result = new Or(); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IOrModelChecker>()->checkOr(*this); |
|||
} |
|||
|
|||
virtual void visit(visitor::AbstractLtlFormulaVisitor<T>& visitor) const override { |
|||
visitor.template as<IOrVisitor>()->visitOr(*this); |
|||
} |
|||
|
|||
}; |
|||
|
|||
} /* namespace ltl */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
#endif /* OR_H_ */ |
@ -1,157 +0,0 @@ |
|||
/* |
|||
* Until.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_LTL_UNTIL_H_ |
|||
#define STORM_FORMULA_LTL_UNTIL_H_ |
|||
|
|||
#include "AbstractLtlFormula.h" |
|||
#include "src/formula/abstract/Until.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
|
|||
template <class T> class Until; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Until. |
|||
* |
|||
* All model checkers that support the formula class Until must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IUntilModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Until formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkUntil(const Until<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief Interface class for visitors that support Until. |
|||
* |
|||
* All visitors that support the formula class Until must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IUntilVisitor { |
|||
public: |
|||
/*! |
|||
* @brief Visits Until formula. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual void visitUntil(const Until<T>& obj) = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with an Until node as root. |
|||
* |
|||
* Has two Abstract LTL formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff eventually, formula \e right (the right subtree) holds, and before, |
|||
* \e left holds always. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractLtlFormula |
|||
*/ |
|||
template <class T> |
|||
class Until : public storm::property::abstract::Until<T, AbstractLtlFormula<T>>, |
|||
public AbstractLtlFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Until() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param left The left formula subtree |
|||
* @param right The left formula subtree |
|||
*/ |
|||
Until(AbstractLtlFormula<T>* left, AbstractLtlFormula<T>* right) |
|||
: storm::property::abstract::Until<T, AbstractLtlFormula<T>>(left, right) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~Until() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* @brief Return string representation of this formula. |
|||
* |
|||
* In LTL, brackets are needed around the until, as Until may appear nested (in other logics, Until always is the |
|||
* root of a path formula); hence this function is overwritten in this class. |
|||
* |
|||
* @return A string representation of the formula. |
|||
*/ |
|||
virtual std::string toString() const { |
|||
return "(" + storm::property::abstract::Until<T, AbstractLtlFormula<T>>::toString() + ")"; |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractLtlFormula<T>* clone() const override { |
|||
Until<T>* result = new Until(); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const { |
|||
return modelChecker.template as<IUntilModelChecker>()->checkUntil(*this); |
|||
} |
|||
|
|||
virtual void visit(visitor::AbstractLtlFormulaVisitor<T>& visitor) const override { |
|||
visitor.template as<IUntilVisitor>()->visitUntil(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace ltl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_LTL_UNTIL_H_ */ |
@ -1,16 +0,0 @@ |
|||
/*
|
|||
* AbstractLtlFormulaVisitor.cpp |
|||
* |
|||
* Created on: 29.05.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#include "AbstractLtlFormulaVisitor.h"
|
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace visitor { |
|||
|
|||
} /* namespace visitor */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
@ -1,72 +0,0 @@ |
|||
/* |
|||
* AbstractLtlFormulaVisitor.h |
|||
* |
|||
* Created on: 29.05.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_PROPERTY_LTL_VISITOR_ABSTRACTLTLFORMULAVISITOR_H_ |
|||
#define STORM_PROPERTY_LTL_VISITOR_ABSTRACTLTLFORMULAVISITOR_H_ |
|||
|
|||
// Forward declaration of visitor |
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
namespace visitor { |
|||
|
|||
template <class T> |
|||
class AbstractLtlFormulaVisitor; |
|||
|
|||
} /* namespace visitor */ |
|||
} |
|||
} |
|||
} |
|||
|
|||
#include "../AbstractLtlFormula.h" |
|||
#include "log4cplus/logger.h" |
|||
#include "log4cplus/loggingmacros.h" |
|||
|
|||
#include <typeinfo> |
|||
|
|||
extern log4cplus::Logger logger; |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
namespace visitor { |
|||
|
|||
template <class T> |
|||
class AbstractLtlFormulaVisitor { |
|||
public: |
|||
virtual ~AbstractLtlFormulaVisitor() { |
|||
// TODO Auto-generated destructor stub |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Returns a pointer to the model checker object that is of the requested type as given by the template parameters. |
|||
* @returns A pointer to the model checker object that is of the requested type as given by the template parameters. |
|||
* If the model checker is not of the requested type, type casting will fail and result in an exception. |
|||
*/ |
|||
template <template <class Type> class Target> |
|||
Target<T>* as() { |
|||
try { |
|||
Target<T>* target = dynamic_cast<Target<T>*>(this); |
|||
return target; |
|||
} catch (std::bad_cast& bc) { |
|||
LOG4CPLUS_ERROR(logger, "Bad cast: tried to cast " << typeid(*this).name() << " to " << typeid(Target<T>).name() << "."); |
|||
throw bc; |
|||
} |
|||
return nullptr; |
|||
} |
|||
|
|||
void visit(storm::property::ltl::AbstractLtlFormula<T> const& formula) { |
|||
formula.visit(*this); |
|||
} |
|||
}; |
|||
|
|||
} /* namespace visitor */ |
|||
} /* namespace ltl*/ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
#endif /* STORM_PROPERTY_LTL_VISITOR_ABSTRACTLTLFORMULAVISITOR_H_ */ |
@ -1,42 +0,0 @@ |
|||
/* |
|||
* Prctl.h |
|||
* |
|||
* Created on: 06.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_H_ |
|||
#define STORM_FORMULA_PRCTL_H_ |
|||
|
|||
#include "modelchecker/prctl/ForwardDeclarations.h" |
|||
|
|||
#include "Prctl/And.h" |
|||
#include "Prctl/Ap.h" |
|||
#include "Prctl/BoundedUntil.h" |
|||
#include "Prctl/BoundedNaryUntil.h" |
|||
#include "Prctl/Next.h" |
|||
#include "Prctl/Not.h" |
|||
#include "Prctl/Or.h" |
|||
#include "Prctl/ProbabilisticNoBoundOperator.h" |
|||
#include "Prctl/ProbabilisticBoundOperator.h" |
|||
|
|||
#include "Prctl/Until.h" |
|||
#include "Prctl/Eventually.h" |
|||
#include "Prctl/Globally.h" |
|||
#include "Prctl/BoundedEventually.h" |
|||
|
|||
#include "Prctl/InstantaneousReward.h" |
|||
#include "Prctl/CumulativeReward.h" |
|||
#include "Prctl/ReachabilityReward.h" |
|||
#include "Prctl/RewardBoundOperator.h" |
|||
#include "Prctl/RewardNoBoundOperator.h" |
|||
#include "Prctl/SteadyStateReward.h" |
|||
|
|||
#include "Prctl/AbstractPrctlFormula.h" |
|||
#include "Prctl/AbstractStateFormula.h" |
|||
#include "Prctl/AbstractNoBoundOperator.h" |
|||
#include "Prctl/AbstractPathFormula.h" |
|||
|
|||
#include "modelchecker/prctl/AbstractModelChecker.h" |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_H_ */ |
@ -1,83 +0,0 @@ |
|||
/* |
|||
* AbstractNoBoundOperator.h |
|||
* |
|||
* Created on: 16.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_ABSTRACTNOBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_PRCTL_ABSTRACTNOBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractPrctlFormula.h" |
|||
#include "src/formula/abstract/IOptimizingOperator.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> |
|||
class AbstractNoBoundOperator; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support PathNoBoundOperator. |
|||
* |
|||
* All model checkers that support the formula class NoBoundOperator must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class INoBoundOperatorModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates NoBoundOperator formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkNoBoundOperator(const AbstractNoBoundOperator<T>& obj) const = 0; |
|||
|
|||
|
|||
}; |
|||
|
|||
/*! |
|||
* Interface class for all PRCTL No bound operators |
|||
*/ |
|||
template <class T> |
|||
class AbstractNoBoundOperator: public AbstractPrctlFormula<T>, |
|||
public virtual storm::property::abstract::IOptimizingOperator { |
|||
public: |
|||
AbstractNoBoundOperator() { |
|||
// Intentionally left empty. |
|||
|
|||
} |
|||
virtual ~AbstractNoBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @note This function is not implemented in this class. |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractNoBoundOperator<T>* clone() const = 0; |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @note This function is not implemented in this class. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const = 0; |
|||
}; |
|||
|
|||
} /* namespace prctl */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
#endif /* STORM_FORMULA_PRCTL_ABSTRACTNOBOUNDOPERATOR_H_ */ |
@ -1,31 +0,0 @@ |
|||
/* |
|||
* AbstractPrctlFormula.h |
|||
* |
|||
* Created on: 16.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_ABSTRACTPRCTLFORMULA_H_ |
|||
#define STORM_FORMULA_PRCTL_ABSTRACTPRCTLFORMULA_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
/*! |
|||
* Interface class for all PRCTL root formulas. |
|||
*/ |
|||
template<class T> |
|||
class AbstractPrctlFormula : public virtual storm::property::abstract::AbstractFormula<T> { |
|||
public: |
|||
virtual ~AbstractPrctlFormula() { |
|||
// Intentionally left empty |
|||
} |
|||
}; |
|||
|
|||
} /* namespace prctl */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
#endif /* ABSTRACTPRCTLFORMULA_H_ */ |
@ -1,129 +0,0 @@ |
|||
/* |
|||
* And.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_AND_H_ |
|||
#define STORM_FORMULA_PRCTL_AND_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/And.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/modelchecker/prctl/ForwardDeclarations.h" |
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class And; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support And. |
|||
* |
|||
* All model checkers that support the formula class And must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IAndModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates And formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual storm::storage::BitVector checkAnd(const And<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with AND node as root. |
|||
* |
|||
* Has two Abstract state formulas as sub formulas/trees. |
|||
* |
|||
* As AND is commutative, the order is \e theoretically not important, but will influence the order in which |
|||
* the model checker works. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class And : public storm::property::abstract::And<T, AbstractStateFormula<T>>, public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor. |
|||
* Will create an AND-node without subnotes. Will not represent a complete formula! |
|||
*/ |
|||
And() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* Creates an AND note with the parameters as subtrees. |
|||
* |
|||
* @param left The left sub formula |
|||
* @param right The right sub formula |
|||
*/ |
|||
And(AbstractStateFormula<T>* left, AbstractStateFormula<T>* right) |
|||
: storm::property::abstract::And<T, AbstractStateFormula<T>>(left, right) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* The subtrees are deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~And() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
And<T>* result = new And(); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IAndModelChecker>()->checkAnd(*this); |
|||
} |
|||
|
|||
}; |
|||
|
|||
} //namespace prctl |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_AND_H_ */ |
@ -1,106 +0,0 @@ |
|||
/* |
|||
* Ap.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_AP_H_ |
|||
#define STORM_FORMULA_PRCTL_AP_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/Ap.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/modelchecker/prctl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class Ap; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Ap. |
|||
* |
|||
* All model checkers that support the formula class Ap must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IApModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Ap formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual storm::storage::BitVector checkAp(const Ap<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with atomic proposition as root. |
|||
* |
|||
* This class represents the leaves in the formula tree. |
|||
* |
|||
* @see AbstractPrctlFormula |
|||
* @see AbstractStateFormula |
|||
*/ |
|||
template <class T> |
|||
class Ap : public storm::property::abstract::Ap<T>, |
|||
public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Constructor |
|||
* |
|||
* Creates a new atomic proposition leaf, with the label Ap |
|||
* |
|||
* @param ap The string representing the atomic proposition |
|||
*/ |
|||
Ap(std::string ap) |
|||
: storm::property::abstract::Ap<T>(ap) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* At this time, empty... |
|||
*/ |
|||
virtual ~Ap() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
return new Ap(this->getAp()); |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IApModelChecker>()->checkAp(*this); |
|||
} |
|||
|
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_AP_H_ */ |
@ -1,126 +0,0 @@ |
|||
/* |
|||
* BoundedUntil.h |
|||
* |
|||
* Created on: 27.11.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_BOUNDEDEVENTUALLY_H_ |
|||
#define STORM_FORMULA_PRCTL_BOUNDEDEVENTUALLY_H_ |
|||
|
|||
#include "src/formula/abstract/BoundedEventually.h" |
|||
#include "src/formula/Prctl/AbstractPathFormula.h" |
|||
#include "src/formula/Prctl/AbstractStateFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include <cstdint> |
|||
#include <string> |
|||
#include "src/modelchecker/prctl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl{ |
|||
|
|||
template <class T> class BoundedEventually; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support BoundedEventually. |
|||
* |
|||
* All model checkers that support the formula class BoundedEventually must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IBoundedEventuallyModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates BoundedEventually formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkBoundedEventually(const BoundedEventually<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a BoundedEventually node as root. |
|||
* |
|||
* Has one Abstract state formulas as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff in at most \e bound steps, formula \e child holds. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class BoundedEventually : public storm::property::abstract::BoundedEventually<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
BoundedEventually() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child formula subtree |
|||
* @param bound The maximal number of steps |
|||
*/ |
|||
BoundedEventually(AbstractStateFormula<T>* child, uint_fast64_t bound) : |
|||
storm::property::abstract::BoundedEventually<T, AbstractStateFormula<T>>(child, bound){ |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~BoundedEventually() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
BoundedEventually<T>* result = new BoundedEventually<T>(); |
|||
result->setBound(this->getBound()); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<IBoundedEventuallyModelChecker>()->checkBoundedEventually(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_BOUNDEDUNTIL_H_ */ |
@ -1,141 +0,0 @@ |
|||
/* |
|||
* BoundedNaryUntil.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_BOUNDEDNARYUNTIL_H_ |
|||
#define STORM_FORMULA_PRCTL_BOUNDEDNARYUNTIL_H_ |
|||
|
|||
#include "src/formula/abstract/BoundedNaryUntil.h" |
|||
#include "src/formula/Prctl/AbstractPathFormula.h" |
|||
#include "src/formula/Prctl/AbstractStateFormula.h" |
|||
#include <cstdint> |
|||
#include <string> |
|||
#include <vector> |
|||
#include <tuple> |
|||
#include <sstream> |
|||
#include "src/modelchecker/prctl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
|
|||
template <class T> class BoundedNaryUntil; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support BoundedNaryUntil. |
|||
* |
|||
* All model checkers that support the formula class BoundedNaryUntil must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IBoundedNaryUntilModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates BoundedNaryUntil formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkBoundedNaryUntil(const BoundedNaryUntil<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a BoundedNaryUntil node as root. |
|||
* |
|||
* Has at least two Abstract state formulas as sub formulas and an interval |
|||
* associated with all but the first sub formula. We'll call the first one |
|||
* \e left and all other one \e right. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff \e left holds until eventually any of the \e right |
|||
* formulas holds after a number of steps contained in the interval |
|||
* associated with this formula. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class BoundedNaryUntil : public storm::property::abstract::BoundedNaryUntil<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
BoundedNaryUntil() { |
|||
|
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param left The left formula subtree |
|||
* @param right The left formula subtree |
|||
*/ |
|||
BoundedNaryUntil(AbstractStateFormula<T>* left, std::vector<std::tuple<AbstractStateFormula<T>*,T,T>>* right) : |
|||
storm::property::abstract::BoundedNaryUntil<T, AbstractStateFormula<T>>(left, right){ |
|||
|
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~BoundedNaryUntil() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedNaryUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
BoundedNaryUntil<T>* result = new BoundedNaryUntil<T>(); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
std::vector<std::tuple<AbstractStateFormula<T>*,T,T>>* newright = new std::vector<std::tuple<AbstractStateFormula<T>*,T,T>>(); |
|||
for (auto it = this->right->begin(); it != this->right->end(); ++it) { |
|||
newright->push_back(std::tuple<AbstractStateFormula<T>*,T,T>(std::get<0>(*it)->clone(), std::get<1>(*it), std::get<2>(*it))); |
|||
} |
|||
result->setRight(newright); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<IBoundedNaryUntilModelChecker>()->checkBoundedNaryUntil(*this, qualitative); |
|||
} |
|||
|
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_BOUNDEDNARYUNTIL_H_ */ |
@ -1,131 +0,0 @@ |
|||
/* |
|||
* BoundedUntil.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_BOUNDEDUNTIL_H_ |
|||
#define STORM_FORMULA_PRCTL_BOUNDEDUNTIL_H_ |
|||
|
|||
#include "src/formula/abstract/BoundedUntil.h" |
|||
#include "src/formula/Prctl/AbstractPathFormula.h" |
|||
#include "src/formula/Prctl/AbstractStateFormula.h" |
|||
#include <cstdint> |
|||
#include <string> |
|||
#include "src/modelchecker/prctl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class BoundedUntil; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support BoundedUntil. |
|||
* |
|||
* All model checkers that support the formula class BoundedUntil must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IBoundedUntilModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates BoundedUntil formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkBoundedUntil(const BoundedUntil<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a BoundedUntil node as root. |
|||
* |
|||
* Has two Abstract state formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff in at most \e bound steps, formula \e right (the right subtree) holds, and before, |
|||
* \e left holds. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class BoundedUntil : public storm::property::abstract::BoundedUntil<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
BoundedUntil() { |
|||
//Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param left The left formula subtree |
|||
* @param right The left formula subtree |
|||
* @param bound The maximal number of steps |
|||
*/ |
|||
BoundedUntil(AbstractStateFormula<T>* left, AbstractStateFormula<T>* right, |
|||
uint_fast64_t bound) : |
|||
storm::property::abstract::BoundedUntil<T, AbstractStateFormula<T>>(left,right,bound) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~BoundedUntil() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
BoundedUntil<T>* result = new BoundedUntil<T>(); |
|||
result->setBound(this->getBound()); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<IBoundedUntilModelChecker>()->checkBoundedUntil(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_BOUNDEDUNTIL_H_ */ |
@ -1,110 +0,0 @@ |
|||
/* |
|||
* InstantaneousReward.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_CUMULATIVEREWARD_H_ |
|||
#define STORM_FORMULA_PRCTL_CUMULATIVEREWARD_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/CumulativeReward.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class CumulativeReward; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support CumulativeReward. |
|||
* |
|||
* All model checkers that support the formula class CumulativeReward must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class ICumulativeRewardModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates CumulativeReward formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkCumulativeReward(const CumulativeReward<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Cumulative Reward node as root. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class CumulativeReward : public storm::property::abstract::CumulativeReward<T>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
CumulativeReward() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param bound The time bound of the reward formula |
|||
*/ |
|||
CumulativeReward(T bound) : |
|||
storm::property::abstract::CumulativeReward<T>(bound) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Empty destructor. |
|||
*/ |
|||
virtual ~CumulativeReward() { |
|||
// Intentionally left empty. |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new CumulativeReward-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
return new CumulativeReward(this->getBound()); |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<ICumulativeRewardModelChecker>()->checkCumulativeReward(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_INSTANTANEOUSREWARD_H_ */ |
@ -1,120 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_EVENTUALLY_H_ |
|||
#define STORM_FORMULA_PRCTL_EVENTUALLY_H_ |
|||
|
|||
#include "src/formula/abstract/Eventually.h" |
|||
#include "src/formula/Prctl/AbstractPathFormula.h" |
|||
#include "src/formula/Prctl/AbstractStateFormula.h" |
|||
#include "src/modelchecker/prctl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class Eventually; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Eventually. |
|||
* |
|||
* All model checkers that support the formula class Eventually must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IEventuallyModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Eventually formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkEventually(const Eventually<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with an Eventually node as root. |
|||
* |
|||
* Has one Abstract state formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff eventually \e child holds. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to nullptr before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class Eventually : public storm::property::abstract::Eventually<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Eventually() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Eventually(AbstractStateFormula<T>* child) |
|||
: storm::property::abstract::Eventually<T, AbstractStateFormula<T>>(child) { |
|||
|
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to nullptr before deletion) |
|||
*/ |
|||
virtual ~Eventually() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new Eventually-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
Eventually<T>* result = new Eventually<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<IEventuallyModelChecker>()->checkEventually(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_EVENTUALLY_H_ */ |
@ -1,122 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_GLOBALLY_H_ |
|||
#define STORM_FORMULA_PRCTL_GLOBALLY_H_ |
|||
|
|||
#include "src/formula/abstract/Globally.h" |
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/modelchecker/prctl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class Globally; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Globally. |
|||
* |
|||
* All model checkers that support the formula class Globally must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IGloballyModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Globally formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkGlobally(const Globally<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Globally node as root. |
|||
* |
|||
* Has one Abstract state formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff globally \e child holds. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to nullptr before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class Globally : public storm::property::abstract::Globally<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Globally() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Globally(AbstractStateFormula<T>* child) |
|||
: storm::property::abstract::Globally<T, AbstractStateFormula<T>>(child) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to nullptr before deletion) |
|||
*/ |
|||
virtual ~Globally() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new Globally-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
Globally<T>* result = new Globally<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<IGloballyModelChecker>()->checkGlobally(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_GLOBALLY_H_ */ |
@ -1,111 +0,0 @@ |
|||
/* |
|||
* InstantaneousReward.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_INSTANTANEOUSREWARD_H_ |
|||
#define STORM_FORMULA_PRCTL_INSTANTANEOUSREWARD_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/InstantaneousReward.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include <cstdint> |
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class InstantaneousReward; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support InstantaneousReward. |
|||
* |
|||
* All model checkers that support the formula class InstantaneousReward must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IInstantaneousRewardModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates InstantaneousReward formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkInstantaneousReward(const InstantaneousReward<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Instantaneous Reward node as root. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class InstantaneousReward : public storm::property::abstract::InstantaneousReward<T>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
InstantaneousReward() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param bound The time instance of the reward formula |
|||
*/ |
|||
InstantaneousReward(uint_fast64_t bound) : |
|||
storm::property::abstract::InstantaneousReward<T>(bound) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Empty destructor. |
|||
*/ |
|||
virtual ~InstantaneousReward() { |
|||
// Intentionally left empty. |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new InstantaneousReward-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
return new InstantaneousReward(this->getBound()); |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<IInstantaneousRewardModelChecker>()->checkInstantaneousReward(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_INSTANTANEOUSREWARD_H_ */ |
@ -1,120 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_NEXT_H_ |
|||
#define STORM_FORMULA_PRCTL_NEXT_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/Next.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class Next; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Next. |
|||
* |
|||
* All model checkers that support the formula class Next must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class INextModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Next formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkNext(const Next<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Next node as root. |
|||
* |
|||
* Has two Abstract state formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff in the next step, \e child holds |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class Next : public storm::property::abstract::Next<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Next() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Next(AbstractStateFormula<T>* child) |
|||
: storm::property::abstract::Next<T, AbstractStateFormula<T>>(child) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~Next() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
Next<T>* result = new Next<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<INextModelChecker>()->checkNext(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_NEXT_H_ */ |
@ -1,116 +0,0 @@ |
|||
/* |
|||
* Not.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_NOT_H_ |
|||
#define STORM_FORMULA_PRCTL_NOT_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/Not.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/modelchecker/prctl/ForwardDeclarations.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class Not; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Not. |
|||
* |
|||
* All model checkers that support the formula class Not must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class INotModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Not formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual storm::storage::BitVector checkNot(const Not<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with NOT node as root. |
|||
* |
|||
* Has one Abstract state formula as sub formula/tree. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class Not : public storm::property::abstract::Not<T, AbstractStateFormula<T>>, |
|||
public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Not() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* @param child The child node |
|||
*/ |
|||
Not(AbstractStateFormula<T>* child) : |
|||
storm::property::abstract::Not<T, AbstractStateFormula<T>>(child){ |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
* |
|||
* Also deletes the subtree |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~Not() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
Not<T>* result = new Not<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<INotModelChecker>()->checkNot(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_NOT_H_ */ |
@ -1,125 +0,0 @@ |
|||
/* |
|||
* Or.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_OR_H_ |
|||
#define STORM_FORMULA_PRCTL_OR_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/Or.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class Or; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Or. |
|||
* |
|||
* All model checkers that support the formula class Or must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IOrModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Or formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual storm::storage::BitVector checkOr(const Or<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with OR node as root. |
|||
* |
|||
* Has two Abstract state formulas as sub formulas/trees. |
|||
* |
|||
* As OR is commutative, the order is \e theoretically not important, but will influence the order in which |
|||
* the model checker works. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class Or : public storm::property::abstract::Or<T, AbstractStateFormula<T>>, |
|||
public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor. |
|||
* Will create an OR-node without subnotes. The result does not represent a complete formula! |
|||
*/ |
|||
Or() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* Creates an OR note with the parameters as subtrees. |
|||
* |
|||
* @param left The left sub formula |
|||
* @param right The right sub formula |
|||
*/ |
|||
Or(AbstractStateFormula<T>* left, AbstractStateFormula<T>* right) : |
|||
storm::property::abstract::Or<T, AbstractStateFormula<T>>(left, right) { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* The subtrees are deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~Or() { |
|||
//intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
Or<T>* result = new Or(); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IOrModelChecker>()->checkOr(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_OR_H_ */ |
@ -1,139 +0,0 @@ |
|||
/* |
|||
* ProbabilisticBoundOperator.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_PROBABILISTICBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_PRCTL_PROBABILISTICBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractStateFormula.h" |
|||
#include "AbstractPathFormula.h" |
|||
#include "src/formula/abstract/ProbabilisticBoundOperator.h" |
|||
#include "utility/constants.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class ProbabilisticBoundOperator; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support ProbabilisticBoundOperator. |
|||
* |
|||
* All model checkers that support the formula class PathBoundOperator must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IProbabilisticBoundOperatorModelChecker { |
|||
public: |
|||
virtual storm::storage::BitVector checkProbabilisticBoundOperator(const ProbabilisticBoundOperator<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a P (probablistic) operator node over a probability interval |
|||
* as root. |
|||
* |
|||
* Has one Abstract path formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff the probability that the path formula holds is inside the bounds |
|||
* specified in this operator |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractPathFormula |
|||
* @see ProbabilisticOperator |
|||
* @see ProbabilisticNoBoundsOperator |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template<class T> |
|||
class ProbabilisticBoundOperator : public storm::property::abstract::ProbabilisticBoundOperator<T, AbstractPathFormula<T>>, |
|||
public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
ProbabilisticBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param comparisonRelation The relation to compare the actual value and the bound |
|||
* @param bound The bound for the probability |
|||
* @param pathFormula The child node |
|||
*/ |
|||
ProbabilisticBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, |
|||
T bound, |
|||
AbstractPathFormula<T>* pathFormula) |
|||
: storm::property::abstract::ProbabilisticBoundOperator<T, AbstractPathFormula<T>>(comparisonRelation, bound, pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @param comparisonRelation |
|||
* @param bound |
|||
* @param pathFormula |
|||
* @param minimumOperator |
|||
*/ |
|||
ProbabilisticBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, |
|||
T bound, |
|||
AbstractPathFormula<T>* pathFormula, |
|||
bool minimumOperator) |
|||
: storm::property::abstract::ProbabilisticBoundOperator<T, AbstractPathFormula<T>>(comparisonRelation, bound, pathFormula, minimumOperator){ |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
*/ |
|||
virtual ~ProbabilisticBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
ProbabilisticBoundOperator<T>* result = new ProbabilisticBoundOperator<T>(); |
|||
result->setComparisonOperator(this->getComparisonOperator()); |
|||
result->setBound(this->getBound()); |
|||
result->setPathFormula(this->getPathFormula().clone()); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IProbabilisticBoundOperatorModelChecker>()->checkProbabilisticBoundOperator(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_PROBABILISTICBOUNDOPERATOR_H_ */ |
@ -1,115 +0,0 @@ |
|||
/* |
|||
* ProbabilisticNoBoundOperator.h |
|||
* |
|||
* Created on: 12.12.2012 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_PROBABILISTICNOBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_PRCTL_PROBABILISTICNOBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractNoBoundOperator.h" |
|||
#include "src/formula/abstract/ProbabilisticNoBoundOperator.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a P (probablistic) operator without declaration of probabilities |
|||
* as root. |
|||
* |
|||
* Checking a formula with this operator as root returns the probabilities that the path formula holds |
|||
* (for each state) |
|||
* |
|||
* Has one Abstract path formula as sub formula/tree. |
|||
* |
|||
* @note |
|||
* This class is a hybrid of a state and path formula, and may only appear as the outermost operator. |
|||
* Hence, it is seen as neither a state nor a path formula, but is directly derived from AbstractFormula. |
|||
* |
|||
* @note |
|||
* This class does not contain a check() method like the other formula classes. |
|||
* The check method should only be called by the model checker to infer the correct check function for sub |
|||
* formulas. As this operator can only appear at the root, the method is not useful here. |
|||
* Use the checkProbabilisticNoBoundOperator method from the DtmcPrctlModelChecker class instead. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractPathFormula |
|||
* @see ProbabilisticOperator |
|||
* @see ProbabilisticIntervalOperator |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class ProbabilisticNoBoundOperator: public storm::property::abstract::ProbabilisticNoBoundOperator<T, AbstractPathFormula<T>>, |
|||
public AbstractNoBoundOperator<T> { |
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
ProbabilisticNoBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
*/ |
|||
ProbabilisticNoBoundOperator(AbstractPathFormula<T>* pathFormula) |
|||
: storm::property::abstract::ProbabilisticNoBoundOperator<T, AbstractPathFormula<T>>(pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
*/ |
|||
ProbabilisticNoBoundOperator(AbstractPathFormula<T>* pathFormula, bool minimumOperator) |
|||
: storm::property::abstract::ProbabilisticNoBoundOperator<T, AbstractPathFormula<T>>(pathFormula, minimumOperator) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~ProbabilisticNoBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
virtual AbstractNoBoundOperator<T>* clone() const override { |
|||
ProbabilisticNoBoundOperator<T>* result = new ProbabilisticNoBoundOperator<T>(); |
|||
if (this->pathFormulaIsSet()) { |
|||
result->setPathFormula(this->getPathFormula().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @note This function is not implemented in this class. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const override { |
|||
return this->getPathFormula().check(modelChecker, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_PROBABILISTICNOBOUNDOPERATOR_H_ */ |
@ -1,117 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_REACHABILITYREWARD_H_ |
|||
#define STORM_FORMULA_PRCTL_REACHABILITYREWARD_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "../abstract/Eventually.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class ReachabilityReward; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support ReachabilityReward. |
|||
* |
|||
* All model checkers that support the formula class ReachabilityReward must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IReachabilityRewardModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates ReachabilityReward formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkReachabilityReward(const ReachabilityReward<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with an Reachability Reward node as root. |
|||
* |
|||
* Has one Abstract state formula as sub formula/tree. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to nullptr before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class ReachabilityReward : public storm::property::abstract::Eventually<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
ReachabilityReward() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
ReachabilityReward(AbstractStateFormula<T>* child) : |
|||
storm::property::abstract::Eventually<T, AbstractStateFormula<T>>(child){ |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to nullptr before deletion) |
|||
*/ |
|||
virtual ~ReachabilityReward() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new ReachabilityReward-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
ReachabilityReward<T>* result = new ReachabilityReward<T>(); |
|||
if (this->childIsSet()) { |
|||
result->setChild(this->getChild().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<IReachabilityRewardModelChecker>()->checkReachabilityReward(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_REACHABILITYREWARD_H_ */ |
@ -1,132 +0,0 @@ |
|||
/* |
|||
* RewardBoundOperator.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_REWARDBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_PRCTL_REWARDBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/RewardBoundOperator.h" |
|||
#include "utility/constants.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class RewardBoundOperator; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support RewardBoundOperator. |
|||
* |
|||
* All model checkers that support the formula class PathBoundOperator must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IRewardBoundOperatorModelChecker { |
|||
public: |
|||
virtual storm::storage::BitVector checkRewardBoundOperator(const RewardBoundOperator<T>& obj) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a R (reward) operator node over a reward interval as root. |
|||
* |
|||
* Has a reward path formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff the reward of the reward path formula is inside the bounds |
|||
* specified in this operator |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractPathFormula |
|||
* @see ProbabilisticOperator |
|||
* @see ProbabilisticNoBoundsOperator |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template<class T> |
|||
class RewardBoundOperator : public storm::property::abstract::RewardBoundOperator<T, AbstractPathFormula<T>>, |
|||
public AbstractStateFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
RewardBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param comparisonRelation The relation to compare the actual value and the bound |
|||
* @param bound The bound for the probability |
|||
* @param pathFormula The child node |
|||
*/ |
|||
RewardBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, |
|||
T bound, |
|||
AbstractPathFormula<T>* pathFormula) : |
|||
storm::property::abstract::RewardBoundOperator<T, AbstractPathFormula<T>>(comparisonRelation, bound, pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param comparisonRelation |
|||
* @param bound |
|||
* @param pathFormula |
|||
* @param minimumOperator |
|||
*/ |
|||
RewardBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, |
|||
T bound, |
|||
AbstractPathFormula<T>* pathFormula, |
|||
bool minimumOperator) |
|||
: storm::property::abstract::RewardBoundOperator<T, AbstractPathFormula<T>>(comparisonRelation, bound, pathFormula, minimumOperator) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new AND-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractStateFormula<T>* clone() const override { |
|||
RewardBoundOperator<T>* result = new RewardBoundOperator<T>(); |
|||
result->setComparisonOperator(this->getComparisonOperator()); |
|||
result->setBound(this->getBound()); |
|||
result->setPathFormula(this->getPathFormula().clone()); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A bit vector indicating all states that satisfy the formula represented by the called object. |
|||
*/ |
|||
virtual storm::storage::BitVector check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const override { |
|||
return modelChecker.template as<IRewardBoundOperatorModelChecker>()->checkRewardBoundOperator(*this); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_REWARDBOUNDOPERATOR_H_ */ |
@ -1,108 +0,0 @@ |
|||
/* |
|||
* RewardNoBoundOperator.h |
|||
* |
|||
* Created on: 25.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_REWARDNOBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_PRCTL_REWARDNOBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractNoBoundOperator.h" |
|||
#include "AbstractPathFormula.h" |
|||
#include "src/formula/abstract/RewardNoBoundOperator.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a R (reward) operator without declaration of reward values |
|||
* as root. |
|||
* |
|||
* Checking a formula with this operator as root returns the reward for the reward path formula for |
|||
* each state |
|||
* |
|||
* Has one Abstract path formula as sub formula/tree. |
|||
* |
|||
* @note |
|||
* This class is a hybrid of a state and path formula, and may only appear as the outermost operator. |
|||
* Hence, it is seen as neither a state nor a path formula, but is directly derived from AbstractFormula. |
|||
* |
|||
* @note |
|||
* This class does not contain a check() method like the other formula classes. |
|||
* The check method should only be called by the model checker to infer the correct check function for sub |
|||
* formulas. As this operator can only appear at the root, the method is not useful here. |
|||
* Use the checkRewardNoBoundOperator method from the DtmcPrctlModelChecker class instead. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* |
|||
* @see AbstractStateFormula |
|||
* @see AbstractPathFormula |
|||
* @see ProbabilisticOperator |
|||
* @see ProbabilisticIntervalOperator |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class RewardNoBoundOperator: public storm::property::abstract::RewardNoBoundOperator<T, AbstractPathFormula<T>>, |
|||
public storm::property::prctl::AbstractNoBoundOperator<T> { |
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
RewardNoBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
*/ |
|||
RewardNoBoundOperator(AbstractPathFormula<T>* pathFormula) |
|||
: storm::property::abstract::RewardNoBoundOperator<T, AbstractPathFormula<T>>(pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
*/ |
|||
RewardNoBoundOperator(AbstractPathFormula<T>* pathFormula, bool minimumOperator) |
|||
: storm::property::abstract::RewardNoBoundOperator<T, AbstractPathFormula<T>>(pathFormula, minimumOperator) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
virtual AbstractNoBoundOperator<T>* clone() const override { |
|||
RewardNoBoundOperator<T>* result = new RewardNoBoundOperator<T>(); |
|||
if (this->pathFormulaIsSet()) { |
|||
result->setPathFormula(this->getPathFormula().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @note This function is not implemented in this class. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const override { |
|||
return this->getPathFormula().check(modelChecker, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_REWARDNOBOUNDOPERATOR_H_ */ |
@ -1,91 +0,0 @@ |
|||
/* |
|||
* SteadyStateReward.h |
|||
* |
|||
* Created on: 08.04.2013 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_STEADYSTATEREWARD_H_ |
|||
#define STORM_FORMULA_PRCTL_STEADYSTATEREWARD_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/SteadyStateReward.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class SteadyStateReward; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support SteadyStateReward. |
|||
* |
|||
* All model checkers that support the formula class SteadyStateReward must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class ISteadyStateRewardModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates CumulativeReward formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkSteadyStateReward(const SteadyStateReward<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Steady State Reward node as root. |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class SteadyStateReward: public storm::property::abstract::SteadyStateReward<T>, |
|||
public AbstractPathFormula<T> { |
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
SteadyStateReward() { |
|||
// Intentionally left empty |
|||
|
|||
} |
|||
virtual ~SteadyStateReward() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new SteadyState-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
return new SteadyStateReward<T>(); |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<ISteadyStateRewardModelChecker>()->checkSteadyStateReward(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
#endif /* STORM_FORMULA_PRCTL_STEADYSTATEREWARD_H_ */ |
@ -1,125 +0,0 @@ |
|||
/* |
|||
* Until.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_PRCTL_UNTIL_H_ |
|||
#define STORM_FORMULA_PRCTL_UNTIL_H_ |
|||
|
|||
#include "AbstractPathFormula.h" |
|||
#include "AbstractStateFormula.h" |
|||
#include "src/formula/abstract/Until.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace prctl { |
|||
|
|||
template <class T> class Until; |
|||
|
|||
/*! |
|||
* @brief Interface class for model checkers that support Until. |
|||
* |
|||
* All model checkers that support the formula class Until must inherit |
|||
* this pure virtual class. |
|||
*/ |
|||
template <class T> |
|||
class IUntilModelChecker { |
|||
public: |
|||
/*! |
|||
* @brief Evaluates Until formula within a model checker. |
|||
* |
|||
* @param obj Formula object with subformulas. |
|||
* @return Result of the formula for every node. |
|||
*/ |
|||
virtual std::vector<T> checkUntil(const Until<T>& obj, bool qualitative) const = 0; |
|||
}; |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with an Until node as root. |
|||
* |
|||
* Has two Abstract state formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff eventually, formula \e right (the right subtree) holds, and before, |
|||
* \e left holds always. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractPrctlFormula |
|||
*/ |
|||
template <class T> |
|||
class Until : public storm::property::abstract::Until<T, AbstractStateFormula<T>>, |
|||
public AbstractPathFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Until() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param left The left formula subtree |
|||
* @param right The left formula subtree |
|||
*/ |
|||
Until(AbstractStateFormula<T>* left, AbstractStateFormula<T>* right) |
|||
: storm::property::abstract::Until<T, AbstractStateFormula<T>>(left, right) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~Until() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Clones the called object. |
|||
* |
|||
* Performs a "deep copy", i.e. the subtrees of the new object are clones of the original ones |
|||
* |
|||
* @returns a new BoundedUntil-object that is identical the called object. |
|||
*/ |
|||
virtual AbstractPathFormula<T>* clone() const override { |
|||
Until<T>* result = new Until(); |
|||
if (this->leftIsSet()) { |
|||
result->setLeft(this->getLeft().clone()); |
|||
} |
|||
if (this->rightIsSet()) { |
|||
result->setRight(this->getRight().clone()); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* Calls the model checker to check this formula. |
|||
* Needed to infer the correct type of formula class. |
|||
* |
|||
* @note This function should only be called in a generic check function of a model checker class. For other uses, |
|||
* the methods of the model checker should be used. |
|||
* |
|||
* @returns A vector indicating the probability that the formula holds for each state. |
|||
*/ |
|||
virtual std::vector<T> check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const override { |
|||
return modelChecker.template as<IUntilModelChecker>()->checkUntil(*this, qualitative); |
|||
} |
|||
}; |
|||
|
|||
} //namespace prctl |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_PRCTL_UNTIL_H_ */ |
@ -1,49 +0,0 @@ |
|||
#ifndef STORM_FORMULA_PRCTLFORMULACHECKER_H_ |
|||
#define STORM_FORMULA_PRCTLFORMULACHECKER_H_ |
|||
|
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/formula/Prctl.h" |
|||
|
|||
#include <iostream> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
|
|||
/*! |
|||
* @brief Checks formulas if they are within PRCTL. |
|||
* |
|||
* This class implements AbstractFormulaChecker to check if a given formula |
|||
* is part of PRCTL logic. |
|||
*/ |
|||
template <class T> |
|||
class PrctlFormulaChecker : public AbstractFormulaChecker<T> { |
|||
public: |
|||
/*! |
|||
* Implementation of AbstractFormulaChecker::validate() using code |
|||
* looking exactly like the sample code given there. |
|||
*/ |
|||
virtual bool validate(const storm::property::abstract::AbstractFormula<T>* formula) const { |
|||
// What to support: Principles of Model Checking Def. 10.76 + syntactic sugar |
|||
if ( |
|||
dynamic_cast<const storm::property::prctl::And<T>*>(formula) || |
|||
dynamic_cast<const storm::property::prctl::Ap<T>*>(formula) || |
|||
dynamic_cast<const storm::property::prctl::BoundedUntil<T>*>(formula) || |
|||
dynamic_cast<const storm::property::prctl::Eventually<T>*>(formula) || |
|||
dynamic_cast<const storm::property::prctl::Globally<T>*>(formula) || |
|||
dynamic_cast<const storm::property::prctl::Next<T>*>(formula) || |
|||
dynamic_cast<const storm::property::prctl::Not<T>*>(formula) || |
|||
dynamic_cast<const storm::property::prctl::Or<T>*>(formula) || |
|||
dynamic_cast<const storm::property::prctl::ProbabilisticNoBoundOperator<T>*>(formula) || |
|||
dynamic_cast<const storm::property::prctl::ProbabilisticBoundOperator<T>*>(formula) || |
|||
dynamic_cast<const storm::property::prctl::Until<T>*>(formula) |
|||
) { |
|||
return formula->validate(*this); |
|||
} |
|||
return false; |
|||
} |
|||
}; |
|||
|
|||
} // namespace property |
|||
} // namespace storm |
|||
|
|||
#endif |
@ -1,92 +0,0 @@ |
|||
/* |
|||
* Abstractformula.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_ABSTRACTFORMULA_H_ |
|||
#define STORM_FORMULA_ABSTRACT_ABSTRACTFORMULA_H_ |
|||
|
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
template <class T> class AbstractFormula; |
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
|
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
//abstract |
|||
/*! |
|||
* @brief Abstract base class for logic Abstract formulas in general. |
|||
* |
|||
* The namespace storm::property::abstract contains versions of the formula classes which are logic abstract, and contain |
|||
* the implementation which is not directly dependent on the logics. |
|||
* The classes for the subtrees are referenced by the template parameter FormulaType, which is typically instantiated in |
|||
* the derived classes of concrete logics. |
|||
* |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions "toString" and "validate" |
|||
* of the subformulas are needed. |
|||
* |
|||
* @note |
|||
* Even though the namespace is called "abstract", its classes may be completely implemented; abstract here denotes |
|||
* the abstraction from a concrete logic. |
|||
* |
|||
* @attention This class is abstract. |
|||
* @note Formula classes do not have copy constructors. The parameters of the constructors are usually the subtrees, so |
|||
* the syntax conflicts with copy constructors for unary operators. To produce an identical object, the classes |
|||
* AbstractFormula and AbstractFormula offer the method clone(). |
|||
* |
|||
* This is the base class for every formula class in every logic. |
|||
*/ |
|||
template <class T> |
|||
class AbstractFormula { |
|||
|
|||
public: |
|||
/*! |
|||
* Virtual destructor. |
|||
*/ |
|||
virtual ~AbstractFormula() { |
|||
// Intentionally left empty. |
|||
} |
|||
|
|||
/*! |
|||
* @brief Return string representation of this formula. |
|||
* |
|||
* @note every subclass must implement this method. |
|||
* |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const = 0; |
|||
|
|||
/*! |
|||
* @brief Checks if all subtrees are valid in some logic. |
|||
* |
|||
* @note Every subclass must implement this method. |
|||
* |
|||
* This method is given a checker object that knows which formula |
|||
* classes are allowed within the logic the checker represents. Every |
|||
* subclass is supposed to call checker.validate() for all child |
|||
* formulas and return true if and only if all those calls returned |
|||
* true. |
|||
* |
|||
* @param checker Checker object. |
|||
* @return true iff all subtrees are valid. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const = 0; |
|||
}; |
|||
|
|||
} // namespace abstract |
|||
} // namespace property |
|||
} // namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_ABSTRACTFORMULA_H_ */ |
@ -1,164 +0,0 @@ |
|||
/* |
|||
* And.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_AND_H_ |
|||
#define STORM_FORMULA_ABSTRACT_AND_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include <string> |
|||
#include <type_traits> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Logic-abstract Class for an abstract formula tree with AND node as root. |
|||
* |
|||
* Has two formulas as sub formulas/trees; the type is the template parameter FormulaType |
|||
* |
|||
* As AND is commutative, the order is \e theoretically not important, but will influence the order in which |
|||
* the model checker works. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractFormula |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "validate" of the subformulas are needed. |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class And : public virtual AbstractFormula<T> { |
|||
|
|||
// Throw a compiler error when FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::And<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor. |
|||
* Will create an AND-node without subnotes. Will not represent a complete formula! |
|||
*/ |
|||
And() { |
|||
left = NULL; |
|||
right = NULL; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* Creates an AND note with the parameters as subtrees. |
|||
* |
|||
* @param left The left sub formula |
|||
* @param right The right sub formula |
|||
*/ |
|||
And(FormulaType* left, FormulaType* right) { |
|||
this->left = left; |
|||
this->right = right; |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* The subtrees are deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~And() { |
|||
if (left != NULL) { |
|||
delete left; |
|||
} |
|||
if (right != NULL) { |
|||
delete right; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* Sets the left child node. |
|||
* |
|||
* @param newLeft the new left child. |
|||
*/ |
|||
void setLeft(FormulaType* newLeft) { |
|||
left = newLeft; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the right child node. |
|||
* |
|||
* @param newRight the new right child. |
|||
*/ |
|||
void setRight(FormulaType* newRight) { |
|||
right = newRight; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the left child node |
|||
*/ |
|||
const FormulaType& getLeft() const { |
|||
return *left; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the right child node |
|||
*/ |
|||
const FormulaType& getRight() const { |
|||
return *right; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the left child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool leftIsSet() const { |
|||
return left != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the right child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool rightIsSet() const { |
|||
return right != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "("; |
|||
result += left->toString(); |
|||
result += " & "; |
|||
result += right->toString(); |
|||
result += ")"; |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if all subtrees conform to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff all subtrees conform to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->left) && checker.validate(this->right); |
|||
} |
|||
|
|||
|
|||
private: |
|||
FormulaType* left; |
|||
FormulaType* right; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_AND_H_ */ |
@ -1,84 +0,0 @@ |
|||
/* |
|||
* Ap.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_AP_H_ |
|||
#define STORM_FORMULA_ABSTRACT_AP_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Logic-abstract Class for an abstract formula tree with atomic proposition as root. |
|||
* |
|||
* This class represents the leaves in the formula tree. |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T> |
|||
class Ap : public virtual AbstractFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Constructor |
|||
* |
|||
* Creates a new atomic proposition leaf, with the label Ap |
|||
* |
|||
* @param ap The string representing the atomic proposition |
|||
*/ |
|||
Ap(std::string ap) { |
|||
this->ap = ap; |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* At this time, empty... |
|||
*/ |
|||
virtual ~Ap() { } |
|||
|
|||
/*! |
|||
* @returns the name of the atomic proposition |
|||
*/ |
|||
const std::string& getAp() const { |
|||
return ap; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the leaf. |
|||
* |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
return getAp(); |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if all subtrees conform to some logic. |
|||
* |
|||
* As atomic propositions have no subformulas, we return true here. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return true; |
|||
} |
|||
|
|||
private: |
|||
std::string ap; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_ABSTRCT_AP_H_ */ |
@ -1,151 +0,0 @@ |
|||
/* |
|||
* BoundedUntil.h |
|||
* |
|||
* Created on: 27.11.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_BOUNDEDEVENTUALLY_H_ |
|||
#define STORM_FORMULA_ABSTRACT_BOUNDEDEVENTUALLY_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include <cstdint> |
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
|
|||
namespace property { |
|||
|
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a BoundedEventually node as root. |
|||
* |
|||
* Has one formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff in at most \e bound steps, formula \e child holds. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "validate" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class BoundedEventually : public virtual AbstractFormula<T> { |
|||
|
|||
// Throw a compiler error when FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::BoundedEventually<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
BoundedEventually() { |
|||
this->child = nullptr; |
|||
bound = 0; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child formula subtree |
|||
* @param bound The maximal number of steps |
|||
*/ |
|||
BoundedEventually(FormulaType* child, uint_fast64_t bound) { |
|||
this->child = child; |
|||
this->bound = bound; |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~BoundedEventually() { |
|||
if (child != nullptr) { |
|||
delete child; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* @returns the child node |
|||
*/ |
|||
const FormulaType& getChild() const { |
|||
return *child; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the subtree |
|||
* @param child the new child node |
|||
*/ |
|||
void setChild(FormulaType* child) { |
|||
this->child = child; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool childIsSet() const { |
|||
return child != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns the maximally allowed number of steps for the bounded until operator |
|||
*/ |
|||
uint_fast64_t getBound() const { |
|||
return bound; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the maximally allowed number of steps for the bounded until operator |
|||
* |
|||
* @param bound the new bound. |
|||
*/ |
|||
void setBound(uint_fast64_t bound) { |
|||
this->bound = bound; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "F<="; |
|||
result += std::to_string(bound); |
|||
result += " "; |
|||
result += child->toString(); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the subtree conforms to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff the subtree conforms to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->child); |
|||
} |
|||
|
|||
|
|||
private: |
|||
FormulaType* child; |
|||
uint_fast64_t bound; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_BOUNDEDEVENTUALLY_H_ */ |
@ -1,175 +0,0 @@ |
|||
/* |
|||
* BoundedNaryUntil.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_BOUNDEDNARYUNTIL_H_ |
|||
#define STORM_FORMULA_ABSTRACT_BOUNDEDNARYUNTIL_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include <cstdint> |
|||
#include <string> |
|||
#include <vector> |
|||
#include <tuple> |
|||
#include <sstream> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a BoundedNaryUntil node as root. |
|||
* |
|||
* Has at least two formulas as sub formulas and an interval |
|||
* associated with all but the first sub formula. We'll call the first one |
|||
* \e left and all other one \e right. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff \e left holds until eventually any of the \e right |
|||
* formulas holds after a number of steps contained in the interval |
|||
* associated with this formula. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class BoundedNaryUntil : public virtual AbstractFormula<T> { |
|||
|
|||
// Throw a compiler error when FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::BoundedNaryUntil<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
BoundedNaryUntil() { |
|||
this->left = nullptr; |
|||
this->right = new std::vector<std::tuple<FormulaType*,T,T>>(); |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param left The left formula subtree |
|||
* @param right The left formula subtree |
|||
*/ |
|||
BoundedNaryUntil(FormulaType* left, std::vector<std::tuple<FormulaType*,T,T>>* right) { |
|||
this->left = left; |
|||
this->right = right; |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~BoundedNaryUntil() { |
|||
if (left != nullptr) { |
|||
delete left; |
|||
} |
|||
if (right != nullptr) { |
|||
delete right; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* Sets the left child node. |
|||
* |
|||
* @param newLeft the new left child. |
|||
*/ |
|||
void setLeft(FormulaType* newLeft) { |
|||
left = newLeft; |
|||
} |
|||
|
|||
void setRight(std::vector<std::tuple<FormulaType*,T,T>>* newRight) { |
|||
right = newRight; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the left child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool leftIsSet() const { |
|||
return left != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the right child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool rightIsSet() const { |
|||
return right != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the right child node. |
|||
* |
|||
* @param newRight the new right child. |
|||
*/ |
|||
void addRight(FormulaType* newRight, T upperBound, T lowerBound) { |
|||
this->right->push_back(std::tuple<FormulaType*,T,T>(newRight, upperBound, lowerBound)); |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the left child node |
|||
*/ |
|||
const FormulaType& getLeft() const { |
|||
return *left; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the right child nodes. |
|||
*/ |
|||
const std::vector<std::tuple<FormulaType*,T,T>>& getRight() const { |
|||
return *right; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::stringstream result; |
|||
result << "( " << left->toString(); |
|||
for (auto it = this->right->begin(); it != this->right->end(); ++it) { |
|||
result << " U[" << std::get<1>(*it) << "," << std::get<2>(*it) << "] " << std::get<0>(*it)->toString(); |
|||
} |
|||
result << ")"; |
|||
return result.str(); |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if all subtrees conform to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff all subtrees conform to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
bool res = checker.validate(this->left); |
|||
for (auto it = this->right->begin(); it != this->right->end(); ++it) { |
|||
res &= checker.validate(std::get<0>(*it)); |
|||
} |
|||
return res; |
|||
} |
|||
|
|||
|
|||
private: |
|||
FormulaType* left; |
|||
std::vector<std::tuple<FormulaType*,T,T>>* right; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_BOUNDEDNARYUNTIL_H_ */ |
@ -1,182 +0,0 @@ |
|||
/* |
|||
* BoundedUntil.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_BOUNDEDUNTIL_H_ |
|||
#define STORM_FORMULA_ABSTRACT_BOUNDEDUNTIL_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include <cstdint> |
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a BoundedUntil node as root. |
|||
* |
|||
* Has two formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff in at most \e bound steps, formula \e right (the right subtree) holds, and before, |
|||
* \e left holds. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class BoundedUntil : public virtual AbstractFormula<T> { |
|||
|
|||
// Throw a compiler error when FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::BoundedUntil<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
BoundedUntil() { |
|||
this->left = NULL; |
|||
this->right = NULL; |
|||
bound = 0; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param left The left formula subtree |
|||
* @param right The left formula subtree |
|||
* @param bound The maximal number of steps |
|||
*/ |
|||
BoundedUntil(FormulaType* left, FormulaType* right, |
|||
uint_fast64_t bound) { |
|||
this->left = left; |
|||
this->right = right; |
|||
this->bound = bound; |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~BoundedUntil() { |
|||
if (left != NULL) { |
|||
delete left; |
|||
} |
|||
if (right != NULL) { |
|||
delete right; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* Sets the left child node. |
|||
* |
|||
* @param newLeft the new left child. |
|||
*/ |
|||
void setLeft(FormulaType* newLeft) { |
|||
left = newLeft; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the right child node. |
|||
* |
|||
* @param newRight the new right child. |
|||
*/ |
|||
void setRight(FormulaType* newRight) { |
|||
right = newRight; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the left child node |
|||
*/ |
|||
const FormulaType& getLeft() const { |
|||
return *left; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the right child node |
|||
*/ |
|||
const FormulaType& getRight() const { |
|||
return *right; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the left child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool leftIsSet() const { |
|||
return left != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the right child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool rightIsSet() const { |
|||
return right != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns the maximally allowed number of steps for the bounded until operator |
|||
*/ |
|||
uint_fast64_t getBound() const { |
|||
return bound; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the maximally allowed number of steps for the bounded until operator |
|||
* |
|||
* @param bound the new bound. |
|||
*/ |
|||
void setBound(uint_fast64_t bound) { |
|||
this->bound = bound; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = left->toString(); |
|||
result += " U<="; |
|||
result += std::to_string(bound); |
|||
result += " "; |
|||
result += right->toString(); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if all subtrees conform to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff all subtrees conform to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->left) && checker.validate(this->right); |
|||
} |
|||
|
|||
private: |
|||
FormulaType* left; |
|||
FormulaType* right; |
|||
uint_fast64_t bound; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_BOUNDEDUNTIL_H_ */ |
@ -1,101 +0,0 @@ |
|||
/* |
|||
* InstantaneousReward.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_CUMULATIVEREWARD_H_ |
|||
#define STORM_FORMULA_ABSTRACT_CUMULATIVEREWARD_H_ |
|||
|
|||
#include "AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Cumulative Reward node as root. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractPathFormula |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T> |
|||
class CumulativeReward : public virtual AbstractFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
CumulativeReward() { |
|||
bound = 0; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param bound The time bound of the reward formula |
|||
*/ |
|||
CumulativeReward(T bound) { |
|||
this->bound = bound; |
|||
} |
|||
|
|||
/*! |
|||
* Empty destructor. |
|||
*/ |
|||
virtual ~CumulativeReward() { |
|||
// Intentionally left empty. |
|||
} |
|||
|
|||
/*! |
|||
* @returns the time instance for the instantaneous reward operator |
|||
*/ |
|||
T getBound() const { |
|||
return bound; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the the time instance for the instantaneous reward operator |
|||
* |
|||
* @param bound the new bound. |
|||
*/ |
|||
void setBound(T bound) { |
|||
this->bound = bound; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "C <= "; |
|||
result += std::to_string(bound); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if all subtrees conform to some logic. |
|||
* |
|||
* As CumulativeReward objects have no subformulas, we return true here. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return true; |
|||
} |
|||
|
|||
private: |
|||
T bound; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_INSTANTANEOUSREWARD_H_ */ |
@ -1,125 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_EVENTUALLY_H_ |
|||
#define STORM_FORMULA_ABSTRACT_EVENTUALLY_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
|
|||
namespace storm { |
|||
|
|||
namespace property { |
|||
|
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with an Eventually node as root. |
|||
* |
|||
* Has one formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff eventually \e child holds. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to nullptr before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class Eventually : public virtual AbstractFormula<T> { |
|||
|
|||
// Throw a compiler error when FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::Eventually<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Eventually() { |
|||
this->child = nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Eventually(FormulaType* child) { |
|||
this->child = child; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to nullptr before deletion) |
|||
*/ |
|||
virtual ~Eventually() { |
|||
if (child != nullptr) { |
|||
delete child; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* @returns the child node |
|||
*/ |
|||
const FormulaType& getChild() const { |
|||
return *child; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the subtree |
|||
* @param child the new child node |
|||
*/ |
|||
void setChild(FormulaType* child) { |
|||
this->child = child; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the child node is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool childIsSet() const { |
|||
return child != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "F "; |
|||
result += child->toString(); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the subtree conforms to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff the subtree conforms to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->child); |
|||
} |
|||
|
|||
private: |
|||
FormulaType* child; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_EVENTUALLY_H_ */ |
@ -1,126 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_GLOBALLY_H_ |
|||
#define STORM_FORMULA_ABSTRACT_GLOBALLY_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
|
|||
namespace property { |
|||
|
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a Globally node as root. |
|||
* |
|||
* Has one formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff globally \e child holds. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to nullptr before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class Globally : public virtual AbstractFormula<T> { |
|||
|
|||
// Throw a compiler error when FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::Globally<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Globally() { |
|||
this->child = nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Globally(FormulaType* child) { |
|||
this->child = child; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to nullptr before deletion) |
|||
*/ |
|||
virtual ~Globally() { |
|||
if (child != nullptr) { |
|||
delete child; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* @returns the child node |
|||
*/ |
|||
const FormulaType& getChild() const { |
|||
return *child; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the subtree |
|||
* @param child the new child node |
|||
*/ |
|||
void setChild(FormulaType* child) { |
|||
this->child = child; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the child node is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool childIsSet() const { |
|||
return child != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "G "; |
|||
result += child->toString(); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the subtree conforms to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff the subtree conforms to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->child); |
|||
} |
|||
|
|||
private: |
|||
FormulaType* child; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_GLOBALLY_H_ */ |
@ -1,41 +0,0 @@ |
|||
/* |
|||
* IOptimizingOperator.h |
|||
* |
|||
* Created on: 17.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_IOPTIMIZINGOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_IOPTIMIZINGOPERATOR_H_ |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief Interface for optimizing operators |
|||
* |
|||
* Needed to link abstract classes in concrete logics with the logic-abstract implementation. |
|||
*/ |
|||
class IOptimizingOperator { |
|||
public: |
|||
|
|||
/*! |
|||
* Retrieves whether the operator is to be interpreted as an optimizing (i.e. min/max) operator. |
|||
* @returns True if the operator is an optimizing operator. |
|||
*/ |
|||
virtual bool isOptimalityOperator() const = 0; |
|||
|
|||
/*! |
|||
* Retrieves whether the operator is a minimizing operator given that it is an optimality |
|||
* operator. |
|||
* @returns True if the operator is an optimizing operator and it is a minimizing operator and |
|||
* false otherwise, i.e. if it is either not an optimizing operator or not a minimizing operator. |
|||
*/ |
|||
virtual bool isMinimumOperator() const = 0; |
|||
}; |
|||
|
|||
} /* namespace abstract */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
#endif /* IOPTIMIZINGOPERATOR_H_ */ |
@ -1,101 +0,0 @@ |
|||
/* |
|||
* InstantaneousReward.h |
|||
* |
|||
* Created on: 26.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_INSTANTANEOUSREWARD_H_ |
|||
#define STORM_FORMULA_ABSTRACT_INSTANTANEOUSREWARD_H_ |
|||
|
|||
#include "AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include <cstdint> |
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Instantaneous Reward node as root. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T> |
|||
class InstantaneousReward : public virtual AbstractFormula<T> { |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
InstantaneousReward() { |
|||
bound = 0; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param bound The time instance of the reward formula |
|||
*/ |
|||
InstantaneousReward(uint_fast64_t bound) { |
|||
this->bound = bound; |
|||
} |
|||
|
|||
/*! |
|||
* Empty destructor. |
|||
*/ |
|||
virtual ~InstantaneousReward() { |
|||
// Intentionally left empty. |
|||
} |
|||
|
|||
/*! |
|||
* @returns the time instance for the instantaneous reward operator |
|||
*/ |
|||
uint_fast64_t getBound() const { |
|||
return bound; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the the time instance for the instantaneous reward operator |
|||
* |
|||
* @param bound the new bound. |
|||
*/ |
|||
void setBound(uint_fast64_t bound) { |
|||
this->bound = bound; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "I="; |
|||
result += std::to_string(bound); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if all subtrees conform to some logic. |
|||
* |
|||
* As InstantaneousReward formulas have no subformulas, we return true here. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return true; |
|||
} |
|||
|
|||
private: |
|||
uint_fast64_t bound; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_INSTANTANEOUSREWARD_H_ */ |
@ -1,128 +0,0 @@ |
|||
/* |
|||
* Next.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_NEXT_H_ |
|||
#define STORM_FORMULA_ABSTRACT_NEXT_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
|
|||
namespace property { |
|||
|
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Next node as root. |
|||
* |
|||
* Has two formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff in the next step, \e child holds |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class Next : public virtual AbstractFormula<T> { |
|||
|
|||
// Throw a compiler error when FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::Next<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Next() { |
|||
this->child = NULL; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param child The child node |
|||
*/ |
|||
Next(FormulaType* child) { |
|||
this->child = child; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* |
|||
* Also deletes the subtree. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~Next() { |
|||
if (child != NULL) { |
|||
delete child; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* @returns the child node |
|||
*/ |
|||
const FormulaType& getChild() const { |
|||
return *child; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the subtree |
|||
* @param child the new child node |
|||
*/ |
|||
void setChild(FormulaType* child) { |
|||
this->child = child; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the child node is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool childIsSet() const { |
|||
return child != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "("; |
|||
result += " X "; |
|||
result += child->toString(); |
|||
result += ")"; |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the subtree conforms to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff the subtree conforms to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->child); |
|||
} |
|||
|
|||
private: |
|||
FormulaType* child; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_NEXT_H_ */ |
@ -1,122 +0,0 @@ |
|||
/* |
|||
* Not.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_NOT_H_ |
|||
#define STORM_FORMULA_ABSTRACT_NOT_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
|
|||
namespace property { |
|||
|
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with NOT node as root. |
|||
* |
|||
* Has one formula as sub formula/tree. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class Not : public virtual AbstractFormula<T> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::Not<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Not() { |
|||
this->child = NULL; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* @param child The child node |
|||
*/ |
|||
Not(FormulaType* child) { |
|||
this->child = child; |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
* |
|||
* Also deletes the subtree |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~Not() { |
|||
if (child != NULL) { |
|||
delete child; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* @returns The child node |
|||
*/ |
|||
const FormulaType& getChild() const { |
|||
return *child; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the subtree |
|||
* @param child the new child node |
|||
*/ |
|||
void setChild(FormulaType* child) { |
|||
this->child = child; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the child node is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool childIsSet() const { |
|||
return child != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "!"; |
|||
result += child->toString(); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the subtree conforms to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff the subtree conforms to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->child); |
|||
} |
|||
|
|||
private: |
|||
FormulaType* child; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_NOT_H_ */ |
@ -1,72 +0,0 @@ |
|||
#ifndef STORM_FORMULA_ABSTRACT_OPTIMIZINGOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_OPTIMIZINGOPERATOR_H_ |
|||
|
|||
#include "IOptimizingOperator.h" |
|||
|
|||
namespace storm { |
|||
|
|||
namespace property { |
|||
|
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* |
|||
*/ |
|||
class OptimizingOperator : public virtual IOptimizingOperator { |
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
OptimizingOperator() : optimalityOperator(false), minimumOperator(false) { |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param minimumOperator A flag indicating whether this operator is a minimizing or a maximizing operator. |
|||
*/ |
|||
OptimizingOperator(bool minimumOperator) : optimalityOperator(true), minimumOperator(minimumOperator) { |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~OptimizingOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Retrieves whether the operator is to be interpreted as an optimizing (i.e. min/max) operator. |
|||
* @returns True if the operator is an optimizing operator. |
|||
*/ |
|||
virtual bool isOptimalityOperator() const { |
|||
return optimalityOperator; |
|||
} |
|||
|
|||
/*! |
|||
* Retrieves whether the operator is a minimizing operator given that it is an optimality |
|||
* operator. |
|||
* @returns True if the operator is an optimizing operator and it is a minimizing operator and |
|||
* false otherwise, i.e. if it is either not an optimizing operator or not a minimizing operator. |
|||
*/ |
|||
virtual bool isMinimumOperator() const { |
|||
return optimalityOperator && minimumOperator; |
|||
} |
|||
|
|||
private: |
|||
// A flag that indicates whether this operator is meant as an optimizing (i.e. min/max) operator |
|||
// over a nondeterministic model. |
|||
bool optimalityOperator; |
|||
|
|||
// In the case this operator is an optimizing operator, this flag indicates whether it is |
|||
// looking for the minimum or the maximum value. |
|||
bool minimumOperator; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_OPTIMIZINGOPERATOR_H_ */ |
@ -1,161 +0,0 @@ |
|||
/* |
|||
* Or.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_OR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_OR_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with OR node as root. |
|||
* |
|||
* Has two formulas as sub formulas/trees. |
|||
* |
|||
* As OR is commutative, the order is \e theoretically not important, but will influence the order in which |
|||
* the model checker works. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class Or : public virtual AbstractFormula<T> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::Or<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor. |
|||
* Will create an AND-node without subnotes. Will not represent a complete formula! |
|||
*/ |
|||
Or() { |
|||
left = NULL; |
|||
right = NULL; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor. |
|||
* Creates an AND note with the parameters as subtrees. |
|||
* |
|||
* @param left The left sub formula |
|||
* @param right The right sub formula |
|||
*/ |
|||
Or(FormulaType* left, FormulaType* right) { |
|||
this->left = left; |
|||
this->right = right; |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* The subtrees are deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~Or() { |
|||
if (left != NULL) { |
|||
delete left; |
|||
} |
|||
if (right != NULL) { |
|||
delete right; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* Sets the left child node. |
|||
* |
|||
* @param newLeft the new left child. |
|||
*/ |
|||
void setLeft(FormulaType* newLeft) { |
|||
left = newLeft; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the right child node. |
|||
* |
|||
* @param newRight the new right child. |
|||
*/ |
|||
void setRight(FormulaType* newRight) { |
|||
right = newRight; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the left child node |
|||
*/ |
|||
const FormulaType& getLeft() const { |
|||
return *left; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the right child node |
|||
*/ |
|||
const FormulaType& getRight() const { |
|||
return *right; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the left child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool leftIsSet() const { |
|||
return left != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the right child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool rightIsSet() const { |
|||
return right != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "("; |
|||
result += left->toString(); |
|||
result += " | "; |
|||
result += right->toString(); |
|||
result += ")"; |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if all subtrees conform to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff all subtrees conform to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->left) && checker.validate(this->right); |
|||
} |
|||
|
|||
private: |
|||
FormulaType* left; |
|||
FormulaType* right; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_OR_H_ */ |
@ -1,194 +0,0 @@ |
|||
/* |
|||
* PathBoundOperator.h |
|||
* |
|||
* Created on: 27.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_PATHBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_PATHBOUNDOPERATOR_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/formula/ComparisonType.h" |
|||
|
|||
#include "src/formula/abstract/OptimizingOperator.h" |
|||
|
|||
#include "src/utility/constants.h" |
|||
|
|||
namespace storm { |
|||
|
|||
namespace property { |
|||
|
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a P (probablistic) operator node over a probability interval |
|||
* as root. |
|||
* |
|||
* Has one formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff the probability that the path formula holds is inside the bounds |
|||
* specified in this operator |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
* @see PathNoBoundOperator |
|||
*/ |
|||
template<class T, class FormulaType> |
|||
class PathBoundOperator : public virtual AbstractFormula<T>, public OptimizingOperator { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::PathBoundOperator<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Constructor for non-optimizing operator. |
|||
* |
|||
* @param comparisonOperator The relation for the bound. |
|||
* @param bound The bound for the probability |
|||
* @param pathFormula The child node |
|||
*/ |
|||
PathBoundOperator(storm::property::ComparisonType comparisonOperator, T bound, FormulaType* pathFormula) |
|||
: comparisonOperator(comparisonOperator), bound(bound), pathFormula(pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor for optimizing operator. |
|||
* |
|||
* @param comparisonOperator The relation for the bound. |
|||
* @param bound The bound for the probability |
|||
* @param pathFormula The child node |
|||
* @param minimumOperator Indicator, if operator should be minimum or maximum operator. |
|||
*/ |
|||
PathBoundOperator(storm::property::ComparisonType comparisonOperator, T bound, FormulaType* pathFormula, bool minimumOperator) |
|||
: OptimizingOperator(minimumOperator), comparisonOperator(comparisonOperator), bound(bound), pathFormula(pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
* |
|||
* The subtree is deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~PathBoundOperator() { |
|||
if (pathFormula != nullptr) { |
|||
delete pathFormula; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* @returns the child node (representation of a formula) |
|||
*/ |
|||
const FormulaType& getPathFormula () const { |
|||
return *pathFormula; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the child node |
|||
* |
|||
* @param pathFormula the path formula that becomes the new child node |
|||
*/ |
|||
void setPathFormula(FormulaType* pathFormula) { |
|||
this->pathFormula = pathFormula; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the path formula is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool pathFormulaIsSet() const { |
|||
return pathFormula != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns the comparison relation |
|||
*/ |
|||
const storm::property::ComparisonType getComparisonOperator() const { |
|||
return comparisonOperator; |
|||
} |
|||
|
|||
void setComparisonOperator(storm::property::ComparisonType comparisonOperator) { |
|||
this->comparisonOperator = comparisonOperator; |
|||
} |
|||
|
|||
/*! |
|||
* @returns the bound for the measure |
|||
*/ |
|||
const T& getBound() const { |
|||
return bound; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the interval in which the probability that the path formula holds may lie in. |
|||
* |
|||
* @param bound The bound for the measure |
|||
*/ |
|||
void setBound(T bound) { |
|||
this->bound = bound; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = ""; |
|||
switch (comparisonOperator) { |
|||
case LESS: result += "<"; break; |
|||
case LESS_EQUAL: result += "<="; break; |
|||
case GREATER: result += ">"; break; |
|||
case GREATER_EQUAL: result += ">="; break; |
|||
} |
|||
result += " "; |
|||
result += std::to_string(bound); |
|||
result += " ["; |
|||
result += pathFormula->toString(); |
|||
result += "]"; |
|||
return result; |
|||
} |
|||
|
|||
bool meetsBound(T value) const { |
|||
switch (comparisonOperator) { |
|||
case LESS: return value < bound; break; |
|||
case LESS_EQUAL: return value <= bound; break; |
|||
case GREATER: return value > bound; break; |
|||
case GREATER_EQUAL: return value >= bound; break; |
|||
default: return false; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the subtree conforms to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff the subtree conforms to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->pathFormula); |
|||
} |
|||
|
|||
private: |
|||
storm::property::ComparisonType comparisonOperator; |
|||
T bound; |
|||
FormulaType* pathFormula; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_PATHBOUNDOPERATOR_H_ */ |
@ -1,160 +0,0 @@ |
|||
/* |
|||
* PathNoBoundOperator.h |
|||
* |
|||
* Created on: 27.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_NOBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_NOBOUNDOPERATOR_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/formula/abstract/OptimizingOperator.h" |
|||
|
|||
|
|||
namespace storm { |
|||
|
|||
namespace property { |
|||
|
|||
namespace abstract { |
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a P (probablistic) operator without declaration of probabilities |
|||
* as root. |
|||
* |
|||
* Checking a formula with this operator as root returns the probabilities that the path formula holds |
|||
* (for each state) |
|||
* |
|||
* Has one formula as sub formula/tree. |
|||
* |
|||
* @note |
|||
* This class is a hybrid of a state and path formula, and may only appear as the outermost operator. |
|||
* Hence, it is seen as neither a state nor a path formula, but is directly derived from AbstractFormula. |
|||
* |
|||
* @note |
|||
* This class does not contain a check() method like the other formula classes. |
|||
* The check method should only be called by the model checker to infer the correct check function for sub |
|||
* formulas. As this operator can only appear at the root, the method is not useful here. |
|||
* Use the checkProbabilisticNoBoundOperator method from the DtmcPrctlModelChecker class instead. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
* @see PathBoundOperator |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class PathNoBoundOperator: public virtual AbstractFormula<T>, public OptimizingOperator { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::PathNoBoundOperator<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
PathNoBoundOperator() : |
|||
OptimizingOperator(false) { |
|||
this->pathFormula = nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
*/ |
|||
PathNoBoundOperator(FormulaType* pathFormula) { |
|||
this->pathFormula = pathFormula; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
* @param minimumOperator A flag indicating whether this operator is a minimizing or a |
|||
* maximizing operator. |
|||
*/ |
|||
PathNoBoundOperator(FormulaType* pathFormula, bool minimumOperator) |
|||
: OptimizingOperator(minimumOperator) { |
|||
this->pathFormula = pathFormula; |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~PathNoBoundOperator() { |
|||
if (pathFormula != NULL) { |
|||
delete pathFormula; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* @returns the child node (representation of an abstract path formula) |
|||
*/ |
|||
const FormulaType& getPathFormula () const { |
|||
return *pathFormula; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the child node |
|||
* |
|||
* @param pathFormula the path formula that becomes the new child node |
|||
*/ |
|||
void setPathFormula(FormulaType* pathFormula) { |
|||
this->pathFormula = pathFormula; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the path formula is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool pathFormulaIsSet() const { |
|||
return pathFormula != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result; |
|||
if (this->isOptimalityOperator()) { |
|||
if (this->isMinimumOperator()) { |
|||
result += "min"; |
|||
} else { |
|||
result += "max"; |
|||
} |
|||
} |
|||
result += " = ? ["; |
|||
result += this->getPathFormula().toString(); |
|||
result += "]"; |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the subtree conforms to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff the subtree conforms to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->pathFormula); |
|||
} |
|||
|
|||
private: |
|||
FormulaType* pathFormula; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_NOBOUNDOPERATOR_H_ */ |
@ -1,114 +0,0 @@ |
|||
/* |
|||
* ProbabilisticBoundOperator.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_PROBABILISTICBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_PROBABILISTICBOUNDOPERATOR_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/abstract/PathBoundOperator.h" |
|||
#include "src/formula/abstract/OptimizingOperator.h" |
|||
#include "utility/constants.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a P (probablistic) operator node over a probability interval |
|||
* as root. |
|||
* |
|||
* Has one Abstract path formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff the probability that the path formula holds is inside the bounds |
|||
* specified in this operator |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
* @see AbstractFormula |
|||
* @see ProbabilisticOperator |
|||
* @see ProbabilisticNoBoundsOperator |
|||
* @see AbstractFormula |
|||
*/ |
|||
template<class T, class FormulaType> |
|||
class ProbabilisticBoundOperator : public PathBoundOperator<T, FormulaType> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::ProbabilisticBoundOperator<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
ProbabilisticBoundOperator() : PathBoundOperator<T, FormulaType> |
|||
(LESS_EQUAL, storm::utility::constantZero<T>(), nullptr) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param comparisonRelation The relation to compare the actual value and the bound |
|||
* @param bound The bound for the probability |
|||
* @param pathFormula The child node |
|||
*/ |
|||
ProbabilisticBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, |
|||
T bound, |
|||
FormulaType* pathFormula) |
|||
: PathBoundOperator<T, FormulaType>(comparisonRelation, bound, pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param comparisonRelation |
|||
* @param bound |
|||
* @param pathFormula |
|||
* @param minimumOperator |
|||
*/ |
|||
ProbabilisticBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, |
|||
T bound, |
|||
FormulaType* pathFormula, |
|||
bool minimumOperator) |
|||
: PathBoundOperator<T, FormulaType>(comparisonRelation, bound, pathFormula, minimumOperator){ |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~ProbabilisticBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "P "; |
|||
result += PathBoundOperator<T, FormulaType>::toString(); |
|||
return result; |
|||
} |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_PROBABILISTICBOUNDOPERATOR_H_ */ |
@ -1,104 +0,0 @@ |
|||
/* |
|||
* ProbabilisticNoBoundOperator.h |
|||
* |
|||
* Created on: 12.12.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_PROBABILISTICNOBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_PROBABILISTICNOBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractFormula.h" |
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "PathNoBoundOperator.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a P (probablistic) operator without declaration of probabilities |
|||
* as root. |
|||
* |
|||
* Checking a formula with this operator as root returns the probabilities that the path formula holds |
|||
* (for each state) |
|||
* |
|||
* Has one Abstract path formula as sub formula/tree. |
|||
* |
|||
* @note |
|||
* This class is a hybrid of a state and path formula, and may only appear as the outermost operator. |
|||
* Hence, it is seen as neither a state nor a path formula, but is directly derived from AbstractFormula. |
|||
* |
|||
* @note |
|||
* This class does not contain a check() method like the other formula classes. |
|||
* The check method should only be called by the model checker to infer the correct check function for sub |
|||
* formulas. As this operator can only appear at the root, the method is not useful here. |
|||
* Use the checkProbabilisticNoBoundOperator method from the DtmcPrctlModelChecker class instead. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
* @see PathNoBoundOperator |
|||
* @see ProbabilisticBoundOperator |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class ProbabilisticNoBoundOperator: public PathNoBoundOperator<T, FormulaType> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::ProbabilisticNoBoundOperator<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
ProbabilisticNoBoundOperator() : PathNoBoundOperator<T, FormulaType>(nullptr) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
*/ |
|||
ProbabilisticNoBoundOperator(FormulaType* pathFormula) : PathNoBoundOperator<T, FormulaType>(pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~ProbabilisticNoBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
*/ |
|||
ProbabilisticNoBoundOperator(FormulaType* pathFormula, bool minimumOperator) : PathNoBoundOperator<T, FormulaType>(pathFormula, minimumOperator) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "P"; |
|||
result += PathNoBoundOperator<T, FormulaType>::toString(); |
|||
return result; |
|||
} |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_PROBABILISTICNOBOUNDOPERATOR_H_ */ |
@ -1,106 +0,0 @@ |
|||
/* |
|||
* RewardBoundOperator.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_REWARDBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_REWARDBOUNDOPERATOR_H_ |
|||
|
|||
#include "PathBoundOperator.h" |
|||
#include "utility/constants.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a R (reward) operator node over a reward interval as root. |
|||
* |
|||
* Has a reward path formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff the reward of the reward path formula is inside the bounds |
|||
* specified in this operator |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
* @see PathBoundOperator |
|||
* @see RewardNoBoundOperator |
|||
*/ |
|||
template<class T, class FormulaType> |
|||
class RewardBoundOperator : public PathBoundOperator<T, FormulaType> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::RewardBoundOperator<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
RewardBoundOperator() : PathBoundOperator<T, FormulaType>(LESS_EQUAL, storm::utility::constantZero<T>(), nullptr) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param comparisonRelation The relation to compare the actual value and the bound |
|||
* @param bound The bound for the probability |
|||
* @param pathFormula The child node |
|||
*/ |
|||
RewardBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, |
|||
T bound, |
|||
FormulaType* pathFormula) : |
|||
PathBoundOperator<T, FormulaType>(comparisonRelation, bound, pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* @param comparisonRelation |
|||
* @param bound |
|||
* @param pathFormula |
|||
* @param minimumOperator |
|||
*/ |
|||
RewardBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, |
|||
T bound, |
|||
FormulaType* pathFormula, |
|||
bool minimumOperator) |
|||
: PathBoundOperator<T, FormulaType>(comparisonRelation, bound, pathFormula, minimumOperator) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~RewardBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "R "; |
|||
result += PathBoundOperator<T, FormulaType>::toString(); |
|||
return result; |
|||
} |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_REWARDBOUNDOPERATOR_H_ */ |
@ -1,103 +0,0 @@ |
|||
/* |
|||
* RewardNoBoundOperator.h |
|||
* |
|||
* Created on: 25.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_REWARDNOBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_REWARDNOBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractFormula.h" |
|||
#include "PathNoBoundOperator.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a R (reward) operator without declaration of reward values |
|||
* as root. |
|||
* |
|||
* Checking a formula with this operator as root returns the reward for the reward path formula for |
|||
* each state |
|||
* |
|||
* Has one formula as sub formula/tree. |
|||
* |
|||
* @note |
|||
* This class is a hybrid of a state and path formula, and may only appear as the outermost operator. |
|||
* Hence, it is seen as neither a state nor a path formula, but is directly derived from AbstractFormula. |
|||
* |
|||
* @note |
|||
* This class does not contain a check() method like the other formula classes. |
|||
* The check method should only be called by the model checker to infer the correct check function for sub |
|||
* formulas. As this operator can only appear at the root, the method is not useful here. |
|||
* Use the checkRewardNoBoundOperator method from the DtmcPrctlModelChecker class instead. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
* @see PathNoBoundOperator |
|||
* @see RewardBoundOperator |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class RewardNoBoundOperator: public PathNoBoundOperator<T, FormulaType> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::RewardNoBoundOperator<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
RewardNoBoundOperator() : PathNoBoundOperator<T, FormulaType>(nullptr) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
*/ |
|||
RewardNoBoundOperator(FormulaType* pathFormula) : PathNoBoundOperator<T, FormulaType>(pathFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param pathFormula The child node. |
|||
*/ |
|||
RewardNoBoundOperator(FormulaType* pathFormula, bool minimumOperator) : PathNoBoundOperator<T, FormulaType>(pathFormula, minimumOperator) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~RewardNoBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "R"; |
|||
result += PathNoBoundOperator<T, FormulaType>::toString(); |
|||
return result; |
|||
} |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_REWARDNOBOUNDOPERATOR_H_ */ |
@ -1,174 +0,0 @@ |
|||
/* |
|||
* BoundOperator.h |
|||
* |
|||
* Created on: 27.12.2012 |
|||
* Author: Christian Dehnert |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_STATEBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_STATEBOUNDOPERATOR_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include "src/formula/ComparisonType.h" |
|||
#include "src/utility/constants.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a P (probablistic) operator node over a probability interval |
|||
* as root. |
|||
* |
|||
* Has one formula as sub formula/tree. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff the probability that the state formula holds is inside the bounds |
|||
* specified in this operator |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
* @see StateNoBoundOperator |
|||
*/ |
|||
template<class T, class FormulaType> |
|||
class StateBoundOperator : public virtual AbstractFormula<T> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::StateBoundOperator<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param comparisonOperator The relation for the bound. |
|||
* @param bound The bound for the probability |
|||
* @param stateFormula The child node |
|||
*/ |
|||
StateBoundOperator(storm::property::ComparisonType comparisonOperator, T bound, FormulaType* stateFormula) |
|||
: comparisonOperator(comparisonOperator), bound(bound), stateFormula(stateFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
* |
|||
* The subtree is deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
*/ |
|||
virtual ~StateBoundOperator() { |
|||
if (stateFormula != nullptr) { |
|||
delete stateFormula; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* @returns the child node (representation of a formula) |
|||
*/ |
|||
const FormulaType& getStateFormula () const { |
|||
return *stateFormula; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the child node |
|||
* |
|||
* @param stateFormula the state formula that becomes the new child node |
|||
*/ |
|||
void setStateFormula(FormulaType* stateFormula) { |
|||
this->stateFormula = stateFormula; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the state formula is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool stateFormulaIsSet() const { |
|||
return stateFormula != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns the comparison relation |
|||
*/ |
|||
const ComparisonType getComparisonOperator() const { |
|||
return comparisonOperator; |
|||
} |
|||
|
|||
void setComparisonOperator(ComparisonType comparisonOperator) { |
|||
this->comparisonOperator = comparisonOperator; |
|||
} |
|||
|
|||
/*! |
|||
* @returns the bound for the measure |
|||
*/ |
|||
const T& getBound() const { |
|||
return bound; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the interval in which the probability that the path formula holds may lie in. |
|||
* |
|||
* @param bound The bound for the measure |
|||
*/ |
|||
void setBound(T bound) { |
|||
this->bound = bound; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = " "; |
|||
switch (comparisonOperator) { |
|||
case LESS: result += "< "; break; |
|||
case LESS_EQUAL: result += "<= "; break; |
|||
case GREATER: result += "> "; break; |
|||
case GREATER_EQUAL: result += ">= "; break; |
|||
} |
|||
result += std::to_string(bound); |
|||
result += " ["; |
|||
result += stateFormula->toString(); |
|||
result += "]"; |
|||
return result; |
|||
} |
|||
|
|||
bool meetsBound(T value) const { |
|||
switch (comparisonOperator) { |
|||
case LESS: return value < bound; break; |
|||
case LESS_EQUAL: return value <= bound; break; |
|||
case GREATER: return value > bound; break; |
|||
case GREATER_EQUAL: return value >= bound; break; |
|||
default: return false; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the subtree conforms to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff the subtree conforms to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->stateFormula); |
|||
} |
|||
|
|||
private: |
|||
ComparisonType comparisonOperator; |
|||
T bound; |
|||
FormulaType* stateFormula; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_STATEBOUNDOPERATOR_H_ */ |
@ -1,126 +0,0 @@ |
|||
/* |
|||
* StateNoBoundOperator.h |
|||
* |
|||
* Created on: 09.04.2013 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_STATENOBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_STATENOBOUNDOPERATOR_H_ |
|||
|
|||
#include "AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with an operator without declaration of bounds. |
|||
* as root. |
|||
* |
|||
* Checking a formula with this operator as root returns the probabilities that the path formula holds |
|||
* (for each state) |
|||
* |
|||
* Has one formula as sub formula/tree. |
|||
* |
|||
* @note |
|||
* This class is a hybrid of a state and path formula, and may only appear as the outermost operator. |
|||
* Hence, it is seen as neither a state nor a path formula, but is directly derived from AbstractFormula. |
|||
* |
|||
* @note |
|||
* This class does not contain a check() method like the other formula classes. |
|||
* The check method should only be called by the model checker to infer the correct check function for sub |
|||
* formulas. As this operator can only appear at the root, the method is not useful here. |
|||
* Use the checkProbabilisticNoBoundOperator method from the DtmcPrctlModelChecker class instead. |
|||
* |
|||
* The subtree is seen as part of the object and deleted with it |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
* @see StateBoundOperator |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class StateNoBoundOperator: public virtual AbstractFormula<T>, public OptimizingOperator { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::StateNoBoundOperator<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
StateNoBoundOperator() { |
|||
stateFormula = nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
*/ |
|||
StateNoBoundOperator(FormulaType* stateFormula) { |
|||
this->stateFormula = stateFormula; |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
* |
|||
* Deletes the subtree |
|||
*/ |
|||
virtual ~StateNoBoundOperator() { |
|||
if (stateFormula != nullptr) { |
|||
delete stateFormula; |
|||
} |
|||
} |
|||
|
|||
const FormulaType& getStateFormula() const { |
|||
return *(this->stateFormula); |
|||
} |
|||
|
|||
void setStateFormula(FormulaType* stateFormula) { |
|||
this->stateFormula = stateFormula; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the state formula is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool stateFormulaIsSet() const { |
|||
return stateFormula != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result; |
|||
result += " = ? ["; |
|||
result += this->getStateFormula().toString(); |
|||
result += "]"; |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the subtree conforms to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff the subtree conforms to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->stateFormula); |
|||
} |
|||
|
|||
private: |
|||
FormulaType* stateFormula; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
#endif /* STORM_FORMULA_ABSTRACT_STATENOBOUNDOPERATOR_H_ */ |
@ -1,77 +0,0 @@ |
|||
/* |
|||
* SteadyState.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_STEADYSTATEOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_STEADYSTATEOPERATOR_H_ |
|||
|
|||
#include "StateBoundOperator.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an Abstract (path) formula tree with a SteadyStateOperator node as root. |
|||
* |
|||
* Has two formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff \e child holds SteadyStateOperator step, \e child holds |
|||
* |
|||
* The subtree is seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class SteadyStateBoundOperator : public StateBoundOperator<T, FormulaType> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::SteadyStateBoundOperator<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
SteadyStateBoundOperator() : StateBoundOperator<T, FormulaType> |
|||
(LESS_EQUAL, storm::utility::constantZero<T>(), nullptr) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param stateFormula The child node |
|||
*/ |
|||
SteadyStateBoundOperator( |
|||
storm::property::ComparisonType comparisonRelation, T bound, FormulaType* stateFormula) : |
|||
StateBoundOperator<T, FormulaType>(comparisonRelation, bound, stateFormula) { |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~SteadyStateBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
return "S" + StateBoundOperator<T, FormulaType>::toString(); |
|||
} |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_STEADYSTATEOPERATOR_H_ */ |
@ -1,76 +0,0 @@ |
|||
/* |
|||
* SteadyStateNoBoundOperator.h |
|||
* |
|||
* Created on: 09.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_STEADYSTATENOBOUNDOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_STEADYSTATENOBOUNDOPERATOR_H_ |
|||
|
|||
#include "StateNoBoundOperator.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a steady state operator as root, without explicit declaration of bounds. |
|||
* |
|||
* Checking a formula with this operator as root returns the exact bound parameter for the corresponding subformula. |
|||
* (for each state) |
|||
* |
|||
* Has one formula as sub formula/tree. |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class SteadyStateNoBoundOperator: public StateNoBoundOperator<T, FormulaType> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::SteadyStateNoBoundOperator<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
SteadyStateNoBoundOperator() : StateNoBoundOperator<T, FormulaType>() { |
|||
// Intentionally left empty |
|||
|
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param stateFormula The state formula that forms the subtree |
|||
*/ |
|||
SteadyStateNoBoundOperator(FormulaType* stateFormula) |
|||
: StateNoBoundOperator<T, FormulaType>(stateFormula) { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* Destructor |
|||
*/ |
|||
virtual ~SteadyStateNoBoundOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
return "S" + StateNoBoundOperator<T, FormulaType>::toString(); |
|||
} |
|||
|
|||
}; |
|||
|
|||
} /* namespace abstract */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_STEADYSTATENOBOUNDOPERATOR_H_ */ |
@ -1,62 +0,0 @@ |
|||
/* |
|||
* SteadyStateReward.h |
|||
* |
|||
* Created on: 08.04.2013 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_STEADYSTATEREWARD_H_ |
|||
#define STORM_FORMULA_ABSTRACT_STEADYSTATEREWARD_H_ |
|||
|
|||
#include "AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
#include <string> |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with a Steady State Reward node as root. |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T> |
|||
class SteadyStateReward: public virtual AbstractFormula<T> { |
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
SteadyStateReward() { |
|||
// Intentionally left empty |
|||
|
|||
} |
|||
virtual ~SteadyStateReward() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
return "S"; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if all subtrees conform to some logic. |
|||
* |
|||
* As SteadyStateReward objects have no subformulas, we return true here. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return true; |
|||
} |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
#endif /* STORM_FORMULA_ABSTRACT_STEADYSTATEREWARD_H_ */ |
@ -1,107 +0,0 @@ |
|||
/* |
|||
* TimeBoundedEventually.h |
|||
* |
|||
* Created on: 10.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_TIMEBOUNDEDEVENTUALLY_H_ |
|||
#define STORM_FORMULA_ABSTRACT_TIMEBOUNDEDEVENTUALLY_H_ |
|||
|
|||
#include "TimeBoundedOperator.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* Class for a formula tree with a time bounded eventually operator as root. |
|||
* |
|||
* Has two subformulas. |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
*/ |
|||
template<class T, class FormulaType> |
|||
class TimeBoundedEventually: public storm::property::abstract::TimeBoundedOperator<T> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::TimeBoundedEventually<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/** |
|||
* Simple constructor: Only sets the bounds |
|||
* |
|||
* @param lowerBound |
|||
* @param upperBound |
|||
*/ |
|||
TimeBoundedEventually(T lowerBound, T upperBound) : TimeBoundedOperator<T>(lowerBound, upperBound) { |
|||
child = nullptr; |
|||
} |
|||
|
|||
TimeBoundedEventually(T lowerBound, T upperBound, FormulaType* child) : |
|||
TimeBoundedOperator<T>(lowerBound, upperBound) { |
|||
this->child = child; |
|||
} |
|||
|
|||
virtual ~TimeBoundedEventually() { |
|||
if (child != nullptr) { |
|||
delete child; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* @returns the child node |
|||
*/ |
|||
const FormulaType& getChild() const { |
|||
return *child; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the subtree |
|||
* @param child the new child node |
|||
*/ |
|||
void setChild(FormulaType* child) { |
|||
this->child = child; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool childIsSet() const { |
|||
return child != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = "F"; |
|||
result += TimeBoundedOperator<T>::toString(); |
|||
result += " "; |
|||
result += child->toString(); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the subtree conforms to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff the subtree conforms to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->child); |
|||
} |
|||
|
|||
private: |
|||
FormulaType* child; |
|||
}; |
|||
|
|||
} /* namespace abstract */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_TIMEBOUNDEDEVENTUALLY_H_ */ |
@ -1,112 +0,0 @@ |
|||
/* |
|||
* TimeBoundedOperator.h |
|||
* |
|||
* Created on: 10.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_TIMEBOUNDEDOPERATOR_H_ |
|||
#define STORM_FORMULA_ABSTRACT_TIMEBOUNDEDOPERATOR_H_ |
|||
|
|||
#include <limits> |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "exceptions/InvalidArgumentException.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract formula tree with a operator node as root that uses a time interval |
|||
* (with upper and lower bound) |
|||
* |
|||
* This class does not provide support for sub formulas; this has to be done in concrete subclasses of this abstract class. |
|||
* |
|||
* |
|||
* @see AbstractFormula |
|||
* @see AbstractFormula |
|||
* @see AbstractFormula |
|||
*/ |
|||
template<class T> |
|||
class TimeBoundedOperator: public virtual AbstractFormula<T> { |
|||
public: |
|||
/** |
|||
* Constructor |
|||
* |
|||
* @param lowerBound The lower bound |
|||
* @param upperBound The upper bound |
|||
* @throw InvalidArgumentException if the lower bound is larger than the upper bound. |
|||
*/ |
|||
TimeBoundedOperator(T lowerBound, T upperBound) { |
|||
setInterval(lowerBound, upperBound); |
|||
} |
|||
|
|||
/** |
|||
* Destructor |
|||
*/ |
|||
virtual ~TimeBoundedOperator() { |
|||
// Intentionally left empty |
|||
} |
|||
|
|||
/** |
|||
* Getter for lowerBound attribute |
|||
* |
|||
* @return lower bound of the operator. |
|||
*/ |
|||
T getLowerBound() const { |
|||
return lowerBound; |
|||
} |
|||
|
|||
/** |
|||
* Getter for upperBound attribute |
|||
* @return upper bound of the operator. |
|||
*/ |
|||
T getUpperBound() const { |
|||
return upperBound; |
|||
} |
|||
|
|||
/** |
|||
* Set the time interval for the time bounded operator |
|||
* |
|||
* @param lowerBound |
|||
* @param upperBound |
|||
* @throw InvalidArgumentException if the lower bound is larger than the upper bound. |
|||
*/ |
|||
void setInterval(T lowerBound, T upperBound) { |
|||
if (lowerBound > upperBound) { |
|||
throw new storm::exceptions::InvalidArgumentException("Lower bound is larger than upper bound"); |
|||
} |
|||
this->lowerBound = lowerBound; |
|||
this->upperBound = upperBound; |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* @returns a string representation of the Interval of the formula |
|||
* May be used in subclasses to simplify string output. |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = ""; |
|||
if (upperBound == std::numeric_limits<double>::infinity()) { |
|||
result = ">=" + std::to_string(lowerBound); |
|||
} else { |
|||
result = "["; |
|||
result += std::to_string(lowerBound); |
|||
result += ","; |
|||
result += std::to_string(upperBound); |
|||
result += "]"; |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
private: |
|||
T lowerBound, upperBound; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
} //namespace property |
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_TIMEBOUNDEDOPERATOR_H_ */ |
@ -1,149 +0,0 @@ |
|||
/* |
|||
* TimeBoundedUntil.h |
|||
* |
|||
* Created on: 10.04.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_TIMEBOUNDEDUNTIL_H_ |
|||
#define STORM_FORMULA_ABSTRACT_TIMEBOUNDEDUNTIL_H_ |
|||
|
|||
#include "TimeBoundedOperator.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
|
|||
/** |
|||
* @brief |
|||
* Class for an abstract formula tree with an time bounded until operator as root. |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class TimeBoundedUntil: public TimeBoundedOperator<T> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::TimeBoundedUntil<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/** |
|||
* Constructor providing bounds only; |
|||
* Sub formulas are set to null. |
|||
* |
|||
* @param lowerBound |
|||
* @param upperBound |
|||
*/ |
|||
TimeBoundedUntil(T lowerBound, T upperBound) : |
|||
TimeBoundedOperator<T>(lowerBound, upperBound) { |
|||
this->left = nullptr; |
|||
this->right = nullptr; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* Full constructor |
|||
* @param lowerBound |
|||
* @param upperBound |
|||
* @param left |
|||
* @param right |
|||
*/ |
|||
TimeBoundedUntil(T lowerBound, T upperBound, FormulaType* left, FormulaType* right) : |
|||
TimeBoundedOperator<T>(lowerBound, upperBound) { |
|||
this->left = left; |
|||
this->right = right; |
|||
} |
|||
|
|||
virtual ~TimeBoundedUntil() { |
|||
if (left != nullptr) { |
|||
delete left; |
|||
} |
|||
if (right != nullptr) { |
|||
delete right; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* Sets the left child node. |
|||
* |
|||
* @param newLeft the new left child. |
|||
*/ |
|||
void setLeft(FormulaType* newLeft) { |
|||
left = newLeft; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the right child node. |
|||
* |
|||
* @param newRight the new right child. |
|||
*/ |
|||
void setRight(FormulaType* newRight) { |
|||
right = newRight; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the left child node |
|||
*/ |
|||
const FormulaType& getLeft() const { |
|||
return *left; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the right child node |
|||
*/ |
|||
const FormulaType& getRight() const { |
|||
return *right; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the left child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool leftIsSet() const { |
|||
return left != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the right child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool rightIsSet() const { |
|||
return right != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = left->toString(); |
|||
result += " U"; |
|||
result += TimeBoundedOperator<T>::toString(); |
|||
result += " "; |
|||
result += right->toString(); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if the subtree conforms to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff the subtree conforms to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->left) && checker.validate(this->right); |
|||
} |
|||
|
|||
private: |
|||
FormulaType* left; |
|||
FormulaType* right; |
|||
}; |
|||
|
|||
} /* namespace abstract */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_TIMEBOUNDEDUNTIL_H_ */ |
@ -1,159 +0,0 @@ |
|||
/* |
|||
* Until.h |
|||
* |
|||
* Created on: 19.10.2012 |
|||
* Author: Thomas Heinemann |
|||
*/ |
|||
|
|||
#ifndef STORM_FORMULA_ABSTRACT_UNTIL_H_ |
|||
#define STORM_FORMULA_ABSTRACT_UNTIL_H_ |
|||
|
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/abstract/AbstractFormula.h" |
|||
#include "src/formula/AbstractFormulaChecker.h" |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace abstract { |
|||
|
|||
/*! |
|||
* @brief |
|||
* Class for an abstract (path) formula tree with an Until node as root. |
|||
* |
|||
* Has two formulas as sub formulas/trees. |
|||
* |
|||
* @par Semantics |
|||
* The formula holds iff eventually, formula \e right (the right subtree) holds, and before, |
|||
* \e left holds always. |
|||
* |
|||
* The subtrees are seen as part of the object and deleted with the object |
|||
* (this behavior can be prevented by setting them to NULL before deletion) |
|||
* |
|||
* @tparam FormulaType The type of the subformula. |
|||
* The instantiation of FormulaType should be a subclass of AbstractFormula, as the functions |
|||
* "toString" and "conforms" of the subformulas are needed. |
|||
* |
|||
* @see AbstractFormula |
|||
*/ |
|||
template <class T, class FormulaType> |
|||
class Until : public virtual AbstractFormula<T> { |
|||
|
|||
// Throw a compiler error if FormulaType is not a subclass of AbstractFormula. |
|||
static_assert(std::is_base_of<AbstractFormula<T>, FormulaType>::value, |
|||
"Instantiaton of FormulaType for storm::property::abstract::Until<T,FormulaType> has to be a subtype of storm::property::abstract::AbstractFormula<T>"); |
|||
|
|||
public: |
|||
/*! |
|||
* Empty constructor |
|||
*/ |
|||
Until() { |
|||
this->left = NULL; |
|||
this->right = NULL; |
|||
} |
|||
|
|||
/*! |
|||
* Constructor |
|||
* |
|||
* @param left The left formula subtree |
|||
* @param right The left formula subtree |
|||
*/ |
|||
Until(FormulaType* left, FormulaType* right) { |
|||
this->left = left; |
|||
this->right = right; |
|||
} |
|||
|
|||
/*! |
|||
* Destructor. |
|||
* |
|||
* Also deletes the subtrees. |
|||
* (this behaviour can be prevented by setting the subtrees to NULL before deletion) |
|||
*/ |
|||
virtual ~Until() { |
|||
if (left != NULL) { |
|||
delete left; |
|||
} |
|||
if (right != NULL) { |
|||
delete right; |
|||
} |
|||
} |
|||
|
|||
/*! |
|||
* Sets the left child node. |
|||
* |
|||
* @param newLeft the new left child. |
|||
*/ |
|||
void setLeft(FormulaType* newLeft) { |
|||
left = newLeft; |
|||
} |
|||
|
|||
/*! |
|||
* Sets the right child node. |
|||
* |
|||
* @param newRight the new right child. |
|||
*/ |
|||
void setRight(FormulaType* newRight) { |
|||
right = newRight; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the left child node |
|||
*/ |
|||
const FormulaType& getLeft() const { |
|||
return *left; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a pointer to the right child node |
|||
*/ |
|||
const FormulaType& getRight() const { |
|||
return *right; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the left child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool leftIsSet() const { |
|||
return left != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* |
|||
* @return True if the right child is set, i.e. it does not point to nullptr; false otherwise |
|||
*/ |
|||
bool rightIsSet() const { |
|||
return right != nullptr; |
|||
} |
|||
|
|||
/*! |
|||
* @returns a string representation of the formula |
|||
*/ |
|||
virtual std::string toString() const override { |
|||
std::string result = left->toString(); |
|||
result += " U "; |
|||
result += right->toString(); |
|||
return result; |
|||
} |
|||
|
|||
/*! |
|||
* @brief Checks if all subtrees conform to some logic. |
|||
* |
|||
* @param checker Formula checker object. |
|||
* @return true iff all subtrees conform to some logic. |
|||
*/ |
|||
virtual bool validate(const AbstractFormulaChecker<T>& checker) const override { |
|||
return checker.validate(this->left) && checker.validate(this->right); |
|||
} |
|||
|
|||
private: |
|||
FormulaType* left; |
|||
FormulaType* right; |
|||
}; |
|||
|
|||
} //namespace abstract |
|||
|
|||
} //namespace property |
|||
|
|||
} //namespace storm |
|||
|
|||
#endif /* STORM_FORMULA_ABSTRACT_UNTIL_H_ */ |
Some files were not shown because too many files changed in this diff
Reference in new issue
xxxxxxxxxx