mCRL2
Loading...
Searching...
No Matches
data_expression.h
Go to the documentation of this file.
1// Author(s): Jeroen Keiren
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
11
12#ifndef MCRL2_DATA_DATA_EXPRESSION_H
13#define MCRL2_DATA_DATA_EXPRESSION_H
14
18
19namespace mcrl2
20{
21
22namespace data
23{
24
26inline bool is_abstraction(const atermpp::aterm& x)
27{
29}
30
32inline bool is_lambda(const atermpp::aterm& x)
33{
35}
36
38inline bool is_forall(const atermpp::aterm& x)
39{
41}
42
44inline bool is_exists(const atermpp::aterm& x)
45{
47}
48
51{
53}
54
57{
59}
60
63{
65}
66
69{
71}
72
74inline bool is_variable(const atermpp::aterm& x)
75{
77}
78
80inline bool is_machine_number(const atermpp::aterm& x)
81{
82 return x.type_is_int();
83}
84
90inline bool is_application(const atermpp::aterm& x)
91{
93}
94
99{
101}
102
104inline bool is_where_clause(const atermpp::aterm& x)
105{
107}
108
111{
113}
114
115class application; // prototype
116
127
128//--- start generated class data_expression ---//
131{
132 public:
135 : atermpp::aterm(core::detail::default_values::DataExpr)
136 {}
137
140 explicit data_expression(const atermpp::aterm& term)
141 : atermpp::aterm(term)
142 {
144 }
145
147 data_expression(const data_expression&) noexcept = default;
148 data_expression(data_expression&&) noexcept = default;
149 data_expression& operator=(const data_expression&) noexcept = default;
150 data_expression& operator=(data_expression&&) noexcept = default;
151//--- start user section data_expression ---//
155 {
157 }
158
159 application operator()(const data_expression& e) const;
160
162 const data_expression& e2) const;
163
165 const data_expression& e2,
166 const data_expression& e3) const;
167
169 const data_expression& e2,
170 const data_expression& e3,
171 const data_expression& e4) const;
172
174 const data_expression& e2,
175 const data_expression& e3,
176 const data_expression& e4,
177 const data_expression& e5) const;
178
180 const data_expression& e2,
181 const data_expression& e3,
182 const data_expression& e4,
183 const data_expression& e5,
184 const data_expression& e6) const;
185
187 sort_expression sort() const;
188
189 private:
190 // The following methods are not to be used in a data_expression.
191 // They are restricted to a data_appl.
194
195//--- end user section data_expression ---//
196};
197
200
202typedef std::vector<data_expression> data_expression_vector;
203
204// prototype declaration
205std::string pp(const data_expression& x);
206
211inline
212std::ostream& operator<<(std::ostream& out, const data_expression& x)
213{
214 return out << data::pp(x);
215}
216
219{
220 t1.swap(t2);
221}
222//--- end generated class data_expression ---//
223
225{
227}
228
232inline
234{
235 return is_machine_number(x) ||
236 is_lambda(x) ||
237 is_forall(x) ||
238 is_exists(x) ||
243 is_variable(x) ||
244 is_application(x) ||
245 is_where_clause(x) ||
247}
248
253template < typename Container >
255{
256 return data_expression_list(r.begin(),r.end());
257}
258
259class variable;
260
261// template function overloads
262std::string pp(const data_expression_list& x);
263std::string pp(const data_expression_vector& x);
265std::set<data::sort_expression> find_sort_expressions(const data::data_expression& x);
266std::set<data::variable> find_all_variables(const data::data_expression& x);
267std::set<data::variable> find_all_variables(const data::data_expression_list& x);
268std::set<data::variable> find_free_variables(const data::data_expression& x);
269std::set<data::variable> find_free_variables(const data::data_expression_list& x);
271
272inline
274{
275 return find_free_variables(x).empty();
276}
277
280
281} // namespace data
282
283} // namespace mcrl2
284
285// The trick of including application.h only at this point is needed to break
286// the circular dependencies between application and data_expression. This
287// dependency was introduced to allow the application operator to be defined for
288// all data expression types.
289#ifndef MCRL2_DATA_APPLICATION_H
291#endif
292
293namespace mcrl2
294{
295namespace data
296{
299inline bool is_application(const data_expression& t)
300{
301 return !(is_machine_number(t) ||
303 is_variable(t) ||
304 is_where_clause(t) ||
305 is_abstraction(t) ||
307}
308
310inline
312{
313 return atermpp::down_cast<data_expression_list>(static_cast<const atermpp::aterm&>(l));
314}
315
317inline
319{
320 return application(*this, e);
321}
322
324inline
326{
327 return application(*this, e1, e2);
328}
329
331inline
333{
334 return application(*this, e1, e2, e3);
335}
336
338inline
340{
341 return application(*this, e1, e2, e3, e4);
342}
343
345inline
347{
348 return application(*this, e1, e2, e3, e4, e5);
349}
350
352inline
354 const data_expression& e4, const data_expression& e5, const data_expression& e6) const
355{
356 return application(*this, e1, e2, e3, e4, e5, e6);
357}
358
359} // namespace data
360} // namespace mcrl2
361
362
363namespace std
364{
365
366template<>
367struct hash<mcrl2::data::data_expression>
368{
369 std::size_t operator()(const mcrl2::data::data_expression& v) const
370 {
371 const hash<atermpp::aterm> hasher;
372 return hasher(v);
373 }
374};
375
376} // namespace std
377
378
379
380#endif // MCRL2_DATA_DATA_EXPRESSION_H
381
The class application.
aterm()
Default constructor.
Definition aterm.h:48
const function_symbol & function() const
Returns the function symbol belonging to an aterm.
Definition aterm.h:144
Iterator for term_appl.
A list of aterm objects.
Definition aterm_list.h:24
void swap(unprotected_aterm_core &t) noexcept
Swaps this term with its argument.
Definition aterm_core.h:152
bool type_is_int() const noexcept
Dynamic check whether the term is an aterm_int.
Definition aterm_core.h:63
An application of a data expression to a number of arguments.
data_expression(const atermpp::aterm &term)
data_expression()
\brief Default constructor X3.
sort_expression sort() const
Returns the sort of the data expression.
Definition data.cpp:108
const_iterator end() const
application operator()(const data_expression &e) const
Apply a data expression to a data expression.
data_expression(const data_expression &) noexcept=default
Move semantics.
data_expression(data_expression &&) noexcept=default
const_iterator begin() const
bool is_default_data_expression() const
A function to efficiently determine whether a data expression is made by the default constructor.
\brief A sort expression
\brief A data variable
Definition variable.h:28
The class container_sort.
The class function_sort.
The main namespace for the aterm++ library.
Definition algorithm.h:21
bool check_rule_DataExpr(const Term &t)
bool gsIsDataAppl(const atermpp::aterm &Term)
bool gsIsDataAppl_no_check(const atermpp::aterm &Term)
void make_data_expression(data_expression &result)
variable_list free_variables(const data_expression &x)
Definition data.cpp:195
bool is_data_expression(const atermpp::aterm &x)
Test for a data_expression expression.
void swap(abstraction &t1, abstraction &t2)
\brief swap overload
bool is_application_no_check(const atermpp::aterm &x)
Returns true if the term t is an application, but it does not check whether an application symbol of ...
data_expression_list make_data_expression_list(Container const &r, typename atermpp::enable_if_container< Container, data_expression >::type *=nullptr)
Converts an container with data expressions to data_expression_list.
data::data_equation translate_user_notation(const data::data_equation &x)
Definition data.cpp:90
std::set< data::variable > find_all_variables(const data::data_expression &x)
Definition data.cpp:94
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_untyped_identifier(const atermpp::aterm &x)
Returns true if the term t is an identifier.
std::vector< data_expression > data_expression_vector
\brief vector of data_expressions
std::string pp(const abstraction &x)
Definition data.cpp:39
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.
atermpp::term_list< data_expression > data_expression_list
\brief list of data_expressions
std::set< data::sort_expression > find_sort_expressions(const data::data_equation &x)
Definition data.cpp:91
std::set< data::variable > find_free_variables(const data::data_expression &x)
Definition data.cpp:99
bool is_untyped_set_or_bag_comprehension(const atermpp::aterm &x)
Returns true if the term t is a set/bag comprehension.
atermpp::term_list< variable > variable_list
\brief list of variables
bool is_exists(const atermpp::aterm &x)
Returns true if the term t is an existential quantification.
bool is_bag_comprehension(const atermpp::aterm &x)
Returns true if the term t is a bag comprehension.
bool is_set_comprehension(const atermpp::aterm &x)
Returns true if the term t is a set comprehension.
bool is_machine_number(const atermpp::aterm &x)
Returns true if the term t is a machine_number.
const data_expression_list & variable_list_to_data_expression_list(const variable_list &l)
Transform a variable_list into a data_expression_list.
bool is_lambda(const atermpp::aterm &x)
Returns true if the term t is a lambda abstraction.
bool is_constant(const data_expression &x)
bool search_variable(const data::data_expression &x, const data::variable &v)
Definition data.cpp:103
bool is_application(const atermpp::aterm &x)
Returns true if the term t is an application.
bool is_variable(const atermpp::aterm &x)
Returns true if the term t is a variable.
std::ostream & operator<<(std::ostream &out, const abstraction &x)
Definition abstraction.h:94
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
STL namespace.
static const atermpp::aterm DataExpr
static const atermpp::function_symbol Lambda
static const atermpp::function_symbol BagComp
static const atermpp::function_symbol Forall
static const atermpp::function_symbol Whr
static const atermpp::function_symbol Exists
static const atermpp::function_symbol OpId
static const atermpp::function_symbol SetComp
static const atermpp::function_symbol Binder
static const atermpp::function_symbol DataVarId
static const atermpp::function_symbol UntypedIdentifier
static const atermpp::function_symbol UntypedSetBagComp
std::size_t operator()(const mcrl2::data::data_expression &v) const
#define hash(l, r, m)
Definition tree_set.cpp:23
add your file description here.