100 std::vector<std::reference_wrapper<const smt_identifier_termt>>
identifiers;
128 template <
typename elementt>
130 const std::vector<std::reference_wrapper<const elementt>> &output);
134 template <
typename outputt>
151 template <
typename outputt,
typename... outputst>
152 void push_outputs(outputt &&output, outputst &&... outputs);
175 return [output](std::ostream &os) { os << output; };
181 return [=](std::ostream &os) { os << output; };
187 return [=](std::ostream &os) { os << output; };
193 return [=](std::ostream &os) { output.
accept(*
this); };
196 template <
typename elementt>
199 const std::vector<std::reference_wrapper<const elementt>> &outputs)
201 return [=](std::ostream &os) {
202 for(
const auto &output :
make_range(outputs.rbegin(), outputs.rend()))
213 return [=](std::ostream &os) {
214 const auto push_sorted_variable =
216 push_outputs(
"(", identifier,
" ", identifier.get_sort(),
")");
218 for(
const auto &bound_variable :
221 push_sorted_variable(bound_variable);
228 template <
typename outputt>
238 template <
typename outputt,
typename... outputst>
241 outputst &&... outputs)
256 auto indices = identifier_term.
indices();
264 push_outputs(
"(_ ", std::move(escaped_identifier), std::move(indices),
")");
273 push_outputs(
"(_ bv", std::move(value),
" ", std::move(bit_width),
")");
280 auto arguments = function_application.
arguments();
288 push_outputs(
"(forall (", bound_variables,
") ", std::move(predicate),
")");
294 auto predicate =
exists.predicate();
295 push_outputs(
"(exists (", bound_variables,
") ", std::move(predicate),
")");
319 std::stringstream ss;
337 os <<
":produce-models " << (produce_models.
setting() ?
"true" :
"false");
349 std::stringstream ss;
364 #define LOGIC_ID(the_id, the_name) \
365 void visit(const smt_logic_##the_id##t &) override \
369 #include "solvers/smt2_incremental/ast/smt_logics.def"
382 std::stringstream ss;
412 join_strings(
os, parameter_sorts.begin(), parameter_sorts.end(),
' ');
418 os <<
"(define-fun " << define_function.
identifier() <<
" (";
419 const auto parameters = define_function.
parameters();
426 return
"(" + smt_to_smt2_string(identifier) +
" " +
427 smt_to_smt2_string(identifier.get_sort()) +
")";
445 os <<
"(pop " << pop.
levels() <<
")";
450 os <<
"(push " << push.
levels() <<
")";
455 os <<
"(set-logic " << set_logic.
logic() <<
")";
460 os <<
"(set-option " << set_option.
option() <<
")";
472 std::stringstream ss;
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
static std::string convert_identifier(const irep_idt &identifier)
const smt_sortt & element_sort() const
const smt_sortt & index_sort() const
const smt_termt & condition() const
const smt_bit_vector_sortt & get_sort() const
std::size_t bit_width() const
void visit(const smt_declare_function_commandt &declare_function) override
smt_command_to_string_convertert(std::ostream &os)
void visit(const smt_pop_commandt &pop) override
void visit(const smt_assert_commandt &assert) override
void visit(const smt_exit_commandt &exit) override
void visit(const smt_get_value_commandt &get_value) override
void visit(const smt_define_function_commandt &define_function) override
void visit(const smt_set_option_commandt &set_option) override
void visit(const smt_set_logic_commandt &set_logic) override
void visit(const smt_push_commandt &push) override
void visit(const smt_check_sat_commandt &check_sat) override
void accept(smt_command_const_downcast_visitort &) const
const smt_termt & definition() const
const smt_identifier_termt & identifier() const
std::vector< std::reference_wrapper< const smt_identifier_termt > > parameters() const
const smt_sortt & return_sort() const
const smt_termt & predicate() const
std::vector< std::reference_wrapper< const smt_identifier_termt > > bound_variables() const
const smt_identifier_termt & function_identifier() const
std::vector< std::reference_wrapper< const smt_termt > > arguments() const
const smt_termt & descriptor() const
Stores identifiers in unescaped and unquoted form.
irep_idt identifier() const
std::vector< std::reference_wrapper< const smt_indext > > indices() const
void visit(const smt_numeral_indext &numeral) override
void visit(const smt_symbol_indext &symbol) override
smt_index_output_visitort(std::ostream &os)
For implementation of indexed identifiers.
void accept(smt_index_const_downcast_visitort &) const
smt_logic_to_string_convertert(std::ostream &os)
void accept(smt_logic_const_downcast_visitort &) const
std::size_t value() const
void visit(const smt_option_produce_modelst &produce_models) override
smt_option_to_string_convertert(std::ostream &os)
void accept(smt_option_const_downcast_visitort &) const
const smt_logict & logic() const
const smt_optiont & option() const
smt_sort_output_visitort(std::ostream &os)
void visit(const smt_array_sortt &array) override
void visit(const smt_bit_vector_sortt &bit_vec) override
void visit(const smt_bool_sortt &) override
void accept(smt_sort_const_downcast_visitort &) const
irep_idt identifier() const
void visit(const smt_bool_literal_termt &bool_literal) override
void push_output(outputt &&output)
Single argument version of push_outputs.
std::function< void(std::ostream &)> output_functiont
static output_functiont make_output_function(const std::string &output)
void push_outputs()
Base case for the recursive push_outputs function template below.
std::stack< output_functiont > output_stack
smt_term_to_string_convertert()=default
static std::ostream & convert(std::ostream &os, const smt_termt &term)
This function is complete the external interface to this class.
void accept(smt_term_const_downcast_visitort &) const
static auxiliary_symbolt declare_function(const irep_idt &function_name, const mathematical_function_typet &type, symbol_table_baset &symbol_table)
Declare a function with the given name and type.
mini_bddt exists(const mini_bddt &u, const unsigned var)
const std::string integer2string(const mp_integer &n, unsigned base)
Ranges: pair of begin and end iterators, which can be initialized from containers,...
ranget< iteratort > make_range(iteratort begin, iteratort end)
Data structure for smt sorts.
std::string smt_to_smt2_string(const smt_indext &index)
std::ostream & operator<<(std::ostream &os, const smt_indext &index)
static std::string escape_identifier(const irep_idt &identifier)
Streaming SMT data structures to a string based output stream.
void output_function(std::ostream &os, const statement_list_parse_treet::functiont &function)
Prints the given Statement List function in a human-readable form to the given output stream.
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
Stream & join_strings(Stream &&os, const It b, const It e, const Delimiter &delimiter, TransformFunc &&transform_func)
Prints items to an stream, separated by a constant delimiter.
std::vector< std::reference_wrapper< const smt_identifier_termt > > identifiers