12#ifndef MCRL2_PBES_GAUSS_ELIMINATION_ALGORITHM_H
13#define MCRL2_PBES_GAUSS_ELIMINATION_ALGORITHM_H
15#include "mcrl2/pbes/replace.h"
23template <
typename ExpressionTraits>
27 using expression_type =
typename ExpressionTraits::expression_type;
28 using variable_type =
typename ExpressionTraits::variable_type;
29 using equation_type =
typename ExpressionTraits::equation_type;
35 return ExpressionTraits::print(eq);
38 template <
typename Iter>
41 std::ostringstream out;
42 for (Iter i = first; i != last; ++i)
44 out <<
" " << print_equation(*i) << std::endl;
55 template <
typename Iter,
typename FixpointEquationSolver>
56 void run(Iter first, Iter last, FixpointEquationSolver solve)
58 mCRL2log(log::debug) <<
"equations before solving\n" << print_equations(first, last);
68 mCRL2log(log::verbose) <<
"solving equation\n before: " << print_equation(*i);
70 mCRL2log(log::verbose) <<
" after: " << print_equation(*i) <<
"\n";
71 for (Iter j = first; j != i; ++j)
73 j->formula() = ExpressionTraits::substitute(j->formula(), i->variable(), i->formula());
75 mCRL2log(log::trace) <<
"equations after substitution\n" << print_equations(first, last);
77 mCRL2log(log::debug) <<
"equations after solving\n" << print_equations(first, last);
83template <
typename BooleanExpressionTraits,
typename Compare>
93 void operator()(
typename BooleanExpressionTraits::equation_type& eq)
const
95 using tr = BooleanExpressionTraits;
96 using expression_type =
typename BooleanExpressionTraits::expression_type;
97 using variable_type =
typename BooleanExpressionTraits::variable_type;
99 const expression_type& phi = eq.formula();
100 const variable_type& X = eq.variable();
101 expression_type next = eq.symbol() == tr::nu() ? tr::true_() : tr::false_();
102 expression_type prev;
106 next = tr::substitute(phi, X, prev);
Algorithm class for the Gauss elimination algorithm for solving systems of (P)BES equations.
void run(Iter first, Iter last, FixpointEquationSolver solve)
Runs the algorithm. Applies Gauss elimination to the sequence of pbes equations [first,...
std::string print_equation(const equation_type &eq) const
std::string print_equations(Iter first, Iter last) const
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
void operator()(typename BooleanExpressionTraits::equation_type &eq) const
approximate(Compare compare)