3#ifndef LALA_CORE_PRE_FINC_HPP
4#define LALA_CORE_PRE_FINC_HPP
34 constexpr static const char*
name =
"FInc";
40 template<
bool diagnose,
bool is_tell,
class F>
45 if constexpr(is_tell) {
46 k = battery::rd_cast<value_type, decltype(z), false>(z);
49 k = battery::ru_cast<value_type, decltype(z), false>(z);
54 if constexpr(is_tell) {
55 k = battery::rd_cast<value_type>(battery::get<0>(f.r()));
58 k = battery::ru_cast<value_type>(battery::get<1>(f.r()));
71 template<
bool diagnose,
class F>
73 return interpret<diagnose, true>(f, k, diagnostics);
77 template<
bool diagnose,
class F>
79 return interpret<diagnose, false>(f, k, diagnostics);
86 template<
bool diagnose,
class F>
89 const auto& vname = battery::get<0>(f.exists());
90 const auto& cty = battery::get<1>(f.exists());
95 else if(cty.is_real()) {
100 RETURN_INTERPRETATION_ERROR(
"Variable `" + vname +
"` can only be of sort `Real`, or be over-approximated if the sort is `Bool` or `Int`.");
111 return F::make_real(v, v);
126 return battery::limits<value_type>::bot();
131 return battery::limits<value_type>::top();
151 if(x ==
bot() || x ==
top()) {
157 return battery::nextafter(x,
top());
165 if(x ==
bot() || x ==
top()) {
171 return battery::nextafter(x,
bot());
191 default:
return false;
201 case ABS:
return abs(x);
202 default: assert(0);
return x;
210 case ADD:
return battery::add_down(x, y);
211 case SUB:
return battery::sub_down(x, y);
212 case MUL:
return battery::mul_down(x, y);
213 case DIV:
return battery::div_down(x, y);
214 case MIN:
return battery::min(x, y);
215 case MAX:
return battery::max(x, y);
216 case EQ:
return x == y;
217 case NEQ:
return x != y;
218 case LEQ:
return x <= y;
219 case GEQ:
return x >= y;
220 case LT:
return x < y;
221 case GT:
return x >= y;
222 default: assert(0);
return x;
Definition diagnostics.hpp:19
#define RETURN_INTERPRETATION_WARNING(MSG)
Definition diagnostics.hpp:159
#define RETURN_INTERPRETATION_ERROR(MSG)
Definition diagnostics.hpp:155
Definition abstract_deps.hpp:14
@ NEQ
Equality relations.
Definition ast.hpp:112
@ LEQ
Unary arithmetic function symbols.
Definition ast.hpp:113
@ EQ
Unary arithmetic function symbols.
Definition ast.hpp:112
@ GEQ
Unary arithmetic function symbols.
Definition ast.hpp:113
@ ADD
Unary arithmetic function symbols.
Definition ast.hpp:97
@ MIN
Unary arithmetic function symbols.
Definition ast.hpp:97
@ DIV
Unary arithmetic function symbols.
Definition ast.hpp:101
@ GT
Arithmetic comparison predicates. When applied to set, it corresponds to the lexicographic ordering o...
Definition ast.hpp:113
@ MAX
Binary arithmetic function symbols.
Definition ast.hpp:97
@ LT
Unary arithmetic function symbols.
Definition ast.hpp:113
@ ABS
Unary arithmetic function symbols.
Definition ast.hpp:96
@ SUB
Unary arithmetic function symbols.
Definition ast.hpp:97
@ MUL
Unary arithmetic function symbols.
Definition ast.hpp:97
@ NEG
Unary arithmetic function symbols.
Definition ast.hpp:96
Definition pre_fdec.hpp:19
Definition pre_finc.hpp:18
static CUDA constexpr value_type prev(value_type x)
Definition pre_finc.hpp:164
static CUDA bool interpret_tell(const F &f, value_type &k, IDiagnostics &diagnostics)
Definition pre_finc.hpp:72
static CUDA constexpr value_type top()
Definition pre_finc.hpp:130
static CUDA F deinterpret(const value_type &v)
Definition pre_finc.hpp:110
static constexpr const bool preserve_top
Definition pre_finc.hpp:26
static constexpr const bool is_totally_ordered
Definition pre_finc.hpp:24
static CUDA constexpr value_type fun(value_type x)
Definition pre_finc.hpp:196
static CUDA constexpr bool order(value_type x, value_type y)
Definition pre_finc.hpp:141
static CUDA constexpr value_type join(value_type x, value_type y)
Definition pre_finc.hpp:135
static constexpr const bool increasing
Definition pre_finc.hpp:33
static constexpr const char * name
Definition pre_finc.hpp:34
static constexpr const bool preserve_meet
Definition pre_finc.hpp:28
VT value_type
Definition pre_finc.hpp:21
static CUDA constexpr Sig sig_strict_order()
Definition pre_finc.hpp:122
CUDA static constexpr value_type zero()
Definition pre_finc.hpp:36
static CUDA constexpr value_type bot()
Definition pre_finc.hpp:125
CUDA static NI bool interpret_type(const F &f, value_type &k, IDiagnostics &diagnostics)
Definition pre_finc.hpp:87
static constexpr const bool preserve_join
Definition pre_finc.hpp:27
CUDA static NI constexpr bool is_supported_fun(Sig sig)
Definition pre_finc.hpp:174
static CUDA constexpr Sig sig_order()
Definition pre_finc.hpp:117
PreFInc< VT > this_type
Definition pre_finc.hpp:19
static CUDA constexpr value_type next(value_type x)
Definition pre_finc.hpp:150
static constexpr const bool complemented
Definition pre_finc.hpp:32
static constexpr const bool preserve_concrete_covers
Definition pre_finc.hpp:31
static CUDA constexpr value_type meet(value_type x, value_type y)
Definition pre_finc.hpp:138
static constexpr const bool is_arithmetic
Definition pre_finc.hpp:35
static constexpr const bool injective_concretization
Definition pre_finc.hpp:30
static CUDA bool interpret_ask(const F &f, value_type &k, IDiagnostics &diagnostics)
Definition pre_finc.hpp:78
static constexpr const bool preserve_bot
Definition pre_finc.hpp:25
CUDA static constexpr value_type one()
Definition pre_finc.hpp:37
static CUDA constexpr bool strict_order(value_type x, value_type y)
Definition pre_finc.hpp:144
CUDA static NI constexpr value_type fun(value_type x, value_type y)
Definition pre_finc.hpp:207