24 const exprt &return_code,
25 const std::vector<exprt> &fun_args,
30 const auto arg1 = expr_checked_cast<struct_exprt>(fun_args[2]);
32 const auto arg2 = expr_checked_cast<struct_exprt>(fun_args[4]);
35 args.push_back(fun_args[3]);
36 args.insert(
args.end(), fun_args.begin() + 5, fun_args.end());
40 const std::vector<mp_integer> &input1_value,
41 const std::vector<mp_integer> &input2_value,
42 const std::vector<mp_integer> &args_value)
const
44 PRECONDITION(args_value.size() >= 1 && args_value.size() <= 3);
45 const auto offset = std::min(
47 const auto start = args_value.size() > 1
51 const mp_integer input2_size(input2_value.size());
54 ? std::max(std::min(args_value[2], input2_size),
mp_integer(0))
57 std::vector<mp_integer> eval_result(input1_value);
59 eval_result.begin() + numeric_cast_v<std::size_t>(offset),
60 input2_value.begin() + numeric_cast_v<std::size_t>(start),
61 input2_value.begin() + numeric_cast_v<std::size_t>(end));
66 const std::function<
exprt(
const exprt &)> &get_value)
const
70 if(!input2_value.has_value() || !input1_value.has_value())
73 std::vector<mp_integer> arg_values;
74 const auto &insert = std::back_inserter(arg_values);
78 if(const auto val = numeric_cast<mp_integer>(get_value(e)))
83 const auto result_value =
eval(*input1_value, *input2_value, arg_values);
static abstract_object_pointert transform(const exprt &expr, const std::vector< abstract_object_pointert > &operands, const abstract_environmentt &environment, const namespacet &ns)
Correspondance between arrays and pointers string representations.
exprt get_or_create_length(const array_string_exprt &s)
Get the length of an array_string_exprt from the array_pool.
array_string_exprt find(const exprt &pointer, const exprt &length)
Creates a new array if the pointer is not pointing to an array.
const typet & length_type() const
Base class for all expressions.
typet & type()
Return the type of the expression.
The plus expression Associativity is not specified.
Base class for string functions that are built in the solver.
symbol_generatort fresh_symbol
string_constraintst constraints(string_constraint_generatort &generator, message_handlert &message_handler) const override
Constraints ensuring the result corresponds to input1 where we inserted input2 at position offset giv...
string_insertion_builtin_functiont(const exprt &return_code, const std::vector< exprt > &fun_args, array_poolt &array_pool)
Constructor from arguments of a function application.
exprt length_constraint() const override
array_string_exprt input1
array_string_exprt result
array_string_exprt input2
virtual std::vector< mp_integer > eval(const std::vector< mp_integer > &input1_value, const std::vector< mp_integer > &input2_value, const std::vector< mp_integer > &args_value) const
Evaluate the result from a concrete valuation of the arguments.
std::vector< exprt > args
Expression to hold a symbol (variable)
const typet & subtype() const
The type of an expression, extends irept.
#define PRECONDITION(CONDITION)
static array_string_exprt make_string(Iter begin, Iter end, const array_typet &array_type)
std::optional< std::vector< mp_integer > > eval_string(const array_string_exprt &a, const std::function< exprt(const exprt &)> &get_value)
Given a function get_value which gives a valuation to expressions, attempt to find the current value ...
exprt maximum(const exprt &a, const exprt &b)
exprt minimum(const exprt &a, const exprt &b)
exprt zero_if_negative(const exprt &expr)
Returns a non-negative version of the argument.
signedbv_typet get_return_code_type()
Collection of constraints of different types: existential formulas, universal formulas,...
std::vector< exprt > existential
std::vector< string_constraintt > universal
const type_with_subtypet & to_type_with_subtype(const typet &type)