12#ifndef MCRL2_PBES_ABSINTHE_H
13#define MCRL2_PBES_ABSINTHE_H
15#define MCRL2_ABSINTHE_CHECK_EXPRESSIONS
22#ifdef MCRL2_ABSINTHE_CHECK_EXPRESSIONS
28namespace pbes_system {
30 template <
typename Term>
36 template <
typename Term>
51#ifdef MCRL2_ABSINTHE_CHECK_EXPRESSIONS
69 if (f.
sort() != a.name())
76 const auto& ss = atermpp::down_cast<data::structured_sort>(s);
79 if (f.
name() == g.name())
109 const auto& fs = atermpp::down_cast<data::function_sort>(s);
110 return fs.codomain();
259 :
f(sigmaH, sigmaS, sigmaF, generator)
278 std::vector<data::variable> result;
280 for (
auto j = x.
begin(); j != x.
end(); ++i, ++j)
325 bool is_over_approximation)
355 for (; i != e.
end(); ++i, ++j)
413 if (words.size() == 2)
426 std::string dataspec_text =
data::pp(dataspec);
430 if (words.size() == 2)
444 std::string dataspec_text =
data::pp(dataspec);
449 if (words.size() == 2)
452 std::string s = words[1];
468 const auto& f = atermpp::down_cast<data::function_sort>(i.sort());
469 if (f.domain().size() != 1)
473 result[f.domain().front()] = i;
553 std::string name = std::string(f.
name());
561 name =
"Generated_" + name;
596 using namespace data;
599 const sort_expression &s = f.
sort();
600 if (is_basic_sort(s))
602 return function_symbol(name,
make_set()(s));
604 else if (is_function_sort(s))
606 const auto& fs = atermpp::down_cast<data::function_sort>(s);
607 const sort_expression_list& sl = fs.domain();
608 return function_symbol(name, function_sort(sort_expression_list(sl.begin(),sl.end(),
make_set()), fs.codomain()));
610 else if (is_container_sort(s))
625 std::vector<data::variable> result;
627 for (
auto j = sorts.
begin(); j != sorts.
end(); ++i, ++j)
651 auto i = sigmaH.find(f1.
sort());
652 if (i == sigmaH.end())
675 throw std::runtime_error(
"can not generalize functions with abstraction sorts in the domain: " +
data::pp(f1) +
": " +
data::pp(s1));
686 if (i == sigmaH.end())
732 std::vector<data::variable> result;
734 for (
auto j = sorts.
begin(); j != sorts.
end(); ++i, ++j)
746 std::vector<data::data_expression> a;
749 for (; i != x.end(); ++i, ++j)
806 template <
typename Map>
809 std::ostringstream out;
810 for (
auto i = m.begin(); i != m.end(); ++i)
812 out << i->first <<
" -> " << i->second << std::endl;
819 sort_expression_substitution_map::const_iterator i = sigmaS.find(s);
820 if (i != sigmaS.end() && i->second != t)
852 for (; i1 != domain1.
end(); ++i1, ++i2)
883 for (
const auto& i: sigmaH)
893 mCRL2log(
log::debug) <<
"adding list constructor " << f1 <<
" to sigmaF" << std::endl;
900 if (!has_key(sigmaF, f1))
903 mCRL2log(
log::debug) <<
"lifted function symbol: " << f1 <<
" to " << f2 << std::endl;
914 for (
auto& i : sigmaF)
945 for (
const auto& i: v)
956 void run(
pbes& p,
const std::string& abstraction_text,
bool is_over_approximation)
959 std::string function_symbol_mapping_text;
960 std::string user_sorts_text;
961 std::string user_equations_text;
962 std::string abstraction_mapping_text;
963 std::string pbes_sorts_text;
965 std::string text = abstraction_text;
966 std::vector<std::string> all_keywords = {
"sort",
"var",
"eqn",
"map",
"cons",
"absfunc",
"absmap" };
967 std::pair<std::string, std::string> q;
970 user_sorts_text = q.first;
975 abstraction_mapping_text = q.first;
980 function_symbol_mapping_text = q.first;
981 user_equations_text = q.second;
986 pbes_sorts_text = q.first;
990 mCRL2log(
log::debug) <<
"--- user equations ---\n" << user_equations_text << std::endl;
991 mCRL2log(
log::debug) <<
"--- function mapping ---\n" << function_symbol_mapping_text << std::endl;
992 mCRL2log(
log::debug) <<
"--- abstraction mapping ---\n" << abstraction_mapping_text << std::endl;
995 if (abstraction_mapping_text.find(
"absmap") != 0)
1017 for (
auto i = sigmaH.begin(); i != sigmaH.end(); ++i)
1045 p.
data() = dataspec;
Term containing a string.
const_iterator end() const
Returns a const_iterator pointing to the end of the term_list.
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the term_list.
An application of a data expression to a number of arguments.
const_iterator end() const
Returns an iterator pointing past the last argument of the application.
const_iterator begin() const
Returns an iterator pointing to the first argument of the application.
const data_expression & head() const
Get the function at the head of this expression.
sort_expression sort() const
Returns the sort of the data expression.
const_iterator begin() const
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.
const function_symbol_vector & user_defined_mappings() const
Gets all user defined mappings in this specification.
const function_symbol_vector & constructors() const
Gets all constructors including those that are system defined.
existential quantification.
const sort_expression & codomain() const
const sort_expression_list & domain() const
const core::identifier_string & name() const
const sort_expression & sort() const
void add_identifiers(const std::set< core::identifier_string > &ids)
Add a set of identifiers to the context.
\brief Container type for lists
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
const basic_sort_vector & user_defined_sorts() const
Gets all sorts defined by a user (excluding the system defined sorts).
void add_context_sort(const sort_expression &s)
Adds the sort s to the context sorts.
const alias_vector & user_defined_aliases() const
Gets the user defined aliases.
const core::identifier_string & name() const
const sort_expression & sort() const
static void set_reporting_level(const log_level_t level)
Set reporting level.
\brief The and operator for pbes expressions
\brief The existential quantification operator for pbes expressions
const data::variable_list & variables() const
const pbes_expression & body() const
static fixpoint_symbol mu()
Returns the mu symbol.
\brief The universal quantification operator for pbes expressions
const pbes_expression & body() const
const data::variable_list & variables() const
\brief The implication operator for pbes expressions
const pbes_expression & formula() const
Returns the predicate formula on the right hand side of the equation.
const propositional_variable & variable() const
Returns the pbes variable of the equation.
parameterized boolean equation system
const data::data_specification & data() const
Returns the data specification.
const propositional_variable_instantiation & initial_state() const
Returns the initial state.
const std::vector< pbes_equation > & equations() const
Returns the equations.
\brief A propositional variable instantiation
const data::data_expression_list & parameters() const
const core::identifier_string & name() const
\brief A propositional variable declaration
Standard exception class for reporting runtime errors.
This file contains some functions that are present in all libraries except the data library....
add your file description here.
static RewriterCompilingJitty::substitution_type & sigma(RewriterCompilingJitty *this_rewriter)
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
sort_expression get_set_sort(const container_sort &x)
Returns the sort s of Set(s).
data_expression create_finite_set(const data_expression &x)
Create the finite set { x }, with x a data expression.
void print_parse_check(const sort_expression &x, const data_specification &dataspec=data_specification())
data_expression create_set_in(const data_expression &x, const data_expression &X)
Create the predicate 'x in X', with X a set.
data_expression create_set_comprehension(const variable &x, const data_expression &phi)
Create the set { x | phi }, with phi a predicate that may depend on the variable x.
data_expression join_and(ForwardTraversalIterator first, ForwardTraversalIterator last)
Returns and applied to the sequence of data expressions [first, last)
function_symbol cons_(const sort_expression &s)
Constructor for function symbol @fset_cons.
function_symbol empty(const sort_expression &s)
Constructor for function symbol {}.
container_sort set_(const sort_expression &s)
Constructor for sort expression Set(S)
bool is_structured_sort(const atermpp::aterm &x)
Returns true if the term t is a structured sort.
void find_identifiers(const T &x, OutputIterator o)
data_expression not_(const data_expression &x)
std::set< data::variable > find_all_variables(const data::data_expression &x)
sort_expression parse_sort_expression(std::istream &in, const data_specification &data_spec=detail::default_specification())
Parses and type checks a sort expression.
data_specification parse_data_specification(std::istream &in)
Parses a and type checks a data specification.
data_expression and_(const data_expression &x, const data_expression &y)
std::vector< variable > variable_vector
\brief vector of variables
const data_expression & false_()
const data_expression & true_()
std::vector< data_expression > data_expression_vector
\brief vector of data_expressions
data::function_symbol parse_function_symbol(const std::string &text, const std::string &dataspec_text="")
std::string pp(const abstraction &x)
bool is_container_sort(const atermpp::aterm &x)
Returns true if the term t is a container sort.
bool is_function_symbol(const atermpp::aterm &x)
Returns true if the term t is a function symbol.
bool is_basic_sort(const atermpp::aterm &x)
Returns true if the term t is a basic sort.
atermpp::term_list< variable > variable_list
\brief list of variables
std::set< core::identifier_string > function_and_mapping_identifiers(const data_specification &dataspec)
Returns the names of functions and mappings that occur in a data specification.
bool is_function_sort(const atermpp::aterm &x)
Returns true if the term t is a function sort.
function_symbol equal_to(const sort_expression &s)
Constructor for function symbol ==.
bool is_function_update_application(const atermpp::aterm &e)
Recogniser for application of @func_update.
std::vector< basic_sort > basic_sort_vector
vector of basic sorts
std::vector< function_symbol > function_symbol_vector
\brief vector of function_symbols
bool is_variable(const atermpp::aterm &x)
Returns true if the term t is a variable.
void absinthe_check_expression(const T &x)
data::data_specification & absinthe_data_specification()
void print_used_function_symbols(const pbes &p)
bool is_structured_sort_constructor(const data::data_specification &dataspec, const data::function_symbol &f)
data::sort_expression target_sort(const data::sort_expression &s)
pbes_expression make_exists_(const data::variable_list &l, const pbes_expression &p)
Make an existential quantification. It checks for an empty variable list, which is not allowed.
std::string print_term(const Term &x)
std::string print_symbol(const Term &x)
void find_function_symbols(const T &x, OutputIterator o)
pbes_expression make_forall_(const data::variable_list &l, const pbes_expression &p)
Make a universal quantification. It checks for an empty variable list, which is not allowed.
bool contains(const atermpp::indexed_set< Key, ThreadSafe, Hash, Equals, Allocator, KeyTable > &c, const typename atermpp::indexed_set< Key, ThreadSafe, Hash, Equals, Allocator, KeyTable >::key_type &v, const std::size_t thread_index=0)
std::pair< std::string, std::string > separate_keyword_section(const std::string &text1, const std::string &keyword, const std::vector< std::string > &all_keywords, bool repeat_keyword=false)
bool has_key(const std::map< Key, T > &c, const Key &v)
Returns the value corresponding to the given key in the set m. If the key is not present,...
void number2string(std::size_t number, std::string &buffer, std::size_t start_position)
Convert a number to a string in the buffer starting at position start_position.
std::string regex_replace(const std::string &src, const std::string &dest, const std::string &text)
Regular expression replacement in a string.
std::vector< std::string > regex_split(const std::string &text, const std::string &sep)
Split a string using a regular expression separator.
std::string trim_copy(const std::string &text)
Remove all trailing and leading spaces from the input.
std::string remove_whitespace(const std::string &text)
Removes whitespace from a string.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
add your file description here.
add your file description here.
add your file description here.
void apply(T &result, const data::data_expression &x)
const sort_expression_substitution_map & sigmaS
bool m_is_over_approximation
void update(pbes_system::pbes &x)
pbes_system::propositional_variable lift(const pbes_system::propositional_variable &x)
data::variable_list lift(const data::variable_list &x)
data::data_expression lift(const data::data_expression &x)
void update(pbes_system::pbes_equation &x)
void apply(T &result, const pbes_system::exists &x)
data::set_identifier_generator & generator
void apply(T &result, const propositional_variable_instantiation &x)
const function_symbol_substitution_map & sigmaF
pbes_expression_builder< absinthe_data_expression_builder > super
void apply(T &result, const pbes_system::forall &x)
data::data_expression_list lift(const data::data_expression_list &x)
absinthe_data_expression_builder(const abstraction_map &sigmaA_, const sort_expression_substitution_map &sigmaS_, const function_symbol_substitution_map &sigmaF_, data::set_identifier_generator &generator_, bool is_over_approximation)
const abstraction_map & sigmaH
data::variable_list make_variables(const data::data_expression_list &x, const std::string &hint, sort_function sigma) const
void apply(T &result, const data::data_expression &x)
const abstraction_map & sigmaH
const sort_expression_substitution_map & sigmaS
const function_symbol_substitution_map & sigmaF
void apply(T &result, const data::application &x)
void apply(T &result, const data::function_symbol &x)
void apply(T &result, const data::sort_expression &x)
void apply(T &result, const data::lambda &x)
sort_expression_builder< absinthe_sort_expression_builder > super
data::set_identifier_generator & generator
absinthe_sort_expression_builder(const abstraction_map &sigmaA_, const sort_expression_substitution_map &sigmaS_, const function_symbol_substitution_map &sigmaF_, data::set_identifier_generator &generator_)
data::data_equation operator()(const data::function_symbol &f1, const data::function_symbol &f2, sort_function sigma, const abstraction_map &sigmaH) const
lift_equation_1_2()=default
std::vector< data::variable > make_variables(const data::sort_expression_list &sorts, const std::string &hint, sort_function sigma) const
std::vector< data::variable > make_variables(const data::sort_expression_list &sorts, const std::string &hint, sort_function sigma) const
lift_equation_2_3()=default
data::data_expression enumerate_domain(const std::vector< data::variable > &x, const std::vector< data::variable > &X) const
data::data_equation operator()(const data::function_symbol &f2, const data::function_symbol &f3, sort_function sigma) const
std::string print_cleaned(const data::sort_expression &s) const
lift_function_symbol_1_2()
std::set< std::string > suffix_with_sort
std::map< std::string, std::string > unprintable
data::function_symbol operator()(const data::function_symbol &f, sort_function sigma) const
data::function_symbol operator()(const data::function_symbol &f) const
data::data_expression operator()(const data::data_expression &x) const
data::sort_expression operator()(const data::sort_expression &s) const
data::sort_expression operator()(const data::sort_expression &x)
absinthe_sort_expression_builder f
sort_function(const abstraction_map &sigmaH, const sort_expression_substitution_map &sigmaS, const function_symbol_substitution_map &sigmaF, data::set_identifier_generator &generator)
sort_expression_substitution_map parse_sort_expression_mapping(const std::string &text, const data::data_specification &dataspec)
void print_fsvec(const data::function_symbol_vector &v, const std::string &msg) const
void run(pbes &p, const std::string &abstraction_text, bool is_over_approximation)
void parse_right_hand_sides(const std::string &text, data::data_specification &dataspec)
void check_consistency(const data::sort_expression &s, const data::sort_expression &t, const data::function_symbol &f, sort_expression_substitution_map &sigmaS) const
void lift_data_specification(const pbes &p, const abstraction_map &sigmaH, const sort_expression_substitution_map &sigmaS, function_symbol_substitution_map &sigmaF, data::data_specification &dataspec)
std::map< data::function_symbol, data::function_symbol > function_symbol_substitution_map
function_symbol_substitution_map parse_function_symbol_mapping(const std::string &text, const data::data_specification &dataspec)
std::map< data::sort_expression, data::function_symbol > abstraction_map
data::set_identifier_generator m_generator
std::map< data::sort_expression, data::sort_expression > sort_expression_substitution_map
void print_fsmap(const function_symbol_substitution_map &v, const std::string &msg) const
void check_consistency(const data::function_symbol &f1, const data::function_symbol &f2, sort_expression_substitution_map &sigmaS) const
abstraction_map parse_abstraction_map(const std::string &text)
std::string print_mapping(const Map &m)
void update(pbes_system::pbes_equation &x)
void apply(T &result, const pbes_system::propositional_variable_instantiation &x)
void apply(T &result, const pbes_system::propositional_variable &x)