mCRL2
Loading...
Searching...
No Matches
replace_constants_by_variables.h
Go to the documentation of this file.
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/replace_constants_by_variables.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_PBES_REPLACE_CONSTANTS_BY_VARIABLES_H
13#define MCRL2_PBES_REPLACE_CONSTANTS_BY_VARIABLES_H
14
15#include "mcrl2/data/replace_constants_by_variables.h"
16#include "mcrl2/pbes/builder.h"
17
18namespace mcrl2::pbes_system {
19
20namespace detail {
21
23{
25 using super::apply;
26 using super::update;
27
28 replace_constants_by_variables_builder(const data::rewriter& r, data::mutable_indexed_substitution<>& sigma)
29 : super(r, sigma)
30 {}
31};
32
33} // namespace detail
34
35/// \brief Replace each constant data application c in x by a fresh variable v, and add extend the substitution sigma
36/// with the assignment v := r(c). This can be used in rewriting, to avoid that c is rewritten by the rewriter
37/// multiple times.
38template <typename T>
39 requires(!std::is_base_of_v<atermpp::aterm, T>)
41 const data::rewriter& r,
43{
45 f.update(x);
46}
47
48/// \brief Replace each constant data application c in x by a fresh variable v, and add extend the substitution sigma
49/// with the assignment v := r(c). This can be used in rewriting, to avoid that c is rewritten by the rewriter
50/// multiple times.
51template <typename T>
52 requires(std::is_base_of_v<atermpp::aterm, T>)
54 const data::rewriter& r,
56{
57 T result;
59 f.apply(result, x);
60 return result;
61}
62
63} // namespace mcrl2::pbes_system
64
65
66
67#endif // MCRL2_PBES_REPLACE_CONSTANTS_BY_VARIABLES_H
Rewriter that operates on data expressions.
Definition rewriter.h:84
replace_constants_by_variables_builder(const data::rewriter &r, data::mutable_indexed_substitution<> &sigma)