74 return std::make_unique<interval_index_ranget>(
interval, n);
81 if(type.
id() == ID_signedbv)
95 if(type.
id() == ID_signedbv)
120 std::optional<mp_integer> maybe_integer_value =
121 numeric_cast<mp_integer>(value);
122 INVARIANT(maybe_integer_value.has_value(),
"Input has to have a value");
123 return maybe_integer_value.value();
160 if(e.
id() == ID_constant_interval)
178 relation == ID_le || relation == ID_lt || relation == ID_ge ||
179 relation == ID_gt || relation == ID_equal);
180 if(relation == ID_le)
182 if(relation == ID_ge)
184 if(relation == ID_lt)
186 if(relation == ID_gt)
199 const auto &relation = e.
id();
201 const auto &lhs = binary_e.lhs();
202 const auto &rhs = binary_e.rhs();
204 relation == ID_le || relation == ID_lt || relation == ID_ge ||
205 relation == ID_gt || relation == ID_equal);
206 PRECONDITION(lhs.is_constant() || lhs.id() == ID_symbol);
207 PRECONDITION(rhs.is_constant() || rhs.id() == ID_symbol);
210 const auto the_constant_part_of_the_relation =
211 (rhs.id() == ID_symbol ? lhs : rhs);
212 const auto maybe_inverted_relation =
215 if(maybe_inverted_relation == ID_le)
217 if(maybe_inverted_relation == ID_lt)
219 if(maybe_inverted_relation == ID_ge)
221 if(maybe_inverted_relation == ID_gt)
224 maybe_inverted_relation == ID_equal,
"We excluded other cases above");
226 the_constant_part_of_the_relation, the_constant_part_of_the_relation);
306 return std::hash<std::string>{}(
interval.pretty());
313 std::dynamic_pointer_cast<const interval_abstract_valuet>(other);
314 return cast_other &&
interval == cast_other->interval;
324 std::string lower_string;
325 std::string upper_string;
327 if(
interval.get_lower().id() == ID_min_value)
329 lower_string =
"-INF";
334 interval.get_lower().is_constant(),
"We only support constant limits");
339 if(
interval.get_upper().id() == ID_max_value)
341 upper_string =
"+INF";
346 interval.get_upper().is_constant(),
"We only support constant limits");
351 out <<
"[" << lower_string <<
", " << upper_string <<
"]";
367 widened.widened_lower_bound, widened.widened_upper_bound);
375 if(other->is_bottom())
376 return shared_from_this();
378 auto other_interval = other->to_interval();
383 if(
interval.contains(other_interval))
384 return shared_from_this();
390 interval.get_lower(), other_interval.get_lower());
392 interval.get_upper(), other_interval.get_upper());
400 auto other_interval = other->to_interval();
402 if(other_interval.contains(
interval))
403 return shared_from_this();
405 if(
interval.contains(other_interval))
409 interval.get_lower(), other_interval.get_lower());
411 interval.get_upper(), other_interval.get_upper());
426 interval.get_lower().id() == ID_min_value ||
427 interval.get_upper().id() == ID_max_value)
443 const exprt &upper)
const
460 if(
interval.is_single_value_interval())
466 return and_exprt(lower_bound, upper_bound);
477 if(
interval.is_single_value_interval())
An abstract version of a program environment.
std::set< abstract_object_pointert > abstract_object_visitedt
sharing_ptrt< class abstract_objectt > abstract_object_pointert
Statistics gathering for the variable senstivity domain.
index_range_implementation_ptrt make_empty_index_range()
value_range_implementation_ptrt make_single_value_range(const abstract_object_pointert &value)
std::unique_ptr< index_range_implementationt > index_range_implementation_ptrt
std::unique_ptr< value_range_implementationt > value_range_implementation_ptrt
Pre-defined bitvector types.
const signedbv_typet & to_signedbv_type(const typet &type)
Cast a typet to a signedbv_typet.
const unsignedbv_typet & to_unsignedbv_type(const typet &type)
Cast a typet to an unsignedbv_typet.
virtual exprt to_constant() const
Converts to a constant expression if possible.
virtual bool is_top() const
Find out if the abstract object is top.
virtual bool is_bottom() const
Find out if the abstract object is bottom.
virtual void output(std::ostream &out, const class ai_baset &ai, const namespacet &ns) const
Print the value of the abstract object.
virtual void get_statistics(abstract_object_statisticst &statistics, abstract_object_visitedt &visited, const abstract_environmentt &env, const namespacet &ns) const
virtual const typet & type() const
Get the real type of the variable this abstract object is representing.
sharing_ptrt< const abstract_value_objectt > as_value(const abstract_object_pointert &obj) const
sharing_ptrt< const abstract_value_objectt > abstract_value_pointert
This is the basic interface of the abstract interpreter with default implementations of the core func...
A base class for expressions that are predicates, i.e., Boolean-typed, and that take exactly two argu...
A base class for relations, i.e., binary predicates whose two operands have the same type.
const irep_idt & get_value() const
Represents an interval of values.
constant_interval_exprt bottom() const
tvt greater_than(const constant_interval_exprt &o) const
tvt less_than_or_equal(const constant_interval_exprt &o) const
static bool is_top(const constant_interval_exprt &a)
static exprt get_max(const exprt &a, const exprt &b)
static exprt get_min(const exprt &a, const exprt &b)
const exprt & get_lower() const
const exprt & get_upper() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
bool is_one() const
Return whether the expression is a constant representing 1.
bool is_true() const
Return whether the expression is a constant representing true.
bool is_false() const
Return whether the expression is a constant representing false.
bool is_zero() const
Return whether the expression is a constant representing 0.
typet & type()
Return the type of the expression.
bool is_constant() const
Return whether the expression is a constant.
mp_integer largest() const
Return the largest value that can be represented using this type.
mp_integer smallest() const
Return the smallest value that can be represented using this type.
abstract_object_pointert merge_with_value(const abstract_value_pointert &other, const widen_modet &widen_mode) const override
Merge another interval abstract object with this one.
interval_abstract_valuet(const typet &t, bool tp, bool bttm)
internal_abstract_object_pointert mutable_clone() const override
bool internal_equality(const abstract_object_pointert &other) const override
void output(std::ostream &out, const class ai_baset &ai, const class namespacet &ns) const override
void get_statistics(abstract_object_statisticst &statistics, abstract_object_visitedt &visited, const abstract_environmentt &env, const namespacet &ns) const override
index_range_implementation_ptrt index_range_implementation(const namespacet &ns) const override
exprt to_constant() const override
Converts to a constant expression if possible.
abstract_value_pointert constrain(const exprt &lower, const exprt &upper) const override
exprt to_predicate_internal(const exprt &name) const override
to_predicate implementation - derived classes will override
abstract_object_pointert meet_with_value(const abstract_value_pointert &other) const override
Meet another interval abstract object with this one.
value_range_implementation_ptrt value_range_implementation() const override
void set_top_internal() override
size_t internal_hash() const override
static std::shared_ptr< interval_abstract_valuet > make_interval(Args &&... args)
constant_interval_exprt interval
const exprt & current() const override
index_range_implementation_ptrt reset() const override
static exprt next_element(const exprt &cur, const namespacet &ns)
interval_index_ranget(const constant_interval_exprt &interval_, const namespacet &n)
const constant_interval_exprt & interval
bool advance_to_next() override
const irep_idt & id() const
+∞ upper bound for intervals
static memory_sizet from_bytes(std::size_t bytes)
-∞ upper bound for intervals
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
The plus expression Associativity is not specified.
The type of an expression, extends irept.
const exprt & skip_typecast(const exprt &expr)
find the expression nested inside typecasts, if any
Deprecated expression utility functions.
const constant_interval_exprt & to_constant_interval_expr(const exprt &expr)
bool new_interval_is_top(const constant_interval_exprt &e)
static constant_interval_exprt interval_from_relation(const exprt &e)
Builds an interval representing all values satisfying the input expression.
static bool represents_interval(const exprt &expr)
static bool bvint_value_is_min(const typet &type, const mp_integer &value)
static mp_integer force_value_from_expr(const exprt &value)
abstract_object_pointert widening_merge(const constant_interval_exprt &lhs, const constant_interval_exprt &rhs)
static index_range_implementation_ptrt make_interval_index_range(const constant_interval_exprt &interval, const namespacet &n)
static constant_interval_exprt interval_from_x_gt_value(const exprt &value)
static constant_interval_exprt make_interval_expr(const exprt &expr)
static bool bvint_value_is_max(const typet &type, const mp_integer &value)
static irep_idt invert_relation(const irep_idt &relation)
static constant_interval_exprt interval_from_x_ge_value(const exprt &value)
static constant_interval_exprt interval_from_x_lt_value(const exprt &value)
static constant_interval_exprt interval_from_x_le_value(const exprt &value)
An interval to represent a set of possible values.
const std::string & id2string(const irep_idt &d)
exprt simplify_expr(exprt src, const namespacet &ns)
#define PRECONDITION(CONDITION)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
memory_sizet objects_memory_usage
An underestimation of the memory usage of the abstract objects.
std::size_t number_of_single_value_intervals
std::size_t number_of_interval_abstract_objects