Go to the documentation of this file.
20 return val.find_first_not_of(
'0')==std::string::npos;
26 vm, !expr.
has_operands(),
"constant expression must not have operands");
32 "bitvector constant must have a non-empty value");
39 .find_first_not_of(
"0123456789ABCDEF") == std::string::npos,
40 "negative bitvector constant must use two's complement");
47 "bitvector constant must not have leading zeros");
77 -> decltype(struct_expr.op0())
80 std::is_base_of<struct_exprt, T>::value,
"T must be a struct_exprt.");
84 index < struct_expr.operands().size(),
85 "component matching index should exist");
86 return struct_expr.operands()[index];
118 const typet &compound_type = ns.
follow(member_expr.compound().type());
119 const auto *struct_union_type =
120 type_try_dynamic_cast<struct_union_typet>(compound_type);
123 struct_union_type !=
nullptr,
124 "member must address a struct, union or compatible type");
127 struct_union_type->get_component(member_expr.get_component_name());
132 "member component '" +
id2string(member_expr.get_component_name()) +
133 "' must exist on addressed type");
138 "member expression's type must match the addressed struct or union "
150 let_expr.values().size() == let_expr.variables().size(),
151 "number of variables must match number of values");
154 make_range(let_expr.variables()).zip(let_expr.values()))
159 "let binding symbols must be symbols");
164 "let bindings must be type consistent");
169 const std::map<irep_idt, exprt> &substitutions,
172 if(src.
id() == ID_symbol)
175 if(s_it == substitutions.end())
181 src.
id() == ID_forall || src.
id() == ID_exists || src.
id() == ID_lambda)
187 auto new_substitutions = substitutions;
188 for(
const auto &variable : binding_expr.variables())
189 new_substitutions.erase(variable.get_identifier());
193 if(op_result.has_value())
196 binding_expr.variables(),
198 binding_expr.type());
202 else if(src.
id() == ID_let)
209 auto new_substitutions = substitutions;
210 for(
const auto &variable : binding_expr.variables())
211 new_substitutions.erase(variable.get_identifier());
213 bool op_changed =
false;
215 for(
auto &op : new_let_expr.values())
219 if(op_result.has_value())
221 op = op_result.value();
228 if(op_result.has_value())
230 new_let_expr.where() = op_result.value();
235 return std::move(new_let_expr);
243 bool op_changed =
false;
249 if(op_result.has_value())
251 op = op_result.value();
268 std::map<symbol_exprt, exprt> value_map;
270 for(std::size_t i = 0; i <
variables.size(); i++)
278 std::map<irep_idt, exprt> substitutions;
280 for(std::size_t i = 0; i <
variables.size(); i++)
286 if(substitute_result.has_value())
287 return substitute_result.value();
294 std::vector<exprt> values;
295 values.reserve(new_variables.size());
296 for(
const auto &new_variable : new_variables)
297 values.push_back(new_variable);
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
#define DATA_CHECK(vm, condition, message)
This macro takes a condition which denotes a well-formedness criterion on goto programs,...
exprt conjunction(const exprt::operandst &op)
1) generates a conjunction for two or more operands 2) for one operand, returns the operand 3) return...
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
The type of an expression, extends irept.
Base class for all expressions.
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
static void validate(const exprt &, validation_modet)
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
std::size_t component_number(const irep_idt &component_name) const
Return the sequence number of the component with given name.
bool can_cast_type< pointer_typet >(const typet &type)
Check whether a reference to a typet is a pointer_typet.
static optionalt< exprt > substitute_symbols_rec(const std::map< irep_idt, exprt > &substitutions, exprt src)
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
typet & type()
Return the type of the expression.
exprt disjunction(const exprt::operandst &op)
1) generates a disjunction for two or more operands 2) for one operand, returns the operand 3) return...
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
bool has_operands() const
Return true if there is at least one operand.
const std::string & id2string(const irep_idt &d)
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
static optionalt< smt_termt > get_identifier(const exprt &expr, const std::unordered_map< exprt, smt_identifier_termt, irep_hash > &expression_handle_identifiers, const std::unordered_map< exprt, smt_identifier_termt, irep_hash > &expression_identifiers)
#define PRECONDITION(CONDITION)
const let_exprt & to_let_expr(const exprt &expr)
Cast an exprt to a let_exprt.
std::vector< symbol_exprt > variablest
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Check that the member expression has the right number of operands, refers to a component that exists ...
const irep_idt & id() const
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
A base class for variable bindings (quantifiers, let, lambda)
std::vector< exprt > operandst
The Boolean constant false.
nonstd::optional< T > optionalt
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
bool value_is_zero_string() const
exprt instantiate(const exprt::operandst &) const
substitute free occurrences of the variables in where() by the given values
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
exprt & component(const irep_idt &name, const namespacet &ns)
The Boolean constant true.
const binding_exprt & to_binding_expr(const exprt &expr)
Cast an exprt to a binding_exprt.
binding_exprt & binding()
const irep_idt & get_value() const
ranget< iteratort > make_range(iteratort begin, iteratort end)
bool can_cast_type< bitvector_typet >(const typet &type)
Check whether a reference to a typet is a bitvector_typet.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.