Line data Source code
1 : // Author(s): 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 : // 9 : /// \file mcrl2/pbes/rewriters/pfnf_rewriter.h 10 : /// \brief add your file description here. 11 : 12 : #ifndef MCRL2_PBES_REWRITERS_PFNF_REWRITER_H 13 : #define MCRL2_PBES_REWRITERS_PFNF_REWRITER_H 14 : 15 : #include "mcrl2/pbes/detail/pfnf_traverser.h" 16 : 17 : namespace mcrl2 { 18 : 19 : namespace pbes_system { 20 : 21 : /// \brief A rewriter that brings PBES expressions into PFNF normal form. 22 : class pfnf_rewriter 23 : { 24 : public: 25 : /// \brief The term type 26 : typedef pbes_expression term_type; 27 : 28 : /// \brief The variable type 29 : typedef data::variable variable_type; 30 : 31 : /// \brief Rewrites a pbes expression. 32 : /// \param x A term 33 : /// \return The rewrite result. 34 17 : pbes_expression operator()(const pbes_expression& x) const 35 : { 36 17 : pbes_system::detail::pfnf_traverser visitor; 37 17 : visitor.apply(x); 38 34 : return visitor.evaluate(); 39 17 : } 40 : 41 : /// \brief Rewrites a pbes expression. 42 : /// \param x A term 43 : /// \param sigma A substitution function 44 : /// \return The rewrite result. 45 : template <typename SubstitutionFunction> 46 : pbes_expression operator()(const pbes_expression& x, SubstitutionFunction sigma) const 47 : { 48 : return sigma(this->operator()(x)); 49 : } 50 : }; 51 : 52 : } // namespace pbes_system 53 : 54 : } // namespace mcrl2 55 : 56 : #endif // MCRL2_PBES_REWRITERS_PFNF_REWRITER_H