|
|
@ -12,11 +12,9 @@ namespace storm { |
|
|
|
class IsMaximum : public DFTConstraint { |
|
|
|
public: |
|
|
|
IsMaximum(uint64_t varIndex, std::vector<uint64_t> const& varIndices) : varIndex(varIndex), varIndices(varIndices) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
virtual ~IsMaximum() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string toSmtlib2(std::vector<std::string> const& varNames) const override { |
|
|
@ -34,26 +32,23 @@ namespace storm { |
|
|
|
sstr << ")"; // end of the or
|
|
|
|
sstr << ")"; // end outer and.
|
|
|
|
return sstr.str(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
uint64_t varIndex; |
|
|
|
std::vector<uint64_t> varIndices; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* First is the minimum of the others |
|
|
|
*/ |
|
|
|
class IsMinimum : public DFTConstraint { |
|
|
|
public: |
|
|
|
IsMinimum(uint64_t varIndex, std::vector<uint64_t> const& varIndices) : varIndex(varIndex), varIndices(varIndices) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
virtual ~IsMinimum() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string toSmtlib2(std::vector<std::string> const& varNames) const override { |
|
|
@ -71,22 +66,19 @@ namespace storm { |
|
|
|
sstr << ")"; // end of the or
|
|
|
|
sstr << ")"; // end outer and.
|
|
|
|
return sstr.str(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
uint64_t varIndex; |
|
|
|
std::vector<uint64_t> varIndices; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class BetweenValues : public DFTConstraint { |
|
|
|
public: |
|
|
|
BetweenValues(uint64_t varIndex, uint64_t lower, uint64_t upper) : varIndex(varIndex), upperBound(upper) , lowerBound(lower) { |
|
|
|
|
|
|
|
} |
|
|
|
virtual ~BetweenValues() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string toSmtlib2(std::vector<std::string> const& varNames) const override { |
|
|
@ -104,12 +96,11 @@ namespace storm { |
|
|
|
uint64_t lowerBound; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class And : public DFTConstraint { |
|
|
|
public: |
|
|
|
And(std::vector<std::shared_ptr<DFTConstraint>> const& constraints) : constraints(constraints) {} |
|
|
|
|
|
|
|
virtual ~And() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string toSmtlib2(std::vector<std::string> const& varNames) const override { |
|
|
@ -121,18 +112,18 @@ namespace storm { |
|
|
|
sstr << ")"; |
|
|
|
return sstr.str(); |
|
|
|
} |
|
|
|
|
|
|
|
private: |
|
|
|
std::vector<std::shared_ptr<DFTConstraint>> constraints; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class Iff : public DFTConstraint { |
|
|
|
public: |
|
|
|
Iff(std::shared_ptr<DFTConstraint> l, std::shared_ptr<DFTConstraint> r) : lhs(l), rhs(r) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::string toSmtlib2(std::vector<std::string> const& varNames) const override { |
|
|
|
std::stringstream sstr; |
|
|
|
sstr << "(= " << lhs->toSmtlib2(varNames) << " " << rhs->toSmtlib2(varNames) << ")"; |
|
|
@ -144,14 +135,13 @@ namespace storm { |
|
|
|
std::shared_ptr<DFTConstraint> rhs; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class IsConstantValue : public DFTConstraint { |
|
|
|
public: |
|
|
|
IsConstantValue(uint64_t varIndex, uint64_t val) : varIndex(varIndex), value(val) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
virtual ~IsConstantValue() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string toSmtlib2(std::vector<std::string> const& varNames) const override { |
|
|
@ -166,14 +156,13 @@ namespace storm { |
|
|
|
uint64_t value; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class IsEqual : public DFTConstraint { |
|
|
|
public: |
|
|
|
IsEqual(uint64_t varIndex1, uint64_t varIndex2) :var1Index(varIndex1), var2Index(varIndex2) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
virtual ~IsEqual() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string toSmtlib2(std::vector<std::string> const& varNames) const override { |
|
|
@ -185,14 +174,13 @@ namespace storm { |
|
|
|
uint64_t var2Index; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class IsLEqual : public DFTConstraint { |
|
|
|
public: |
|
|
|
IsLEqual(uint64_t varIndex1, uint64_t varIndex2) :var1Index(varIndex1), var2Index(varIndex2) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
virtual ~IsLEqual() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string toSmtlib2(std::vector<std::string> const& varNames) const override { |
|
|
@ -204,13 +192,12 @@ namespace storm { |
|
|
|
uint64_t var2Index; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class PairwiseDifferent : public DFTConstraint { |
|
|
|
public: |
|
|
|
PairwiseDifferent(std::vector<uint64_t> const& indices) : varIndices(indices) { |
|
|
|
|
|
|
|
} |
|
|
|
virtual ~PairwiseDifferent() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string toSmtlib2(std::vector<std::string> const& varNames) const override { |
|
|
@ -232,14 +219,13 @@ namespace storm { |
|
|
|
std::vector<uint64_t> varIndices; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class Sorted : public DFTConstraint { |
|
|
|
public: |
|
|
|
Sorted(std::vector<uint64_t> varIndices) : varIndices(varIndices) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
virtual ~Sorted() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string toSmtlib2(std::vector<std::string> const& varNames) const override { |
|
|
@ -252,15 +238,14 @@ namespace storm { |
|
|
|
return sstr.str(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
std::vector<uint64_t> varIndices; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class IfThenElse : public DFTConstraint { |
|
|
|
public: |
|
|
|
IfThenElse(std::shared_ptr<DFTConstraint> ifC, std::shared_ptr<DFTConstraint> thenC, std::shared_ptr<DFTConstraint> elseC) : ifConstraint(ifC), thenConstraint(thenC), elseConstraint(elseC) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
std::string toSmtlib2(std::vector<std::string> const& varNames) const override { |
|
|
@ -285,7 +270,6 @@ namespace storm { |
|
|
|
} |
|
|
|
|
|
|
|
void DFTASFChecker::convert() { |
|
|
|
|
|
|
|
std::vector<uint64_t> beVariables; |
|
|
|
// Convert all elements
|
|
|
|
for (size_t i = 0; i < dft.nrElements(); ++i) { |
|
|
@ -333,7 +317,6 @@ namespace storm { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < dft.nrElements(); ++i) { |
|
|
|
std::vector<uint64_t> childVarIndices; |
|
|
|
if (dft.isGate(i)) { |
|
|
@ -390,7 +373,6 @@ namespace storm { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
constraints.push_back(std::make_shared<IsConstantValue>(dft.getTopLevelIndex(), dft.nrBasicElements()+1)); |
|
|
|
} |
|
|
|
|
|
|
|