12#ifndef MCRL2_DATA_TYPE_CHECKER_H
13#define MCRL2_DATA_TYPE_CHECKER_H
27 return isdigit(c) && c >
'0';
42template <
typename Function,
typename T>
58 const container_sort& cs = atermpp::down_cast<const container_sort>(x);
63 const function_sort& fs = atermpp::down_cast<function_sort>(x);
69 const basic_sort& bs = atermpp::down_cast<const basic_sort>(x);
70 for(
const alias& a: aliases)
115 sorts = push_back(sorts, f.
sort());
140 return std::any_of(sorts.
begin(), sorts.
end(), [&](
const function_sort& s) { return equal_types(x, s); });
162#ifndef MCRL2_ENABLE_MACHINENUMBERS
359 auto& sorts = j->second;
362 if (!allow_double_decls)
381 read_sort(atermpp::down_cast<container_sort>(x).element_sort());
385 const function_sort& fs = atermpp::down_cast<function_sort>(x);
394 const structured_sort& struct_sort = atermpp::down_cast<structured_sort>(x);
406 name = constructor.
name();
407 if (arguments.
empty())
433 std::size_t constr_number=constructors.size();
435 functions_and_constructors.insert(functions_and_constructors.end(),mappings.begin(),mappings.end());
477 s = atermpp::down_cast<function_sort>(s).codomain();
492 mCRL2log(
log::debug) <<
"Read-in Func " << f.name() <<
", Types " << fsort <<
"" << std::endl;
516 throw mcrl2::runtime_error(std::string(e.what()) +
"\ntype checking of data expression failed");
535 const std::map<core::identifier_string, function_sort_list>&
user_functions()
const
Term containing a string.
const function_symbol & function() const
Returns the function symbol belonging to an aterm.
const std::string & name() const
Return the name of the function_symbol.
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.
bool empty() const
Returns true if the list's size is 0.
void push_front(const Term &el)
Inserts a new element at the beginning of the current list.
const core::identifier_string & name() const
const container_type & container_name() const
const sort_expression & element_sort() const
sort_expression sort() const
Returns the sort of the data expression.
const function_symbol_vector & user_defined_constructors() const
Gets the constructors defined by the user, excluding those that are system defined.
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.
const sort_expression & codomain() const
const sort_expression_list & domain() const
const core::identifier_string & name() const
const sort_expression & sort() const
const alias_vector & user_defined_aliases() const
Gets the user defined aliases.
const sort_specification & get_sort_specification() const
void check_for_empty_constructor_domains(const function_symbol_vector &constructors)
\brief An argument of a constructor of a structured sort
\brief A constructor for a structured sort
const structured_sort_constructor_list & constructors() const
sort_expression unwind_sort_expression(const sort_expression &x) const
const std::map< core::identifier_string, sort_expression > & user_constants() const
void add_system_function(const data::function_symbol &f)
type_checker(const data_specification &data_spec)
void initialise_system_defined_functions()
void add_constant(const data::function_symbol &f, const std::string &msg)
const std::map< core::identifier_string, sort_expression_list > & system_constants() const
void read_constructors_and_mappings(const function_symbol_vector &constructors, const function_symbol_vector &mappings, const function_symbol_vector &normalized_constructors)
std::map< core::identifier_string, function_sort_list > m_system_functions
void read_sort(const sort_expression &x)
bool equal_types(const sort_expression &x1, const sort_expression &x2) const
void add_function(const data::function_symbol &f, const std::string &msg, bool allow_double_decls=false)
void add_system_constant(const data::function_symbol &f)
std::map< core::identifier_string, function_sort_list > m_user_functions
const std::map< core::identifier_string, function_sort_list > & user_functions() const
const std::map< core::identifier_string, function_sort_list > & system_functions() const
std::map< core::identifier_string, sort_expression > m_user_constants
bool find_sort(const sort_expression &x, const function_sort_list &sorts) const
std::map< core::identifier_string, sort_expression_list > m_system_constants
\brief Unknown sort expression
Standard exception class for reporting runtime errors.
add your file description here.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
term_list< Term > reverse(const term_list< Term > &l)
Returns the list with the elements in reversed order.
identifier_string empty_identifier_string()
Provides the empty identifier string.
std::string pp(const identifier_string &x)
sort_expression unwind_sort_expression(const sort_expression &x, const alias_vector &aliases)
bool is_nat(const core::identifier_string &Number)
function_sort make_function_sort_(const sort_expression &domain, const sort_expression &codomain)
bool is_pos(const core::identifier_string &Number)
bool is_numeric_type(const sort_expression &x)
atermpp::term_list< T > transform_aterm_list(const Function &f, const atermpp::term_list< T > &x)
function_symbol difference(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
function_symbol bag2set(const sort_expression &s)
Constructor for function symbol Bag2Set.
function_symbol intersection(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
function_symbol count(const sort_expression &, const sort_expression &s0, const sort_expression &s1)
function_symbol set2bag(const sort_expression &s)
Constructor for function symbol Set2Bag.
function_symbol constructor(const sort_expression &s)
Constructor for function symbol @bag.
function_symbol in(const sort_expression &, const sort_expression &s0, const sort_expression &s1)
function_symbol union_(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
container_sort bag(const sort_expression &s)
Constructor for sort expression Bag(S)
function_symbol zero_function(const sort_expression &s)
Constructor for function symbol @zero_.
bool is_bool(const sort_expression &e)
Recogniser for sort expression Bool.
const basic_sort & bool_()
Constructor for sort expression Bool.
const function_symbol & implies()
Constructor for function symbol =>.
const function_symbol & and_()
Constructor for function symbol &&.
const function_symbol & false_()
Constructor for function symbol false.
const function_symbol & or_()
Constructor for function symbol ||.
const function_symbol & not_()
Constructor for function symbol !.
const function_symbol & true_()
Constructor for function symbol true.
container_sort fbag(const sort_expression &s)
Constructor for sort expression FBag(S)
function_symbol count_all(const sort_expression &s)
Constructor for function symbol #.
function_symbol empty(const sort_expression &s)
Constructor for function symbol {:}.
function_symbol cinsert(const sort_expression &s)
Constructor for function symbol @fbag_cinsert.
function_symbol insert(const sort_expression &s)
Constructor for function symbol @fset_insert.
function_symbol empty(const sort_expression &s)
Constructor for function symbol {}.
function_symbol count(const sort_expression &s)
Constructor for function symbol #.
container_sort fset(const sort_expression &s)
Constructor for sort expression FSet(S)
const function_symbol & int2nat()
Constructor for function symbol Int2Nat.
bool is_int(const sort_expression &e)
Recogniser for sort expression Int.
const function_symbol & nat2int()
Constructor for function symbol Nat2Int.
const function_symbol & int2pos()
Constructor for function symbol Int2Pos.
const function_symbol & cint()
Constructor for function symbol @cInt.
function_symbol mod(const sort_expression &s0, const sort_expression &s1)
function_symbol div(const sort_expression &s0, const sort_expression &s1)
const basic_sort & int_()
Constructor for sort expression Int.
function_symbol in(const sort_expression &s)
Constructor for function symbol in.
function_symbol rtail(const sort_expression &s)
Constructor for function symbol rtail.
function_symbol empty(const sort_expression &s)
Constructor for function symbol [].
function_symbol element_at(const sort_expression &s)
Constructor for function symbol ..
function_symbol head(const sort_expression &s)
Constructor for function symbol head.
function_symbol snoc(const sort_expression &s)
Constructor for function symbol <|.
function_symbol count(const sort_expression &s)
Constructor for function symbol #.
function_symbol rhead(const sort_expression &s)
Constructor for function symbol rhead.
function_symbol tail(const sort_expression &s)
Constructor for function symbol tail.
function_symbol cons_(const sort_expression &s)
Constructor for function symbol |>.
function_symbol concat(const sort_expression &s)
Constructor for function symbol ++.
const function_symbol & cnat()
Constructor for function symbol @cNat.
const basic_sort & nat()
Constructor for sort expression Nat.
bool is_nat(const sort_expression &e)
Recogniser for sort expression Nat.
const function_symbol & sqrt()
Constructor for function symbol sqrt.
const function_symbol & nat2pos()
Constructor for function symbol Nat2Pos.
const function_symbol & pos2nat()
Constructor for function symbol Pos2Nat.
bool is_pos(const sort_expression &e)
Recogniser for sort expression Pos.
const function_symbol & c1()
Constructor for function symbol @c1.
const basic_sort & pos()
Constructor for sort expression Pos.
function_symbol minimum(const sort_expression &s0, const sort_expression &s1)
function_symbol plus(const sort_expression &s0, const sort_expression &s1)
const function_symbol & creal()
Constructor for function symbol @cReal.
const function_symbol & pos2real()
Constructor for function symbol Pos2Real.
const function_symbol & round()
Constructor for function symbol round.
function_symbol times(const sort_expression &s0, const sort_expression &s1)
function_symbol divides(const sort_expression &s0, const sort_expression &s1)
const function_symbol & real2nat()
Constructor for function symbol Real2Nat.
const function_symbol & ceil()
Constructor for function symbol ceil.
function_symbol succ(const sort_expression &s0)
const function_symbol & real2int()
Constructor for function symbol Real2Int.
function_symbol pred(const sort_expression &s0)
function_symbol minus(const sort_expression &s0, const sort_expression &s1)
const basic_sort & real_()
Constructor for sort expression Real.
const function_symbol & floor()
Constructor for function symbol floor.
bool is_real(const sort_expression &e)
Recogniser for sort expression Real.
const function_symbol & nat2real()
Constructor for function symbol Nat2Real.
function_symbol abs(const sort_expression &s0)
function_symbol negate(const sort_expression &s0)
const function_symbol & int2real()
Constructor for function symbol Int2Real.
function_symbol exp(const sort_expression &s0, const sort_expression &s1)
const function_symbol & real2pos()
Constructor for function symbol Real2Pos.
function_symbol maximum(const sort_expression &s0, const sort_expression &s1)
function_symbol intersection(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
container_sort set_(const sort_expression &s)
Constructor for sort expression Set(S)
function_symbol constructor(const sort_expression &s)
Constructor for function symbol @set.
function_symbol false_function(const sort_expression &s)
Constructor for function symbol @false_.
function_symbol in(const sort_expression &, const sort_expression &s0, const sort_expression &s1)
function_symbol union_(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
function_symbol difference(const sort_expression &s, const sort_expression &s0, const sort_expression &s1)
function_symbol complement(const sort_expression &s)
Constructor for function symbol !.
atermpp::term_list< function_sort > function_sort_list
list of function sorts
bool is_structured_sort(const atermpp::aterm &x)
Returns true if the term t is a structured sort.
function_symbol less_equal(const sort_expression &s)
Constructor for function symbol <=.
function_symbol not_equal_to(const sort_expression &s)
Constructor for function symbol !=.
std::vector< alias > alias_vector
\brief vector of aliass
function_symbol less(const sort_expression &s)
Constructor for function symbol <.
bool is_untyped_sort(const atermpp::aterm &x)
Returns true if the term t is the unknown sort.
function_sort make_function_sort_(const sort_expression &dom1, const sort_expression &codomain)
Convenience constructor for function sort with domain size 1.
std::string pp(const abstraction &x)
function_symbol greater_equal(const sort_expression &s)
Constructor for function symbol >=.
bool is_container_sort(const atermpp::aterm &x)
Returns true if the term t is a container sort.
bool is_basic_sort(const atermpp::aterm &x)
Returns true if the term t is a basic sort.
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 ==.
function_symbol function_update(const sort_expression &s, const sort_expression &t)
Constructor for function symbol @func_update.
std::vector< function_symbol > function_symbol_vector
\brief vector of function_symbols
function_symbol if_(const sort_expression &s)
Constructor for function symbol if.
function_symbol greater(const sort_expression &s)
Constructor for function symbol >
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...