10#ifndef MCRL2_DATA_DETAIL_REWRITE_JITTY_H
11#define MCRL2_DATA_DETAIL_REWRITE_JITTY_H
13#include "mcrl2/data/detail/rewrite.h"
14#include "mcrl2/data/detail/rewrite/rewrite_stack.h"
15#include "mcrl2/data/detail/rewrite/strategy_rule.h"
69 std::shared_ptr<
detail::
Rewriter>
clone()
override {
return std::shared_ptr<Rewriter>(
new RewriterJitty(*
this)); }
93 template<
class ITERATOR>
96 std::function<
void(data_expression&,
const data_expression&)> rewrite_cpp_code,
99 substitution_type& sigma);
105 const application& term,
106 substitution_type& sigma,
107 std::size_t do_not_rewrite_first_arguments = 0);
112 substitution_type& sigma);
std::stack< std::reference_wrapper< _aterm > > m_todo
A reusable todo stack.
A unordered_map class in which aterms can be stored.
An abstraction expression.
const variable_list & variables() const
abstraction(const binder_type &binding_operator, const variable_list &variables, const data_expression &body)
Constructor.
const data_expression & body() const
const binder_type & binding_operator() const
data_expression & operator=(const data_expression &) noexcept=default
bool is_default_data_expression() const
A function to efficiently determine whether a data expression is made by the default constructor.
strategy create_a_rewriting_based_strategy(const function_symbol &f, const data_equation_list &rules1)
strategy create_a_cpp_function_based_strategy(const function_symbol &f, const data_specification &data_spec)
class rewrite_stack m_rewrite_stack
void apply_cpp_code_to_higher_order_term(data_expression &result, const application &t, std::function< void(data_expression &, const data_expression &)> rewrite_cpp_code, ITERATOR begin, ITERATOR end, substitution_type &sigma)
void rewrite_aux_const_function_symbol(data_expression &result, const function_symbol &op, substitution_type &sigma)
void thread_initialise() override
rewrite_strategy getStrategy() override
Get rewriter strategy that is used.
RewriterJitty(const data_specification &data_spec, const used_data_equation_selector &)
void rewrite_aux(data_expression &result, const data_expression &term, substitution_type &sigma)
Rewrite a term with a given substitution and put the rewritten term in result.
RewriterJitty(const RewriterJitty &other)=default
void add_normal_form_function(data_expression &t)
strategy create_strategy(const function_symbol &f, const data_equation_list &rules1, const data_specification &data_spec)
data_expression rewrite(const data_expression &term, substitution_type &sigma) override
Rewrite an mCRL2 data term.
void apply_cpp_code_to_higher_order_term(data_expression &result, const application &t, const std::function< void(data_expression &, const data_expression &)> rewrite_cpp_code, ITERATOR begin, ITERATOR end, substitution_type &sigma)
const function_symbol & this_term_is_in_normal_form()
void subst_values(data_expression &result, const jitty_assignments_for_a_rewrite_rule &assignments, const data_expression &t, data::enumerator_identifier_generator &generator)
RewriterJitty & operator=(const RewriterJitty &other)=delete
data_expression remove_normal_form_function(const data_expression &t)
atermpp::detail::thread_aterm_pool * m_thread_aterm_pool
void rebuild_strategy(const data_specification &data_spec, const mcrl2::data::used_data_equation_selector &equation_selector)
void rewrite_aux_function_symbol(data_expression &result, const function_symbol &op, const application &term, substitution_type &sigma, std::size_t do_not_rewrite_first_arguments=0)
std::vector< strategy > jitty_strat
void rewrite(data_expression &result, const data_expression &term, substitution_type &sigma) override
Rewrite an mCRL2 data term.
std::map< function_symbol, data_equation_list > jitty_eqns
bool rewriting_in_progress
void make_jitty_strat_sufficiently_larger(std::size_t i)
Auxiliary function to take care that the array jitty_strat is sufficiently large to access element i.
std::shared_ptr< detail::Rewriter > clone() override
Clone a rewriter.
function_symbol this_term_is_in_normal_form_symbol
~RewriterJitty() override
std::vector< data_expression > rhs_for_constants_cache
Rewriter interface class.
Rewriter(const data_specification &data_spec, const used_data_equation_selector &eq_selector)
Constructor. Do not use directly; use createRewriter() function instead.
std::set< std::size_t > m_dependencies
const std::set< std::size_t > & dependencies() const
dependencies_rewrite_rule_pair(std::set< std::size_t > &dependencies, const data_equation &eq)
data_equation equation() const
mutable_indexed_substitution & m_sigma
jitty_argument_rewriter(mutable_indexed_substitution<> &sigma, RewriterJitty &r)
void operator()(data_expression &result, const data_expression &t)
A strategy is a list of rules and the number of variables that occur in it.
const sort_expression & codomain() const
const sort_expression & sort() const
Component for selecting a subset of equations that are actually used in an encompassing specification...
\brief A where expression
const data_expression & body() const
const assignment_expression_list & declarations() const
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
thread_aterm_pool & g_thread_term_pool()
A reference to the thread local term pool storage.
The main namespace for the aterm++ library.
data_expression remove_normal_form_function(const data_expression &t)
removes auxiliary expressions this_term_is_in_normal_form from data_expressions that are being rewrit...
static bool match_jitty(const data_expression &t, const data_expression &p, jitty_assignments_for_a_rewrite_rule &assignments, const bool term_context_guarantees_normal_form)
std::set< variable > bound_variables_in_substitution(const jitty_assignments_for_a_rewrite_rule &assignments)
const data_expression & get_nested_head(const data_expression &t)
bool is_application(const data_expression &t)
Returns true if the term t is an application.
bool is_where_clause(const atermpp::aterm &x)
Returns true if the term t is a where clause.
bool is_abstraction(const atermpp::aterm &x)
Returns true if the term t is an abstraction.
bool is_exists_binder(const atermpp::aterm &x)
bool is_lambda_binder(const atermpp::aterm &x)
bool is_forall(const atermpp::aterm &x)
Returns true if the term t is a universal quantification.
bool is_function_symbol(const atermpp::aterm &x)
Returns true if the term t is a function symbol.
bool is_exists(const atermpp::aterm &x)
Returns true if the term t is an existential quantification.
bool is_function_sort(const atermpp::aterm &x)
Returns true if the term t is a function sort.
bool is_machine_number(const atermpp::aterm &x)
Returns true if the term t is a machine_number.
bool is_lambda(const atermpp::aterm &x)
Returns true if the term t is a lambda abstraction.
bool is_forall_binder(const atermpp::aterm &x)
bool is_variable(const atermpp::aterm &x)
Returns true if the term t is a variable.
jitty_variable_assignment_for_a_rewrite_rule * assignment
jitty_assignments_for_a_rewrite_rule(jitty_variable_assignment_for_a_rewrite_rule *a)
jitty_variable_assignment_for_a_rewrite_rule(const variable &m_var, const data_expression &m_term, bool m_nf)
bool variable_is_a_normal_form
const data_expression & term