31 const irept &parse_tree,
32 const std::unordered_map<irep_idt, smt_identifier_termt> &identifier_table);
35template <
typename argumentt,
typename... argumentst>
40 if(
const auto messages =
argument.get_if_error())
48template <
typename argumentt,
typename... argumentst>
52 argumentst &&... arguments)
62template <
typename... argumentst>
87 typename... argumentst>
108 return parse_tree.
pretty(0, 0);
114 if(!parse_tree.
get_sub().empty())
128static std::optional<response_or_errort<smt_responset>>
132 if(!parse_tree.
id().empty())
134 if(parse_tree.
get_sub().empty())
136 if(parse_tree.
get_sub().at(0).id() !=
"error")
140 if(parse_tree.
get_sub().size() == 1)
143 {
"Error response is missing the error message."}}}};
145 if(parse_tree.
get_sub().size() > 2)
148 {
"Error response has multiple error messages - \"" +
160 [](
const irept &sub) { return sub.get_sub().size() == 2; });
165static std::optional<smt_termt>
168 if(parse_tree.
get_sub().size() != 3)
170 if(parse_tree.
get_sub().at(0).id() !=
"_")
174 static const std::regex
bv_value_regex{R
"(^bv(\d+)$)", std::regex::optimize};
179 "Match results should include digits sub-expression if regex is matched.");
183 const auto bit_width =
194 if(!parse_tree.
get_sub().empty())
210 const std::size_t width = text.size() - 2;
216 static const std::regex
hex_format{
"#x[0-9A-Za-z]+"};
219 const std::string
hex{text.begin() + 2, text.end()};
224 const std::size_t width = (text.size() - 2) * 4;
228static std::optional<smt_termt>
233 if(!parse_tree.
get_sub().empty() || parse_tree.
id().empty())
244 const irept &parse_tree,
245 const std::unordered_map<irep_idt, smt_identifier_termt> &identifier_table)
247 if(parse_tree.
get_sub().empty())
249 if(parse_tree.
get_sub()[0].id() !=
"select")
251 if(parse_tree.
get_sub().size() != 3)
254 {
"\"select\" is expected to have 2 arguments, but " +
255 std::to_string(parse_tree.
get_sub().size()) +
264 *array.get_if_valid(), *index.get_if_valid())};
268 const irept &parse_tree,
269 const std::unordered_map<irep_idt, smt_identifier_termt> &identifier_table)
275 const auto find_result = identifier_table.find(parse_tree.
id());
291 const std::unordered_map<irep_idt, smt_identifier_termt> &identifier_table)
308 {
"Mismatched descriptor and value sorts in - " +
324static std::optional<response_or_errort<smt_responset>>
326 const irept &parse_tree,
327 const std::unordered_map<irep_idt, smt_identifier_termt> &identifier_table)
330 if(!parse_tree.
id().empty())
332 if(parse_tree.
get_sub().empty())
357 const irept &parse_tree,
358 const std::unordered_map<irep_idt, smt_identifier_termt> &identifier_table)
360 if(parse_tree.
id() ==
"sat")
363 if(parse_tree.
id() ==
"unsat")
366 if(parse_tree.
id() ==
"unknown")
371 if(parse_tree.
id() ==
"success")
373 if(parse_tree.
id() ==
"unsupported")
382 {
"Invalid SMT response \"" +
id2string(parse_tree.
id()) +
"\""}}};
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
There are a large number of kinds of tree structured or tree-like data in CPROVER.
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
const irep_idt & id() const
static const smt_function_application_termt::factoryt< selectt > select
const std::string & id2string(const irep_idt &d)
const mp_integer string2integer(const std::string &n, unsigned base)
resultt
The result of goto verifying.
Ranges: pair of begin and end iterators, which can be initialized from containers,...
ranget< iteratort > make_range(iteratort begin, iteratort end)
static std::optional< smt_termt > valid_smt_bool(const irept &parse_tree)
response_or_errort< smt_responset > validate_smt_response(const irept &parse_tree, const std::unordered_map< irep_idt, smt_identifier_termt > &identifier_table)
static std::string print_parse_tree(const irept &parse_tree)
Produces a human-readable representation of the given parse_tree, for use in error messaging.
void collect_error_messages_impl(std::vector< std::string > &collected_error_messages, argumentt &&argument)
static std::optional< smt_termt > valid_smt_bit_vector_constant(const irept &parse_tree)
static std::optional< smt_termt > valid_smt_binary(const std::string &text)
static response_or_errort< smt_termt > validate_term(const irept &parse_tree, const std::unordered_map< irep_idt, smt_identifier_termt > &identifier_table)
static std::optional< smt_termt > valid_smt_hex(const std::string &text)
static bool all_subs_are_pairs(const irept &parse_tree)
std::vector< std::string > collect_error_messages(argumentst &&... arguments)
Builds a collection of error messages composed all error messages in the response_or_errort typed arg...
static std::optional< smt_termt > valid_smt_indexed_bit_vector(const irept &parse_tree)
Checks for valid bit vector constants of the form (_ bv(value) (width)) for example - (_ bv4 64).
static response_or_errort< smt_get_value_responset::valuation_pairt > validate_valuation_pair(const irept &pair_parse_tree, const std::unordered_map< irep_idt, smt_identifier_termt > &identifier_table)
static std::optional< response_or_errort< smt_responset > > valid_smt_error_response(const irept &parse_tree)
static response_or_errort< irep_idt > validate_string_literal(const irept &parse_tree)
static std::optional< response_or_errort< smt_termt > > try_select_validation(const irept &parse_tree, const std::unordered_map< irep_idt, smt_identifier_termt > &identifier_table)
static std::optional< response_or_errort< smt_responset > > valid_smt_get_value_response(const irept &parse_tree, const std::unordered_map< irep_idt, smt_identifier_termt > &identifier_table)
response_or_errort< smt_baset > validation_propagating(argumentst &&... arguments)
Given a class to construct and a set of arguments to its constructor which may include errors,...
std::string smt_to_smt2_string(const smt_indext &index)
Streaming SMT data structures to a string based output stream.
#define PRECONDITION(CONDITION)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.