Browse Source
more refactoring of formula classes: in particular fragment checking
more refactoring of formula classes: in particular fragment checking
Former-commit-id: 544c5f953f
main
60 changed files with 874 additions and 681 deletions
-
2src/builder/DdPrismModelBuilder.cpp
-
2src/builder/ExplicitPrismModelBuilder.cpp
-
18src/logic/AtomicExpressionFormula.cpp
-
5src/logic/AtomicExpressionFormula.h
-
18src/logic/AtomicLabelFormula.cpp
-
5src/logic/AtomicLabelFormula.h
-
6src/logic/BinaryBooleanStateFormula.cpp
-
2src/logic/BinaryBooleanStateFormula.h
-
40src/logic/BinaryPathFormula.cpp
-
11src/logic/BinaryPathFormula.h
-
40src/logic/BinaryStateFormula.cpp
-
11src/logic/BinaryStateFormula.h
-
26src/logic/BooleanLiteralFormula.cpp
-
5src/logic/BooleanLiteralFormula.h
-
24src/logic/BoundedUntilFormula.cpp
-
9src/logic/BoundedUntilFormula.h
-
42src/logic/ConditionalFormula.cpp
-
38src/logic/ConditionalFormula.h
-
40src/logic/ConditionalPathFormula.cpp
-
32src/logic/ConditionalPathFormula.h
-
10src/logic/CumulativeRewardFormula.cpp
-
5src/logic/CumulativeRewardFormula.h
-
28src/logic/EventuallyFormula.cpp
-
14src/logic/EventuallyFormula.h
-
18src/logic/ExpectedTimeOperatorFormula.cpp
-
7src/logic/ExpectedTimeOperatorFormula.h
-
108src/logic/Formula.cpp
-
105src/logic/Formula.h
-
36src/logic/FormulaVisitor.h
-
2src/logic/Formulas.h
-
36src/logic/FormulasForwardDeclarations.h
-
118src/logic/FragmentChecker.cpp
-
39src/logic/FragmentChecker.h
-
209src/logic/FragmentSpecification.cpp
-
112src/logic/FragmentSpecification.h
-
8src/logic/GloballyFormula.cpp
-
4src/logic/GloballyFormula.h
-
8src/logic/InstantaneousRewardFormula.cpp
-
6src/logic/InstantaneousRewardFormula.h
-
18src/logic/LongRunAverageOperatorFormula.cpp
-
5src/logic/LongRunAverageOperatorFormula.h
-
8src/logic/LongRunAverageRewardFormula.cpp
-
5src/logic/LongRunAverageRewardFormula.h
-
8src/logic/NextFormula.cpp
-
4src/logic/NextFormula.h
-
26src/logic/ProbabilityOperatorFormula.cpp
-
9src/logic/ProbabilityOperatorFormula.h
-
18src/logic/RewardOperatorFormula.cpp
-
4src/logic/RewardOperatorFormula.h
-
6src/logic/UnaryBooleanStateFormula.cpp
-
2src/logic/UnaryBooleanStateFormula.h
-
36src/logic/UnaryPathFormula.cpp
-
10src/logic/UnaryPathFormula.h
-
42src/logic/UnaryStateFormula.cpp
-
11src/logic/UnaryStateFormula.h
-
8src/logic/UntilFormula.cpp
-
4src/logic/UntilFormula.h
-
20src/modelchecker/AbstractModelChecker.cpp
-
3src/modelchecker/AbstractModelChecker.h
-
31src/modelchecker/CheckTask.h
@ -0,0 +1,42 @@ |
|||||
|
#include "src/logic/ConditionalFormula.h"
|
||||
|
|
||||
|
#include "src/logic/FormulaVisitor.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace logic { |
||||
|
ConditionalFormula::ConditionalFormula(std::shared_ptr<Formula const> const& subformula, std::shared_ptr<Formula const> const& conditionFormula, Context context) : subformula(subformula), conditionFormula(conditionFormula), context(context) { |
||||
|
// Intentionally left empty.
|
||||
|
} |
||||
|
|
||||
|
Formula const& ConditionalFormula::getSubformula() const { |
||||
|
return *subformula; |
||||
|
} |
||||
|
|
||||
|
Formula const& ConditionalFormula::getConditionFormula() const { |
||||
|
return *conditionFormula; |
||||
|
} |
||||
|
|
||||
|
bool ConditionalFormula::isConditionalProbabilityFormula() const { |
||||
|
return context == Context::Probability; |
||||
|
} |
||||
|
|
||||
|
bool ConditionalFormula::isConditionalRewardFormula() const { |
||||
|
return context == Context::Reward; |
||||
|
} |
||||
|
|
||||
|
boost::any ConditionalFormula::accept(FormulaVisitor const& visitor, boost::any const& data) const { |
||||
|
return visitor.visit(*this, data); |
||||
|
} |
||||
|
|
||||
|
std::shared_ptr<Formula> ConditionalFormula::substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) const { |
||||
|
return std::make_shared<ConditionalFormula>(this->getSubformula().substitute(substitution), this->getConditionFormula().substitute(substitution)); |
||||
|
} |
||||
|
|
||||
|
std::ostream& ConditionalFormula::writeToStream(std::ostream& out) const { |
||||
|
this->getSubformula().writeToStream(out); |
||||
|
out << " || "; |
||||
|
this->getConditionFormula().writeToStream(out); |
||||
|
return out; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
#ifndef STORM_LOGIC_CONDITIONALFORMULA_H_ |
||||
|
#define STORM_LOGIC_CONDITIONALFORMULA_H_ |
||||
|
|
||||
|
#include "src/logic/BinaryPathFormula.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace logic { |
||||
|
class ConditionalFormula : public Formula { |
||||
|
public: |
||||
|
enum class Context { Probability, Reward }; |
||||
|
|
||||
|
ConditionalFormula(std::shared_ptr<Formula const> const& subformula, std::shared_ptr<Formula const> const& conditionFormula, Context context = Context::Probability); |
||||
|
|
||||
|
virtual ~ConditionalFormula() { |
||||
|
// Intentionally left empty. |
||||
|
} |
||||
|
|
||||
|
Formula const& getSubformula() const; |
||||
|
Formula const& getConditionFormula() const; |
||||
|
|
||||
|
virtual bool isConditionalProbabilityFormula() const override; |
||||
|
virtual bool isConditionalRewardFormula() const override; |
||||
|
|
||||
|
virtual boost::any accept(FormulaVisitor const& visitor, boost::any const& data) const override; |
||||
|
|
||||
|
virtual std::ostream& writeToStream(std::ostream& out) const override; |
||||
|
|
||||
|
virtual std::shared_ptr<Formula> substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) const override; |
||||
|
|
||||
|
private: |
||||
|
std::shared_ptr<Formula const> subformula; |
||||
|
std::shared_ptr<Formula const> conditionFormula; |
||||
|
Context context; |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endif /* STORM_LOGIC_CONDITIONALFORMULA_H_ */ |
@ -1,40 +0,0 @@ |
|||||
#include "src/logic/ConditionalPathFormula.h"
|
|
||||
|
|
||||
namespace storm { |
|
||||
namespace logic { |
|
||||
ConditionalPathFormula::ConditionalPathFormula(std::shared_ptr<Formula const> const& leftSubformula, std::shared_ptr<Formula const> const& rightSubformula, bool isRewardFormula) : BinaryPathFormula(leftSubformula, rightSubformula), isRewardFormula(isRewardFormula) { |
|
||||
// Intentionally left empty.
|
|
||||
} |
|
||||
|
|
||||
bool ConditionalPathFormula::isConditionalPathFormula() const { |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
bool ConditionalPathFormula::isValidProbabilityPathFormula() const { |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
bool ConditionalPathFormula::isPctlWithConditionalPathFormula() const { |
|
||||
return this->getLeftSubformula().isPctlPathFormula() && this->getRightSubformula().isPctlPathFormula(); |
|
||||
} |
|
||||
|
|
||||
bool ConditionalPathFormula::isRewardPathFormula() const { |
|
||||
return this->isRewardFormula && this->isValidRewardPathFormula(); |
|
||||
} |
|
||||
|
|
||||
bool ConditionalPathFormula::isValidRewardPathFormula() const { |
|
||||
return this->getLeftSubformula().isRewardPathFormula() && !this->getLeftSubformula().isConditionalPathFormula() && this->getRightSubformula().isPctlPathFormula(); |
|
||||
} |
|
||||
|
|
||||
std::shared_ptr<Formula> ConditionalPathFormula::substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) const { |
|
||||
return std::make_shared<ConditionalPathFormula>(this->getLeftSubformula().substitute(substitution), this->getRightSubformula().substitute(substitution)); |
|
||||
} |
|
||||
|
|
||||
std::ostream& ConditionalPathFormula::writeToStream(std::ostream& out) const { |
|
||||
this->getLeftSubformula().writeToStream(out); |
|
||||
out << " || "; |
|
||||
this->getRightSubformula().writeToStream(out); |
|
||||
return out; |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,32 +0,0 @@ |
|||||
#ifndef STORM_LOGIC_CONDITIONALPATHFORMULA_H_ |
|
||||
#define STORM_LOGIC_CONDITIONALPATHFORMULA_H_ |
|
||||
|
|
||||
#include "src/logic/BinaryPathFormula.h" |
|
||||
|
|
||||
namespace storm { |
|
||||
namespace logic { |
|
||||
class ConditionalPathFormula : public BinaryPathFormula { |
|
||||
public: |
|
||||
ConditionalPathFormula(std::shared_ptr<Formula const> const& leftSubformula, std::shared_ptr<Formula const> const& rightSubformula, bool isRewardFormula = false); |
|
||||
|
|
||||
virtual ~ConditionalPathFormula() { |
|
||||
// Intentionally left empty. |
|
||||
} |
|
||||
|
|
||||
virtual bool isPctlWithConditionalPathFormula() const override; |
|
||||
virtual bool isRewardPathFormula() const override; |
|
||||
virtual bool isConditionalPathFormula() const override; |
|
||||
virtual bool isValidProbabilityPathFormula() const override; |
|
||||
virtual bool isValidRewardPathFormula() const override; |
|
||||
|
|
||||
virtual std::ostream& writeToStream(std::ostream& out) const override; |
|
||||
|
|
||||
virtual std::shared_ptr<Formula> substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) const override; |
|
||||
|
|
||||
private: |
|
||||
bool isRewardFormula; |
|
||||
}; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
#endif /* STORM_LOGIC_CONDITIONALPATHFORMULA_H_ */ |
|
@ -0,0 +1,36 @@ |
|||||
|
#ifndef STORM_LOGIC_FORMULAVISITOR_H_ |
||||
|
#define STORM_LOGIC_FORMULAVISITOR_H_ |
||||
|
|
||||
|
#include <boost/any.hpp> |
||||
|
|
||||
|
#include "src/logic/FormulasForwardDeclarations.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace logic { |
||||
|
|
||||
|
class FormulaVisitor { |
||||
|
public: |
||||
|
virtual boost::any visit(AtomicExpressionFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(AtomicLabelFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(BinaryBooleanStateFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(BooleanLiteralFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(BoundedUntilFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(ConditionalFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(CumulativeRewardFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(EventuallyFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(ExpectedTimeOperatorFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(GloballyFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(InstantaneousRewardFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(NextFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(ProbabilityOperatorFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(RewardOperatorFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(UnaryBooleanStateFormula const& f, boost::any const& data) const = 0; |
||||
|
virtual boost::any visit(UntilFormula const& f, boost::any const& data) const = 0; |
||||
|
}; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endif /* STORM_LOGIC_FORMULAVISITOR_H_ */ |
@ -0,0 +1,36 @@ |
|||||
|
#ifndef STORM_LOGIC_FORMULASFORWARDDECLARATIONS_H_ |
||||
|
#define STORM_LOGIC_FORMULASFORWARDDECLARATIONS_H_ |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace logic { |
||||
|
// Forward-declare all formula classes. |
||||
|
class Formula; |
||||
|
class AtomicExpressionFormula; |
||||
|
class AtomicLabelFormula; |
||||
|
class BinaryBooleanStateFormula; |
||||
|
class BinaryPathFormula; |
||||
|
class BinaryStateFormula; |
||||
|
class BooleanLiteralFormula; |
||||
|
class BoundedUntilFormula; |
||||
|
class ConditionalFormula; |
||||
|
class CumulativeRewardFormula; |
||||
|
class EventuallyFormula; |
||||
|
class ExpectedTimeOperatorFormula; |
||||
|
class GloballyFormula; |
||||
|
class InstantaneousRewardFormula; |
||||
|
class LongRunAverageOperatorFormula; |
||||
|
class LongRunAverageRewardFormula; |
||||
|
class NextFormula; |
||||
|
class OperatorFormula; |
||||
|
class PathFormula; |
||||
|
class ProbabilityOperatorFormula; |
||||
|
class RewardOperatorFormula; |
||||
|
class StateFormula; |
||||
|
class UnaryBooleanStateFormula; |
||||
|
class UnaryPathFormula; |
||||
|
class UnaryStateFormula; |
||||
|
class UntilFormula; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endif /* STORM_LOGIC_FORMULASFORWARDDECLARATIONS_H_ */ |
@ -0,0 +1,118 @@ |
|||||
|
#include "src/logic/FragmentChecker.h"
|
||||
|
|
||||
|
#include "src/logic/Formulas.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace logic { |
||||
|
bool FragmentChecker::conformsToSpecification(Formula const& f, FragmentSpecification const& specification) const { |
||||
|
boost::any result = f.accept(*this, specification); |
||||
|
return boost::any_cast<bool>(result); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(AtomicExpressionFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areAtomicExpressionFormulasAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(AtomicLabelFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areAtomicLabelFormulasAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(BinaryBooleanStateFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
bool result = specification.areBinaryBooleanStateFormulasAllowed(); |
||||
|
result = result && boost::any_cast<bool>(f.getLeftSubformula().accept(*this, specification)); |
||||
|
result = result && boost::any_cast<bool>(f.getRightSubformula().accept(*this, specification)); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(BooleanLiteralFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areBooleanLiteralFormulasAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(BoundedUntilFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
bool result = specification.areBoundedUntilFormulasAllowed(); |
||||
|
result = result && boost::any_cast<bool>(f.getLeftSubformula().accept(*this, data)); |
||||
|
result = result && boost::any_cast<bool>(f.getRightSubformula().accept(*this, data)); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(ConditionalFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
bool result = true; |
||||
|
if (f.isConditionalProbabilityFormula()) { |
||||
|
result &= specification.areConditionalProbabilityFormulasAllowed(); |
||||
|
} else if (f.Formula::isConditionalRewardFormula()) { |
||||
|
result &= specification.areConditionalRewardFormulasFormulasAllowed(); |
||||
|
} |
||||
|
result = result && boost::any_cast<bool>(f.getSubformula().accept(*this, data)); |
||||
|
result = result && boost::any_cast<bool>(f.getConditionFormula().accept(*this, data)); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(CumulativeRewardFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areCumulativeRewardFormulasAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(EventuallyFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
bool result = specification.areEventuallyFormulasAllowed(); |
||||
|
result && boost::any_cast<bool>(f.getSubformula().accept(*this, data)); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(ExpectedTimeOperatorFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areExpectedTimeOperatorsAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(GloballyFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areGloballyFormulasAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(InstantaneousRewardFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areInstantaneousRewardFormulasAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areLongRunAverageOperatorsAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(LongRunAverageRewardFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areLongRunAverageRewardFormulasAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(NextFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areNextFormulasAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(ProbabilityOperatorFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areProbabilityOperatorsAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(RewardOperatorFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areRewardOperatorsAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(UnaryBooleanStateFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areUnaryBooleanStateFormulasAllowed(); |
||||
|
} |
||||
|
|
||||
|
boost::any FragmentChecker::visit(UntilFormula const& f, boost::any const& data) const { |
||||
|
FragmentSpecification const& specification = boost::any_cast<FragmentSpecification const&>(data); |
||||
|
return specification.areUntilFormulasAllowed(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
#ifndef STORM_LOGIC_FRAGMENTCHECKER_H_ |
||||
|
#define STORM_LOGIC_FRAGMENTCHECKER_H_ |
||||
|
|
||||
|
#include "src/logic/FormulaVisitor.h" |
||||
|
|
||||
|
#include "src/logic/FragmentSpecification.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace logic { |
||||
|
|
||||
|
class FragmentChecker : public FormulaVisitor { |
||||
|
public: |
||||
|
bool conformsToSpecification(Formula const& f, FragmentSpecification const& specification) const; |
||||
|
|
||||
|
virtual boost::any visit(AtomicExpressionFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(AtomicLabelFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(BinaryBooleanStateFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(BooleanLiteralFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(BoundedUntilFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(ConditionalFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(CumulativeRewardFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(EventuallyFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(ExpectedTimeOperatorFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(GloballyFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(InstantaneousRewardFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(NextFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(ProbabilityOperatorFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(RewardOperatorFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(UnaryBooleanStateFormula const& f, boost::any const& data) const override; |
||||
|
virtual boost::any visit(UntilFormula const& f, boost::any const& data) const override; |
||||
|
}; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
#endif /* STORM_LOGIC_FRAGMENTCHECKER_H_ */ |
@ -0,0 +1,209 @@ |
|||||
|
#include "src/logic/FragmentSpecification.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace logic { |
||||
|
|
||||
|
FragmentSpecification FragmentSpecification::copy() const { |
||||
|
return FragmentSpecification(*this); |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areProbabilityOperatorsAllowed() const { |
||||
|
return probabilityOperator; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setProbabilityOperatorsAllowed(bool newValue) { |
||||
|
this->probabilityOperator = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areRewardOperatorsAllowed() const { |
||||
|
return rewardOperator; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setRewardOperatorsAllowed(bool newValue) { |
||||
|
this->rewardOperator = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areExpectedTimeOperatorsAllowed() const { |
||||
|
return expectedTimeOperator; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setExpectedTimeOperatorsAllowed(bool newValue) { |
||||
|
this->expectedTimeOperator = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areLongRunAverageOperatorsAllowed() const { |
||||
|
return longRunAverageOperator; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setLongRunAverageOperatorsAllowed(bool newValue) { |
||||
|
this->longRunAverageOperator = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areGloballyFormulasAllowed() const { |
||||
|
return globallyFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setGloballyFormulasAllowed(bool newValue) { |
||||
|
this->globallyFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areEventuallyFormulasAllowed() const { |
||||
|
return eventuallyFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setEventuallyFormulasAllowed(bool newValue) { |
||||
|
this->eventuallyFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areNextFormulasAllowed() const { |
||||
|
return nextFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setNextFormulasAllowed(bool newValue) { |
||||
|
this->nextFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areUntilFormulasAllowed() const { |
||||
|
return untilFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setUntilFormulasAllowed(bool newValue) { |
||||
|
this->untilFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areBoundedUntilFormulasAllowed() const { |
||||
|
return boundedUntilFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setBoundedUntilFormulasAllowed(bool newValue) { |
||||
|
this->boundedUntilFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areAtomicExpressionFormulasAllowed() const { |
||||
|
return atomicExpressionFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setAtomicExpressionFormulasAllowed(bool newValue) { |
||||
|
this->atomicExpressionFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areAtomicLabelFormulasAllowed() const { |
||||
|
return atomicLabelFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setAtomicLabelFormulasAllowed(bool newValue) { |
||||
|
this->atomicLabelFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areBooleanLiteralFormulasAllowed() const { |
||||
|
return booleanLiteralFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setBooleanLiteralFormulasAllowed(bool newValue) { |
||||
|
this->booleanLiteralFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areUnaryBooleanStateFormulasAllowed() const { |
||||
|
return unaryBooleanStateFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setUnaryBooleanStateFormulasAllowed(bool newValue) { |
||||
|
this->unaryBooleanStateFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areBinaryBooleanStateFormulasAllowed() const { |
||||
|
return binaryBooleanStateFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setBinaryBooleanStateFormulasAllowed(bool newValue) { |
||||
|
this->binaryBooleanStateFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areCumulativeRewardFormulasAllowed() const { |
||||
|
return cumulativeRewardFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setCumulativeRewardFormulasAllowed(bool newValue) { |
||||
|
this->cumulativeRewardFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areInstantaneousRewardFormulasAllowed() const { |
||||
|
return instantaneousRewardFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setInstantaneousFormulasAllowed(bool newValue) { |
||||
|
this->instantaneousRewardFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areReachabilityRewardFormulasAllowed() const { |
||||
|
return reachabilityRewardFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setReachabilityRewardFormulasAllowed(bool newValue) { |
||||
|
this->reachabilityRewardFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areLongRunAverageRewardFormulasAllowed() const { |
||||
|
return longRunAverageRewardFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setLongRunAverageRewardFormulasAllowed(bool newValue) { |
||||
|
this->longRunAverageRewardFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areConditionalProbabilityFormulasAllowed() const { |
||||
|
return conditionalProbabilityFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setConditionalProbabilityFormulasAllowed(bool newValue) { |
||||
|
this->conditionalProbabilityFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areConditionalRewardFormulasFormulasAllowed() const { |
||||
|
return conditionalRewardFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setConditionalRewardFormulasAllowed(bool newValue) { |
||||
|
this->conditionalRewardFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areReachbilityExpectedTimeFormulasAllowed() const { |
||||
|
return reachabilityExpectedTimeFormula; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setReachbilityExpectedTimeFormulasAllowed(bool newValue) { |
||||
|
this->reachabilityExpectedTimeFormula = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
bool FragmentSpecification::areNestedOperatorsAllowed() const { |
||||
|
return this->nestedOperators; |
||||
|
} |
||||
|
|
||||
|
FragmentSpecification& FragmentSpecification::setNestedOperatorsAllowed(bool newValue) { |
||||
|
this->nestedOperators = newValue; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,112 @@ |
|||||
|
#ifndef STORM_LOGIC_FRAGMENTSPECIFICATION_H_ |
||||
|
#define STORM_LOGIC_FRAGMENTSPECIFICATION_H_ |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace logic { |
||||
|
class FragmentSpecification { |
||||
|
public: |
||||
|
FragmentSpecification copy() const; |
||||
|
|
||||
|
bool areProbabilityOperatorsAllowed() const; |
||||
|
FragmentSpecification& setProbabilityOperatorsAllowed(bool newValue); |
||||
|
|
||||
|
bool areRewardOperatorsAllowed() const; |
||||
|
FragmentSpecification& setRewardOperatorsAllowed(bool newValue); |
||||
|
|
||||
|
bool areExpectedTimeOperatorsAllowed() const; |
||||
|
FragmentSpecification& setExpectedTimeOperatorsAllowed(bool newValue); |
||||
|
|
||||
|
bool areLongRunAverageOperatorsAllowed() const; |
||||
|
FragmentSpecification& setLongRunAverageOperatorsAllowed(bool newValue); |
||||
|
|
||||
|
bool areGloballyFormulasAllowed() const; |
||||
|
FragmentSpecification& setGloballyFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areEventuallyFormulasAllowed() const; |
||||
|
FragmentSpecification& setEventuallyFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areNextFormulasAllowed() const; |
||||
|
FragmentSpecification& setNextFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areUntilFormulasAllowed() const; |
||||
|
FragmentSpecification& setUntilFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areBoundedUntilFormulasAllowed() const; |
||||
|
FragmentSpecification& setBoundedUntilFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areAtomicExpressionFormulasAllowed() const; |
||||
|
FragmentSpecification& setAtomicExpressionFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areAtomicLabelFormulasAllowed() const; |
||||
|
FragmentSpecification& setAtomicLabelFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areBooleanLiteralFormulasAllowed() const; |
||||
|
FragmentSpecification& setBooleanLiteralFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areUnaryBooleanStateFormulasAllowed() const; |
||||
|
FragmentSpecification& setUnaryBooleanStateFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areBinaryBooleanStateFormulasAllowed() const; |
||||
|
FragmentSpecification& setBinaryBooleanStateFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areCumulativeRewardFormulasAllowed() const; |
||||
|
FragmentSpecification& setCumulativeRewardFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areInstantaneousRewardFormulasAllowed() const; |
||||
|
FragmentSpecification& setInstantaneousFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areReachabilityRewardFormulasAllowed() const; |
||||
|
FragmentSpecification& setReachabilityRewardFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areLongRunAverageRewardFormulasAllowed() const; |
||||
|
FragmentSpecification& setLongRunAverageRewardFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areConditionalProbabilityFormulasAllowed() const; |
||||
|
FragmentSpecification& setConditionalProbabilityFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areConditionalRewardFormulasFormulasAllowed() const; |
||||
|
FragmentSpecification& setConditionalRewardFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areReachbilityExpectedTimeFormulasAllowed() const; |
||||
|
FragmentSpecification& setReachbilityExpectedTimeFormulasAllowed(bool newValue); |
||||
|
|
||||
|
bool areNestedOperatorsAllowed() const; |
||||
|
FragmentSpecification& setNestedOperatorsAllowed(bool newValue); |
||||
|
|
||||
|
private: |
||||
|
// Flags that indicate whether it is legal to see such a formula. |
||||
|
bool probabilityOperator; |
||||
|
bool rewardOperator; |
||||
|
bool expectedTimeOperator; |
||||
|
bool longRunAverageOperator; |
||||
|
|
||||
|
bool globallyFormula; |
||||
|
bool eventuallyFormula; |
||||
|
bool nextFormula; |
||||
|
bool untilFormula; |
||||
|
bool boundedUntilFormula; |
||||
|
|
||||
|
bool atomicExpressionFormula; |
||||
|
bool atomicLabelFormula; |
||||
|
bool booleanLiteralFormula; |
||||
|
bool unaryBooleanStateFormula; |
||||
|
bool binaryBooleanStateFormula; |
||||
|
|
||||
|
bool cumulativeRewardFormula; |
||||
|
bool instantaneousRewardFormula; |
||||
|
bool reachabilityRewardFormula; |
||||
|
bool longRunAverageRewardFormula; |
||||
|
|
||||
|
bool conditionalProbabilityFormula; |
||||
|
bool conditionalRewardFormula; |
||||
|
|
||||
|
bool reachabilityExpectedTimeFormula; |
||||
|
|
||||
|
// Members that indicate certain restrictions. |
||||
|
bool nestedOperators; |
||||
|
|
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endif /* STORM_LOGIC_FRAGMENTSPECIFICATION_H_ */ |
Write
Preview
Loading…
Cancel
Save
Reference in new issue