masawei
11 years ago
44 changed files with 9 additions and 574 deletions
-
19src/formula/AbstractFormula.h
-
74src/formula/AbstractFormulaChecker.h
-
49src/formula/PrctlFormulaChecker.h
-
4src/formula/csl/AbstractCslFormula.h
-
11src/formula/csl/And.h
-
13src/formula/csl/Ap.h
-
10src/formula/csl/Eventually.h
-
11src/formula/csl/Globally.h
-
11src/formula/csl/Next.h
-
11src/formula/csl/Not.h
-
11src/formula/csl/Or.h
-
10src/formula/csl/ProbabilisticBoundOperator.h
-
11src/formula/csl/SteadyStateBoundOperator.h
-
10src/formula/csl/TimeBoundedEventually.h
-
10src/formula/csl/TimeBoundedUntil.h
-
11src/formula/csl/Until.h
-
11src/formula/ltl/And.h
-
12src/formula/ltl/Ap.h
-
11src/formula/ltl/BoundedEventually.h
-
10src/formula/ltl/BoundedUntil.h
-
10src/formula/ltl/Eventually.h
-
11src/formula/ltl/Globally.h
-
11src/formula/ltl/Next.h
-
11src/formula/ltl/Not.h
-
10src/formula/ltl/Or.h
-
11src/formula/ltl/Until.h
-
4src/formula/prctl/AbstractPrctlFormula.h
-
11src/formula/prctl/And.h
-
13src/formula/prctl/Ap.h
-
11src/formula/prctl/BoundedEventually.h
-
14src/formula/prctl/BoundedNaryUntil.h
-
10src/formula/prctl/BoundedUntil.h
-
13src/formula/prctl/CumulativeReward.h
-
10src/formula/prctl/Eventually.h
-
11src/formula/prctl/Globally.h
-
13src/formula/prctl/InstantaneousReward.h
-
11src/formula/prctl/Next.h
-
12src/formula/prctl/Not.h
-
11src/formula/prctl/Or.h
-
10src/formula/prctl/ProbabilisticBoundOperator.h
-
11src/formula/prctl/ReachabilityReward.h
-
10src/formula/prctl/RewardBoundOperator.h
-
13src/formula/prctl/SteadyStateReward.h
-
11src/formula/prctl/Until.h
@ -1,74 +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/AbstractFormula.h" |
|||
#include <memory> |
|||
|
|||
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(std::shared_ptr<AbstractFormula<T>> const & formula) const = 0; |
|||
}; |
|||
|
|||
} // namespace property |
|||
} // namespace storm |
|||
|
|||
#endif |
@ -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> |
|||
#include <memory> |
|||
|
|||
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(std::shared_ptr<storm::property::AbstractFormula<T>> const & formula) const { |
|||
// What to support: Principles of Model Checking Def. 10.76 + syntactic sugar |
|||
if ( |
|||
dynamic_pointer_cast<storm::property::prctl::And<T>>(formula) || |
|||
dynamic_pointer_cast<storm::property::prctl::Ap<T>>(formula) || |
|||
dynamic_pointer_cast<storm::property::prctl::BoundedUntil<T>>(formula) || |
|||
dynamic_pointer_cast<storm::property::prctl::Eventually<T>>(formula) || |
|||
dynamic_pointer_cast<storm::property::prctl::Globally<T>>(formula) || |
|||
dynamic_pointer_cast<storm::property::prctl::Next<T>>(formula) || |
|||
dynamic_pointer_cast<storm::property::prctl::Not<T>>(formula) || |
|||
dynamic_pointer_cast<storm::property::prctl::Or<T>>(formula) || |
|||
dynamic_pointer_cast<storm::property::prctl::ProbabilisticBoundOperator<T>>(formula) || |
|||
dynamic_pointer_cast<storm::property::prctl::Until<T>>(formula) |
|||
) { |
|||
return formula->validate(*this); |
|||
} |
|||
return false; |
|||
} |
|||
}; |
|||
|
|||
} // namespace property |
|||
} // namespace storm |
|||
|
|||
#endif |
Write
Preview
Loading…
Cancel
Save
Reference in new issue