cprover
Loading...
Searching...
No Matches
mathematical_expr.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: API to expression classes for 'mathematical' expressions
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9#include "mathematical_expr.h"
10#include "mathematical_types.h"
11
13 const exprt &_function,
14 argumentst _arguments)
16 _function,
17 ID_function_application,
18 tuple_exprt(std::move(_arguments)),
19 to_mathematical_function_type(_function.type()).codomain())
20{
21 const auto &domain = function_type().domain();
22 PRECONDITION(domain.size() == arguments().size());
23}
24
30
32lambda_type(const lambda_exprt::variablest &variables, const exprt &where)
33{
35
36 domain.reserve(variables.size());
37
38 for(const auto &v : variables)
39 domain.push_back(v.type());
40
41 return mathematical_function_typet(std::move(domain), where.type());
42}
43
44lambda_exprt::lambda_exprt(const variablest &_variables, const exprt &_where)
46 ID_lambda,
47 _variables,
48 _where,
49 lambda_type(_variables, _where))
50{
51}
A base class for binary expressions.
Definition std_expr.h:638
A base class for variable bindings (quantifiers, let, lambda)
Definition std_expr.h:3099
std::vector< symbol_exprt > variablest
Definition std_expr.h:3101
Base class for all expressions.
Definition expr.h:56
typet & type()
Return the type of the expression.
Definition expr.h:84
function_application_exprt(const exprt &_function, argumentst _arguments)
const mathematical_function_typet & function_type() const
This helper method provides the type of the expression returned by function.
lambda_exprt(const variablest &, const exprt &_where)
A type for mathematical functions (do not confuse with functions/methods in code)
static mathematical_function_typet lambda_type(const lambda_exprt::variablest &variables, const exprt &where)
API to expression classes for 'mathematical' expressions.
Mathematical types.
const mathematical_function_typet & to_mathematical_function_type(const typet &type)
Cast a typet to a mathematical_function_typet.
STL namespace.
#define PRECONDITION(CONDITION)
Definition invariant.h:463