mCRL2
Loading...
Searching...
No Matches
invelm_algorithm.h
Go to the documentation of this file.
1// Author(s): Luc Engelen, Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
11
12#ifndef MCRL2_LPS_INVELM_ALGORITHM_H
13#define MCRL2_LPS_INVELM_ALGORITHM_H
14
15#include "mcrl2/data/parse.h"
18
19namespace mcrl2
20{
21
22namespace lps
23{
24
74
75template <class Specification>
76class invelm_algorithm: public detail::lps_algorithm<Specification>
77{
79 typedef typename Specification::process_type process_type;
80 typedef typename process_type::action_summand_type action_summand_type;
81 using super::m_spec;
82
83 private:
86
91 void simplify_summand(summand_base& s, const data::data_expression& invariant, bool apply_prover)
92 {
93 data::data_expression new_condition = data::lazy::and_(invariant, s.condition());
94
95 if (apply_prover)
96 {
97 f_bdd_prover.set_formula(new_condition);
98 new_condition = f_bdd_prover.get_bdd();
99 }
101 {
102 s.condition() = new_condition;
103 }
104 }
105
106 template <typename SummandSequence>
107 void simplify_summands(SummandSequence& summands, const data::data_expression& invariant, bool apply_prover)
108 {
109 for (summand_base& s: summands)
110 {
111 simplify_summand(s, invariant, apply_prover);
112 }
113 }
114
115 public:
120 Specification& a_lps,
121 const data::rewriter::strategy a_rewrite_strategy = data::jitty,
122 const int a_time_limit = 0,
123 const bool a_path_eliminator = false,
125 const bool a_apply_induction = false,
126 const bool a_simplify_all = false
127 )
128 : detail::lps_algorithm<Specification>(a_lps),
129 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),
130 f_simplify_all(a_simplify_all)
131 {}
132
133 void run(const data::data_expression& invariant, bool apply_prover)
134 {
135 simplify_summands(m_spec.process().action_summands(), invariant, apply_prover);
136 simplify_summands(m_spec.process().deadlock_summands(), invariant, apply_prover);
138 }
139};
140
141} // namespace lps
142
143} // namespace mcrl2
144
145#endif // MCRL2_LPS_INVELM_ALGORITHM_H
void set_formula(const data_expression &formula)
Sets Prover::f_formula to formula. precondition: the argument passed as parameter formula is an expre...
Definition bdd_prover.h:628
data_expression get_bdd()
Returns the BDD BDD_Prover::f_bdd.
Definition bdd_prover.h:552
Algorithm class for algorithms on linear process specifications. It can be instantiated with lps::spe...
void remove_trivial_summands()
Removes summands with condition equal to false.
lps_algorithm(Specification &spec)
Constructor.
Specification & m_spec
The specification that is processed by the algorithm.
invelm_algorithm(Specification &a_lps, const data::rewriter::strategy a_rewrite_strategy=data::jitty, const int a_time_limit=0, const bool a_path_eliminator=false, const data::detail::smt_solver_type a_solver_type=data::detail::solver_type_cvc, const bool a_apply_induction=false, const bool a_simplify_all=false)
detail::lps_algorithm< Specification > super
void simplify_summands(SummandSequence &summands, const data::data_expression &invariant, bool apply_prover)
void run(const data::data_expression &invariant, bool apply_prover)
void simplify_summand(summand_base &s, const data::data_expression &invariant, bool apply_prover)
Adds an invariant to the condition of the summand s, and optionally applies the prover to it.
process_type::action_summand_type action_summand_type
data::detail::BDD_Prover f_bdd_prover
Specification::process_type process_type
Base class for LPS summands.
Definition summand.h:25
const data::data_expression & condition() const
Returns the condition expression.
Definition summand.h:60
Parser for data specifications.
Add your file description here.
smt_solver_type
The enumeration type smt_solver_type enumerates all available SMT solvers.
Definition solver_type.h:27
data_expression and_(data_expression const &p, data_expression const &q)
Returns an expression equivalent to p or q.
bool is_false_function_symbol(const atermpp::aterm &e)
Recogniser for function false.
Definition bool.h:119
rewrite_strategy
The strategy of the rewriter.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72