cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
mathematical_expr.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: API to expression classes for 'mathematical' expressions
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
#include "
mathematical_expr.h
"
10
11
#include "
arith_tools.h
"
12
#include "
mathematical_types.h
"
13
14
function_application_exprt::function_application_exprt
(
15
const
exprt
&_function,
16
argumentst
_arguments)
17
:
binary_exprt
(
18
_function,
19
ID_function_application,
20
tuple_exprt
(
std
::move(_arguments)),
21
to_mathematical_function_type
(_function.
type
()).codomain())
22
{
23
const
auto
&domain =
function_type
().
domain
();
24
PRECONDITION
(domain.size() ==
arguments
().size());
25
}
26
27
const
mathematical_function_typet
&
28
function_application_exprt::function_type
()
const
29
{
30
return
to_mathematical_function_type
(
function
().
type
());
31
}
32
33
static
mathematical_function_typet
34
lambda_type
(
const
lambda_exprt::variablest
&variables,
const
exprt
&where)
35
{
36
mathematical_function_typet::domaint
domain;
37
38
domain.reserve(variables.size());
39
40
for
(
const
auto
&v : variables)
41
domain.push_back(v.type());
42
43
return
mathematical_function_typet
(std::move(domain), where.
type
());
44
}
45
46
lambda_exprt::lambda_exprt
(
const
variablest
&_variables,
const
exprt
&_where)
47
:
binding_exprt
(
48
ID_lambda,
49
_variables,
50
_where,
51
lambda_type
(_variables, _where))
52
{
53
}
54
55
power_exprt::power_exprt
(
const
mp_integer
&_base,
const
exprt
&_exp)
56
:
power_exprt
{
from_integer
(_base, _exp.
type
()), _exp}
57
{
58
PRECONDITION
(
base
().
is_not_nil
());
59
}
from_integer
constant_exprt from_integer(const mp_integer &int_value, const typet &type)
Definition
arith_tools.cpp:99
arith_tools.h
binary_exprt::binary_exprt
binary_exprt(const exprt &_lhs, const irep_idt &_id, exprt _rhs)
Definition
std_expr.h:641
binding_exprt::binding_exprt
binding_exprt(irep_idt _id, const variablest &_variables, exprt _where, typet _type)
construct the binding expression
Definition
std_expr.h:3165
binding_exprt::variablest
std::vector< symbol_exprt > variablest
Definition
std_expr.h:3162
exprt
Base class for all expressions.
Definition
expr.h:57
exprt::exprt
exprt()
Definition
expr.h:62
exprt::type
typet & type()
Return the type of the expression.
Definition
expr.h:85
function_application_exprt::function_application_exprt
function_application_exprt(const exprt &_function, argumentst _arguments)
Definition
mathematical_expr.cpp:14
function_application_exprt::function_type
const mathematical_function_typet & function_type() const
This helper method provides the type of the expression returned by function.
Definition
mathematical_expr.cpp:28
function_application_exprt::argumentst
exprt::operandst argumentst
Definition
mathematical_expr.h:215
function_application_exprt::arguments
argumentst & arguments()
Definition
mathematical_expr.h:234
function_application_exprt::function
exprt & function()
Definition
mathematical_expr.h:221
irept::is_not_nil
bool is_not_nil() const
Definition
irep.h:372
lambda_exprt::lambda_exprt
lambda_exprt(const variablest &, const exprt &_where)
Definition
mathematical_expr.cpp:46
mathematical_function_typet
A type for mathematical functions (do not confuse with functions/methods in code).
Definition
mathematical_types.h:73
mathematical_function_typet::domain
domaint & domain()
Definition
mathematical_types.h:86
mathematical_function_typet::domaint
std::vector< typet > domaint
Definition
mathematical_types.h:77
power_exprt::power_exprt
power_exprt(const exprt &_base, const exprt &_exp)
Definition
mathematical_expr.h:96
power_exprt::base
const exprt & base() const
Definition
mathematical_expr.h:104
tuple_exprt
Definition
mathematical_expr.h:198
lambda_type
static mathematical_function_typet lambda_type(const lambda_exprt::variablest &variables, const exprt &where)
Definition
mathematical_expr.cpp:34
mathematical_expr.h
API to expression classes for 'mathematical' expressions.
mathematical_types.h
Mathematical types.
to_mathematical_function_type
const mathematical_function_typet & to_mathematical_function_type(const typet &type)
Cast a typet to a mathematical_function_typet.
Definition
mathematical_types.h:133
std
STL namespace.
mp_integer
BigInt mp_integer
Definition
smt_terms.h:17
PRECONDITION
#define PRECONDITION(CONDITION)
Definition
invariant.h:463
util
mathematical_expr.cpp
Generated by
1.17.0