15#ifndef MCRL2_DATA_CONSISTENCY_H
16#define MCRL2_DATA_CONSISTENCY_H
18#include "mcrl2/data/bool.h"
19#include "mcrl2/data/exists.h"
20#include "mcrl2/data/forall.h"
78 return is_equal_to_application(x);
86 return is_not_equal_to_application(x);
aterm_string()=default
Default constructor.
basic_sort & operator=(basic_sort &&) noexcept=default
data_expression()
\brief Default constructor X3.
data_expression & operator=(data_expression &&) noexcept=default
sort_expression sort() const
Returns the sort of the data expression.
void add_mapping(const function_symbol &f)
Adds a mapping to this specification.
void add_equation(const data_equation &e)
Adds an equation to this specification.
function_symbol & operator=(function_symbol &&) noexcept=default
function_symbol()
Default constructor.
const sort_expression & sort() const
Components for generating an arbitrary element of a sort.
Rewriter that operates on data expressions.
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
const sort_expression & target_sort() const
Returns the target sort of this expression.
sort_expression()
\brief Default constructor X3.
void add_sort(const basic_sort &s)
Adds a sort to this specification.
const sort_expression & sort() const
Fresh variable generator for the arguments of a function symbol.
data::set_identifier_generator & m_identifier_generator
std::map< data::sort_expression, data::variable_vector > m_variables
data::variable_vector arguments(const data::function_symbol &f)
Generate argument variables for f.
data_equation_argument_generator(data::set_identifier_generator &identifier_generator)
Algorithm class for algorithms on linear process specifications. It can be instantiated with lps::spe...
Class for unfolding expressions f(a1,...,an) based on the pattern-matching rewrite rules that define ...
std::map< data::function_symbol, bool > m_is_pattern_matching
bool matches_only_known_sorts(const data::function_symbol &f)
Determines whether f pattern matches on argument arg.
bool is_det_or_pi(const data::application &expr) const
Checks whether expr is of the shape Det(h(a1,...,an)) or pi(h(a1,...,an)), where h is defined by patt...
data::data_equation_vector find_equations(const data::function_symbol &f)
Finds all rewriting equations for f.
void operator()(T &result, const data::application &x)
Unfolds expr if it is of the shape h(a1,...,an) and h is defined by pattern matching.
pattern_match_unfolder(unfold_data_manager &datamgr)
data::data_expression unfolded_expr(const data::function_symbol &f, const data::data_expression_vector &args)
bool is_pattern_matching(const data::function_symbol &f)
Checks whether f is defined by pattern matching.
bool is_constructor(const data::function_symbol &f)
data::representative_generator m_repgen
std::vector< std::size_t > pattern_matching_args(const data::function_symbol &f)
std::map< data::function_symbol, data::data_equation > m_new_eqns
bool can_unfold(const data::data_expression &x)
unfold_data_manager & m_datamgr
void add_used_identifier(const core::identifier_string &id)
data::data_specification & m_dataspec
bool m_possibly_inconsistent
Boolean indicating whether rewrite rules may be added that could make the data specification inconsis...
mcrl2::data::set_identifier_generator m_identifier_generator
set of identifiers to use during fresh variable generation
void create_determine_function(const data::sort_expression &sort)
Creates the determine function.
void add_used_identifiers(const std::set< core::identifier_string > &ids)
bool is_constructor(const data::function_symbol &f) const
unfold_cache_element & get_cache_element(const data::sort_expression &sort)
mcrl2::core::identifier_string generate_fresh_function_symbol_name(const std::string &str)
Generates a fresh name for a constructor or mapping.
void generate_case_function_equations(const data::sort_expression &sort, const data::function_symbol &case_function)
Create the data equations for case functions.
const data::data_specification & dataspec() const
data::set_identifier_generator & id_gen()
void generate_determine_function_equations(const data::sort_expression &sort)
Create the data equations for the determine function.
void generate_projection_function_equations(const data::sort_expression &sort)
Create the data equations for the projection functions.
void create_new_constructors(const data::sort_expression &sort)
Creates a set of constructors for the fresh basic sort.
std::map< mcrl2::data::sort_expression, unfold_cache_element > & m_cache
cache for previously unfolded sorts. facilitates reuse of previously introduced sorts and function sy...
std::string filter_illegal_characters(std::string in) const
mcrl2::data::variable generate_fresh_variable(std::string str, const data::sort_expression &sort)
Generates variable of type sort based on a given string str.
mcrl2::data::representative_generator m_representative_generator
a generator for default data expressions of a given sort;
mcrl2::data::basic_sort generate_fresh_basic_sort(const data::sort_expression &sort)
Generates a fresh basic sort given a sort expression.
const data::function_symbol_vector & get_projection_funcs(const data::function_symbol &f)
void create_distribution_law_over_case(const data::sort_expression &sort, const data::function_symbol &function_for_distribution, data::function_symbol case_function)
Create distribution rules for distribution_functions over case_functions.
data::function_symbol create_case_function(const data::sort_expression &det_sort, const data::sort_expression &output_sort)
Creates the case function with number of arguments determined by the number of affected constructors,...
data::data_expression create_cases(const data::data_expression &target, const data::data_expression_vector &rhss)
unfold_data_manager(std::map< mcrl2::data::sort_expression, unfold_cache_element > &cache, data::data_specification &dataspec, bool possibly_inconsistent)
static bool char_filter(char c)
detail::data_equation_argument_generator m_data_equation_argument_generator
generator for arguments in left hand side of data equations
bool is_cached(const data::sort_expression &sort) const
const std::vector< data::function_symbol > & get_constructors(const data::sort_expression &sort)
void create_projection_functions(const data::sort_expression &sort)
Creates projection functions for the unfolded process parameter.
void determine_affected_constructors(const data::sort_expression &sort)
Determines the constructors that are affected with the unfold process parameter.
std::map< mcrl2::data::variable, mcrl2::data::data_expression > parameter_substitution()
substitute function for replacing process parameters with unfolded process parameters functions.
void update_linear_process(std::size_t parameter_at_index)
substitute unfold process parameter in the linear process
void update_linear_process_initialization(std::size_t parameter_at_index)
substitute unfold process parameter in the initialization of the linear process
detail::pattern_match_unfolder m_pattern_unfolder
bool m_alt_case_placement
Boolean to indicate if alternative placement of case functions should be used.
mcrl2::data::variable process_parameter_at(std::size_t index)
Get the process parameter at given index.
lpsparunfold(lps::stochastic_specification &spec, std::map< data::sort_expression, unfold_cache_element > &cache, bool alt_case_placement=false, bool possibly_inconsistent=false, bool unfold_pattern_matching=true)
Constructor for lpsparunfold algorithm.
case_func_replacement parameter_case_function()
bool m_run_before
set to true when the algorithm has been run once; as the algorithm should run only once....
bool m_unfold_pattern_matching
Indicates whether functions defined by pattern matching that occur in the scope of a Det or pi in a s...
mcrl2::data::data_expression_vector unfold_constructor(const mcrl2::data::data_expression &de)
unfolds a data expression into a vector of process parameters
void unfold_summands(mcrl2::lps::stochastic_action_summand_vector &summands)
detail::unfold_data_manager m_datamgr
Bookkeeper for recogniser and projection functions.
data::data_expression apply_function(const data::function_symbol &f, const data::data_expression &de) const
mcrl2::data::variable m_unfold_parameter
The process parameter that needs to be unfold.
void algorithm(std::size_t parameter_at_index)
Applies lpsparunfold algorithm on a process parameter of an mCRL2 process specification .
mcrl2::data::variable_vector m_injected_parameters
The process parameters that are inserted.
Linear process specification.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
function_symbol get_top_fs(const data_expression &expr)
Get the top level function symbol f if expr is of the shape f or f(t1,...,tn)
Namespace for system defined sort bool_.
bool is_false_function_symbol(const atermpp::aterm &e)
Recogniser for function false.
bool is_or_application(const atermpp::aterm &e)
Recogniser for application of ||.
bool is_bool(const sort_expression &e)
Recogniser for sort expression Bool.
const basic_sort & bool_()
Constructor for sort expression Bool.
bool is_implies_application(const atermpp::aterm &e)
Recogniser for application of =>.
application not_(const data_expression &arg0)
Application of function symbol !.
application and_(const data_expression &arg0, const data_expression &arg1)
Application of function symbol &&.
application implies(const data_expression &arg0, const data_expression &arg1)
Application of function symbol =>.
application or_(const data_expression &arg0, const data_expression &arg1)
Application of function symbol ||.
const function_symbol & false_()
Constructor for function symbol false.
bool is_and_application(const atermpp::aterm &e)
Recogniser for application of &&.
bool is_true_function_symbol(const atermpp::aterm &e)
Recogniser for function true.
bool is_not_application(const atermpp::aterm &e)
Recogniser for application of !.
const function_symbol & true_()
Constructor for function symbol true.
data_expression not_(const data_expression &x)
bool is_application(const data_expression &t)
Returns true if the term t is an application.
bool is_or(const data_expression &x)
Test if x is a disjunction.
bool is_false(const data_expression &x)
Test if x is false.
data_expression make_exists_(const data::variable_list &v, const data_expression &x)
Make an existential quantification. It checks for an empty variable list, which is not allowed.
data_expression make_forall_(const data::variable_list &v, const data_expression &x)
Make a universal quantification. It checks for an empty variable list, which is not allowed.
data_expression or_(const data_expression &x, const data_expression &y)
bool is_not(const data_expression &x)
Test if x is a negation.
data_expression and_(const data_expression &x, const data_expression &y)
const data_expression & false_()
bool is_true(const data_expression &x)
Test if x is true.
bool is_not_equal_to(const data_expression &x)
Test if x is an inequality.
const data_expression & true_()
bool is_imp(const data_expression &x)
Test if x is an implication.
bool is_container_sort(const atermpp::aterm &x)
Returns true if the term t is a container sort.
bool is_equal_to(const data_expression &x)
Test if x is an equality.
bool is_basic_sort(const atermpp::aterm &x)
Returns true if the term t is a basic sort.
data_expression imp(const data_expression &x, const data_expression &y)
bool is_function_sort(const atermpp::aterm &x)
Returns true if the term t is a function sort.
bool is_bool(const sort_expression &x)
function_symbol if_(const sort_expression &s)
Constructor for function symbol if.
bool is_and(const data_expression &x)
Test if x is a conjunction.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
data::data_expression unfold_pattern_matching(const data::data_expression &x, pattern_match_unfolder &unfolder)
The main namespace for the LPS library.
parunfold_replacement< Builder, Binder > apply_parunfold_replacement_builder(const lpsparunfold::case_func_replacement &case_funcs, data::set_identifier_generator &id_generator)
static constexpr std::size_t max_unfold_depth
Maximum number of times an expression is unfolded before recursion stops; unfolding this often is eno...
void apply(T &result, const data::application &x)
pattern_match_unfolder & m_unfolder
bool is_applied_to_constructor(const data::application &x)
std::size_t m_current_depth
replace_pattern_match_builder(pattern_match_unfolder &unfolder)
bool m_currently_recursing
data::data_expression current_replacement
data::detail::capture_avoiding_substitution_updater< parunfold_replacement< Builder, Binder > > sigma1
data::data_expression operator()(const data::variable &x)
parunfold_replacement(const lpsparunfold::case_func_replacement &case_funcs, data::set_identifier_generator &id_generator)
void apply(T &result, const data::application &x)
void apply_case_function(data::data_expression &result, const data::application &expr)
lpsparunfold::case_func_replacement case_funcs
Element in the cache that keeps track of the information for a single unfolded sort,...
std::map< mcrl2::data::sort_expression, mcrl2::data::function_symbol > case_functions
mcrl2::data::basic_sort fresh_basic_sort
mcrl2::data::function_symbol_vector affected_constructors
mcrl2::data::function_symbol determine_function
mcrl2::data::function_symbol_vector projection_functions
mcrl2::data::function_symbol_vector new_constructors
mcrl2::core::identifier_string case_function_name