6 return f_value.getConst<Rational>().getNumerator().toUnsignedInt() != 0;
12 NeiderJansenMethod::NeiderJansenMethod(
const std::set<std::string> &SpSet,
const std::set<std::string> &SmSet,
const std::set<std::string> &SSet,
const std::set<std::string> &prefixesSet,
const std::set<char> &alphabetSet,
unsigned int n) :
13 SMTMethod(SpSet, SmSet, SSet, prefixesSet, alphabetSet, n)
17 logic.enableIntegers();
18 logic.enableTheory(theory::THEORY_UF);
35 DatatypeType intTimesInt =
m_exprManager.mkTupleType({integer, integer});
37 intTimesIntConstructor = intTimesInt.getDatatype()[0].getConstructor();
41 Type intToInt =
m_exprManager.mkFunctionType(integer, integer);
43 Type intTimesIntToInt =
m_exprManager.mkFunctionType(intTimesInt, integer);
57 m_prefixToInt.emplace(u,
m_exprManager.mkConst(Rational(i++)));
72 assumptions = assumptions.andExpr(
88 for (
const auto &uj : m_prefixes) {
90 if (uj.size() > 0 && uj.substr(0, uj.size() - 1) == ui) {
91 Expr a =
m_exprManager.mkConst(Rational(uj.at(uj.size() - 1)));
92 Expr i = m_prefixToInt[ui];
93 Expr j = m_prefixToInt[uj];
97 Expr x_i_a =
m_exprManager.mkExpr(kind::APPLY_CONSTRUCTOR, intTimesIntConstructor, x_i, a);
99 assumptions = assumptions.andExpr(
110 for (
const auto &ui :
m_Sp) {
111 Expr x_i =
m_exprManager.mkExpr(kind::APPLY_UF, x, m_prefixToInt[ui]);
113 assumptions = assumptions.andExpr(
m_exprManager.mkExpr(kind::DISTINCT, f_x_i, zero));
115 for (
const auto &ui :
m_Sm) {
116 Expr x_i =
m_exprManager.mkExpr(kind::APPLY_UF, x, m_prefixToInt[ui]);
118 assumptions = assumptions.andExpr(
m_exprManager.mkExpr(kind::EQUAL, f_x_i, zero));
122 for (
const auto &ui : m_prefixes) {
123 Expr x_i =
m_exprManager.mkExpr(kind::APPLY_UF, x, m_prefixToInt[ui]);
124 assumptions = assumptions.andExpr(
m_exprManager.mkExpr(kind::GEQ, x_i, zero));
133 unsigned int initial =
m_SMTEngine.getValue(x_0).getConst<Rational>().getNumerator().toUnsignedInt();
152 unsigned int j =
m_SMTEngine.getValue(d_i_a).getConst<Rational>().getNumerator().toUnsignedInt();
154 dfa->addTransition(i, a, j);
const std::set< char > m_alphabet
The namespace of the library.
const std::set< std::string > m_Sm
The set of words to reject .
const std::set< std::string > m_prefixes
std::unique_ptr< DFA< char > > toDFA()
Effectively creates the DFA from the values of the variables in the SMT solver (see SMTMethod::m_SMTE...
bool isAccepting(Expr f_value)
static bool s_registered
Useful to make sure the template is correctly used by the compiler.
CVC4::Expr createConstraints() override
Creates an unique expression describing the constraints of this method.
static std::string getFactoryName()
The base class for every SMT-based method.
const unsigned int m_numberStates
The number of states in the DFA to construct.
void createVariables() override
Creates all needed variables for the method.
CVC4::ExprManager m_exprManager
This must be used to create new variables, constants and expressions.
const std::set< std::string > m_Sp
The set of words to accept .
CVC4::SmtEngine m_SMTEngine
This computes acceptable values for the variables and allows to retrieve them.