14#ifndef MCRL2_LPS_INVARIANT_CHECKER_H
15#define MCRL2_LPS_INVARIANT_CHECKER_H
71template <
typename Specification>
98 const Specification& a_lps,
100 int a_time_limit = 0,
101 bool a_path_eliminator =
false,
103 bool a_apply_induction =
false,
104 bool a_counter_example =
false,
105 bool a_all_violations =
false,
106 const std::string& a_dot_file_name = std::string()
116template <
typename Specification>
119 if (f_counter_example)
122 assert(v_counter_example.
defined());
129template <
typename Specification>
132 if (!f_dot_file_name.empty())
134 std::string v_file_name=f_dot_file_name;
136 if (a_summand_number == (std::size_t)-1)
138 v_file_name +=
"-init.dot";
142 v_file_name +=
"-" + std::to_string(a_summand_number) +
".dot";
150template <
typename Specification>
158 for (; di != d.
end(); ++di, ++ei)
160 v_substitutions[*di] = *ei;
173 print_counter_example();
174 save_dot_file((std::size_t)(-1));
182template <
typename Specification>
186 const std::size_t a_summand_number)
188 using namespace data::sort_bool;
195 v_substitutions[a.lhs()] = a.rhs();
204 mCRL2log(
log::verbose) <<
"The invariant holds for summand " << a_summand_number <<
"." << std::endl;
209 mCRL2log(
log::info) <<
"The invariant does not hold for summand " << a_summand_number << std::endl;
212 print_counter_example();
213 save_dot_file(a_summand_number);
221template <
typename Specification>
224 bool v_result =
true;
225 std::size_t v_summand_number = 1;
227 for (
auto i = f_summands.begin(); i != f_summands.end() && (f_all_violations || v_result); ++i)
229 v_result = check_summand(a_invariant, *i, v_summand_number) && v_result;
237template <
typename Specification>
239 const Specification& a_lps,
241 bool a_apply_induction,
bool a_counter_example,
bool a_all_violations, std::string
const& a_dot_file_name
244 f_bdd_prover(a_lps.data(), data::
used_data_equation_selector(a_lps.data()), a_rewrite_strategy, a_time_limit, a_path_eliminator, a_solver_type, a_apply_induction)
246 f_init = a_lps.initial_process();
247 f_summands = a_lps.process().action_summands();
255template <
typename Specification>
258 bool v_result =
true;
260 if (check_init(a_invariant))
266 mCRL2log(
log::info) <<
"The invariant does not hold for the initial state." << std::endl;
269 if ((f_all_violations || v_result))
271 if (check_summands(a_invariant))
277 mCRL2log(
log::info) <<
"The invariant does not hold for all summands." << std::endl;
const_iterator end() const
Returns a const_iterator pointing to the end of the term_list.
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the term_list.
bool defined() const
Returns true if this term is not equal to the term assigned by the default constructor of aterms,...
\brief Assignment of a data expression to a variable
rewrite_strategy strategy
The rewrite strategies of the rewriter.
The class BDD2Dot offers the ability to write binary decision diagrams to dot files....
void output_bdd(const data_expression &a_bdd, const std::string &a_file_name)
Writes the BDD it receives as input to a file.
void set_formula(const data_expression &formula)
Sets Prover::f_formula to formula. precondition: the argument passed as parameter formula is an expre...
data_expression get_counter_example()
Returns all the guards on a path in the BDD that leads to a leaf labelled "false",...
Answer is_contradiction()
Indicates whether or not the formula Prover::f_formula is a contradiction.
data_expression get_bdd()
Returns the BDD BDD_Prover::f_bdd.
Answer is_tautology()
Indicates whether or not the formula Prover::f_formula is a tautology.
Generic substitution function. The substitution is stored as a mapping of variables to expressions....
Component for selecting a subset of equations that are actually used in an encompassing specification...
void save_dot_file(std::size_t a_summand_number)
process_type::action_summand_type action_summand_type
bool check_summand(const data::data_expression &a_invariant, const action_summand_type &a_summand, const std::size_t a_summand_number)
action_summand_vector_type f_summands
bool check_summands(const data::data_expression &a_invariant)
const Specification & f_spec
data::detail::BDD2Dot f_bdd2dot
bool check_init(const data::data_expression &a_invariant)
Specification::process_type process_type
Invariant_Checker(const Specification &a_lps, data::rewriter::strategy a_rewrite_strategy=data::jitty, int a_time_limit=0, bool a_path_eliminator=false, data::detail::smt_solver_type a_solver_type=data::detail::solver_type_cvc, bool a_apply_induction=false, bool a_counter_example=false, bool a_all_violations=false, const std::string &a_dot_file_name=std::string())
data::detail::BDD_Prover f_bdd_prover
void print_counter_example()
std::string f_dot_file_name
std::vector< action_summand_type > action_summand_vector_type
bool check_invariant(const data::data_expression &a_invariant)
precondition: the argument passed as parameter a_invariant is a valid expression in internal mCRL2 fo...
process_initializer f_init
data::data_expression_list expressions() const
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
smt_solver_type
The enumeration type smt_solver_type enumerates all available SMT solvers.
data_expression and_(const data_expression &x, const data_expression &y)
std::string pp(const abstraction &x)
void replace_variables_capture_avoiding(T &x, Substitution &sigma, data::set_identifier_generator &id_generator, typename std::enable_if<!std::is_base_of< atermpp::aterm, T >::value >::type *=nullptr)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...