12#ifndef MCRL2_LPS_IS_WELL_TYPED_H
13#define MCRL2_LPS_IS_WELL_TYPED_H
18#include <boost/iterator/transform_iterator.hpp>
34 mutable std::ostringstream
error;
45 error <<
"is_well_typed(" << type <<
") failed: time " << t <<
" doesn't have sort real." << std::endl;
56 error <<
"is_well_typed(" << type <<
") failed: condition " << t <<
" doesn't have sort bool." << std::endl;
67 error <<
"is_well_typed(" << type <<
") failed: the assignments " << l <<
" are not well typed." << std::endl;
72 boost::make_transform_iterator(l.
begin(), lhs),
73 boost::make_transform_iterator(l.
end() , lhs)
77 error <<
"is_well_typed(" << type <<
") failed: data assignments " << l <<
" don't have unique left hand sides." << std::endl;
84 template <
typename Container>
87 for (
auto i = c.begin(); i != c.end(); ++i)
127 std::clog <<
"is_well_typed(data_assignment) failed: the left and right hand sides "
128 << a.
lhs() <<
" and " << a.
rhs() <<
" have different sorts." << std::endl;
228 template <
typename ActionSummand>
239 std::set<core::identifier_string> names;
242 names.insert(i->name());
248 error <<
"is_well_typed(linear_process) failed: some of the names of the summation variables " <<
core::detail::print_list(i->summation_variables()) <<
" also appear as process parameters." << std::endl;
258 error <<
"is_well_typed(linear_process) failed: some left hand sides of the assignments " <<
core::detail::print_list(i->assignments()) <<
" do not appear as process parameters." << std::endl;
292 template <
typename LinearProcess,
typename InitialProcessExpression>
298 auto const& action_summands = spec.
process().action_summands();
301 for (
auto i = action_summands.begin(); i != action_summands.end(); ++i)
350 error <<
"is_well_typed(specification) failed: some of the free variables were not declared\n";
378 template <
typename Term>
398 bool result = checker(x);
Add your file description here.
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.
\brief Assignment of a data expression to a variable
const data_expression & rhs() const
const variable & lhs() const
sort_expression sort() const
Returns the sort of the data expression.
bool is_well_typed() const
Returns true if.
const std::set< sort_expression > & sorts() const
Gets the normalised sort declarations including those that are system defined. This is the set with a...
const sort_expression & sort() const
LPS summand containing a multi-action.
const lps::multi_action & multi_action() const
Returns the multi-action of this summand.
const data::assignment_list & assignments() const
Returns the sequence of assignments.
LPS summand containing a deadlock.
const lps::deadlock & deadlock() const
Returns the deadlock of this summand.
bool has_time() const
Returns true if time is available.
const data::data_expression & time() const
Returns the time.
const std::vector< ActionSummand > & action_summands() const
Returns the sequence of action summands.
const deadlock_summand_vector & deadlock_summands() const
Returns the sequence of deadlock summands.
const data::variable_list & process_parameters() const
Returns the sequence of process parameters.
\brief A timed multi-action
bool has_time() const
Returns true if time is available.
const data::data_expression & time() const
const std::set< data::variable > & global_variables() const
Returns the declared free variables of the LPS.
const process::action_label_list & action_labels() const
Returns a sequence of action labels. This sequence contains all action labels occurring in the specif...
const LinearProcess & process() const
Returns the linear process of the specification.
const data::data_specification & data() const
Returns the data specification.
Linear process specification.
Linear process specification.
const data::data_expression & condition() const
Returns the condition expression.
data::variable_list & summation_variables()
Returns the sequence of summation variables.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
std::string print_list(const Container &v, const std::string &message="", bool print_index=false, bool boundary_spaces=true)
Creates a string representation of a container.
bool check_variable_sorts(const VariableContainer &variables, const SortContainer &sorts)
Returns true if the domain sorts and the range sort of the given variables are contained in sorts.
bool check_variable_names(variable_list const &variables, const std::set< core::identifier_string > &names)
Returns true if names of the given variables are not contained in names.
bool sequence_contains_duplicates(Iterator first, Iterator last)
Returns true if the sequence [first, last) contains duplicates.
bool check_assignment_variables(assignment_list const &assignments, variable_list const &variables)
Returns true if the left hand sides of assignments are contained in variables.
bool unique_names(const VariableContainer &variables)
Returns true if the names of the given variables are unique.
std::set< typename Container::value_type > make_set(const Container &c)
Makes a set of the given container.
bool is_bool(const sort_expression &e)
Recogniser for sort expression Bool.
bool is_real(const sort_expression &e)
Recogniser for sort expression Real.
variable_list free_variables(const data_expression &x)
bool is_well_typed(const T &x)
Checks well typedness of an LPS object.
bool check_action_labels(const process::action_list &actions, const std::set< process::action_label > &labels)
Returns true if the labels of the given actions are contained in labels.
bool check_action_label_sorts(const process::action_label_list &action_labels, const std::set< data::sort_expression > &sorts)
Returns true if the sorts of the given action labels are contained in sorts.
bool check_well_typedness(const T &x)
Checks well typedness of an LPS object, and will print error messages to stderr.
std::set< data::variable > find_free_variables(const lps::deadlock &x)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Add your file description here.
Function object for applying a substitution to LPS data types.
bool is_well_typed(const linear_process_base< ActionSummand > &p) const
Checks well typedness of a linear process.
bool is_well_typed(const process::action &a) const
Traverses an action.
bool is_well_typed(const action_summand &s) const
Checks well typedness of a summand.
bool check_time(const data::data_expression &t, const std::string &type) const
Checks if the sort of t has type real.
bool is_well_typed(const data::assignment &a) const
Traverses an assignment.
bool check_condition(const data::data_expression &t, const std::string &type) const
Checks if the sort of t has type bool.
bool operator()(const Term &t) const
bool is_well_typed(const stochastic_specification &spec) const
bool is_well_typed(const data::variable &d) const
Checks well typedness of a variable.
bool check_assignments(const data::assignment_list &l, const std::string &type) const
Checks if the assignments are well typed and have unique left hand sides.
bool is_well_typed(const specification &spec) const
bool is_well_typed(const data::sort_expression &d) const
Checks well typedness of a sort expression.
bool is_well_typed_container(const Container &c) const
Checks well typedness of the elements of a container.
bool is_well_typed(const process::action_label &d) const
Traverses an action label.
bool is_well_typed(const specification_base< LinearProcess, InitialProcessExpression > &spec, const std::set< data::variable > &free_variables) const
Checks well typedness of a linear process specification.
bool is_well_typed(const deadlock &d) const
Checks well typedness of a deadlock.
bool is_well_typed(const data::data_expression &d) const
Checks well typedness of a data expression.
bool is_well_typed(const deadlock_summand &s) const
Checks well typedness of a summand.
bool is_well_typed(const multi_action &a) const
Checks well typedness of a multi-action.