25 static std::optional<constant_exprt>
28 if(quantifier_expr.
id()==ID_or)
34 for(
auto &x : quantifier_expr.
operands())
42 if(
expr_eq(var_expr, y_binary.lhs()) && y_binary.rhs().is_constant())
48 if(var_expr.
type().
id() == ID_unsignedbv)
51 else if(quantifier_expr.
id() == ID_and)
57 for(
auto &x : quantifier_expr.
operands())
59 if(x.id() != ID_ge && x.id() != ID_equal)
62 if(
expr_eq(var_expr, x_binary.lhs()) && x_binary.rhs().is_constant())
68 if(var_expr.
type().
id() == ID_unsignedbv)
77 static std::optional<constant_exprt>
80 if(quantifier_expr.
id()==ID_or)
86 for(
auto &x : quantifier_expr.
operands())
91 if(
expr_eq(var_expr, x_binary.lhs()) && x_binary.rhs().is_constant())
95 mp_integer over_i = numeric_cast_v<mp_integer>(over_expr);
114 for(
auto &x : quantifier_expr.
operands())
122 if(
expr_eq(var_expr, y_binary.lhs()) && y_binary.rhs().is_constant())
125 mp_integer over_i = numeric_cast_v<mp_integer>(over_expr);
130 else if(x.id() == ID_equal)
133 if(
expr_eq(var_expr, y_binary.lhs()) && y_binary.rhs().is_constant())
160 new_variables.pop_back();
179 return where_simplified;
186 if(expr.
id() == ID_forall)
192 else if(expr.
id() == ID_exists)
202 const std::optional<constant_exprt> min_i =
204 const std::optional<constant_exprt> max_i =
207 if(!min_i.has_value() || !max_i.has_value())
210 mp_integer lb = numeric_cast_v<mp_integer>(min_i.value());
211 mp_integer ub = numeric_cast_v<mp_integer>(max_i.value());
216 auto expr_simplified =
219 std::vector<exprt> expr_insts;
222 exprt constraint_expr =
224 expr_insts.push_back(constraint_expr);
227 if(expr.
id() == ID_forall)
232 if(where_simplified.
id() == ID_and)
242 else if(expr.
id() == ID_exists)
247 if(where_simplified.
id() == ID_or)
269 auto where_replaced = src.
instantiate(fresh_symbols);
static bool expr_eq(const exprt &expr1, const exprt &expr2)
A method to detect equivalence between experts that can contain typecast.
static std::optional< constant_exprt > get_quantifier_var_min(const exprt &var_expr, const exprt &quantifier_expr)
To obtain the min value for the quantifier variable of the specified forall/exists operator.
static std::optional< constant_exprt > get_quantifier_var_max(const exprt &var_expr, const exprt &quantifier_expr)
To obtain the max value for the quantifier variable of the specified forall/exists operator.
static std::optional< exprt > eager_quantifier_instantiation(const quantifier_exprt &expr, const namespacet &ns)
A base class for expressions that are predicates, i.e., Boolean-typed, and that take exactly two argu...
exprt instantiate(const exprt::operandst &) const
substitute free occurrences of the variables in where() by the given values
binding_exprt::variablest fresh_binding(const binding_exprt &)
create new, unique variables for the given binding
void finish_eager_conversion_quantifiers()
virtual literalt convert_quantifier(const quantifier_exprt &expr)
bvt conversion_failed(const exprt &expr)
Print that the expression of x has failed conversion, then return a vector of x's width.
quantifier_listt quantifier_list
A constant literal expression.
Base class for all expressions.
bool is_true() const
Return whether the expression is a constant representing true.
bool is_boolean() const
Return whether the expression represents a Boolean.
bool is_false() const
Return whether the expression is a constant representing false.
typet & type()
Return the type of the expression.
const irep_idt & id() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
virtual literalt convert_bool(const exprt &expr)
virtual literalt new_variable()=0
A base class for quantifier expressions.
Expression to hold a symbol (variable)
const exprt & skip_typecast(const exprt &expr)
find the expression nested inside typecasts, if any
Deprecated expression utility functions.
exprt simplify_expr(exprt src, const namespacet &ns)
#define UNREACHABLE
This should be used to mark dead code.
#define PRECONDITION(CONDITION)
exprt conjunction(const exprt::operandst &op)
1) generates a conjunction for two or more operands 2) for one operand, returns the operand 3) return...
exprt disjunction(const exprt::operandst &op)
1) generates a disjunction for two or more operands 2) for one operand, returns the operand 3) return...
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const not_exprt & to_not_expr(const exprt &expr)
Cast an exprt to an not_exprt.
const binary_relation_exprt & to_binary_relation_expr(const exprt &expr)
Cast an exprt to a binary_relation_exprt.