CBMC
smt_commands.h
Go to the documentation of this file.
1 // Author: Diffblue Ltd.
2 
3 #ifndef CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_COMMANDS_H
4 #define CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_COMMANDS_H
5 
6 #include <util/irep.h>
7 
8 #include "smt_logics.h"
9 #include "smt_options.h"
10 #include "smt_terms.h"
11 
13 
14 class smt_commandt : protected irept
15 {
16 public:
17  // smt_commandt does not support the notion of an empty / null state. Use
18  // std::optional<smt_commandt> instead if an empty command is required.
19  smt_commandt() = delete;
20 
21  using irept::pretty;
22 
23  bool operator==(const smt_commandt &) const;
24  bool operator!=(const smt_commandt &) const;
25 
28 
29 protected:
30  using irept::irept;
31 };
32 
34  private smt_termt::storert<smt_assert_commandt>
35 {
36 public:
38  const smt_termt &condition() const;
39 };
40 
42 {
43 public:
45 };
46 
48  : public smt_commandt,
49  private smt_sortt::storert<smt_declare_function_commandt>,
50  private smt_termt::storert<smt_declare_function_commandt>
51 {
52 public:
55  std::vector<smt_sortt> parameter_sorts);
56  const smt_identifier_termt &identifier() const;
57  const smt_sortt &return_sort() const;
58  std::vector<std::reference_wrapper<const smt_sortt>> parameter_sorts() const;
59 
60 private:
63 };
64 
66  : public smt_commandt,
67  private smt_termt::storert<smt_define_function_commandt>
68 {
69 public:
72  std::vector<smt_identifier_termt> parameters,
74  const smt_identifier_termt &identifier() const;
75  std::vector<std::reference_wrapper<const smt_identifier_termt>>
76  parameters() const;
77  const smt_sortt &return_sort() const;
78  const smt_termt &definition() const;
79 };
80 
82 {
83 public:
85 };
86 
88  protected smt_termt::storert<smt_assert_commandt>
89 {
90 public:
100  const smt_termt &descriptor() const;
101 };
102 
104 {
105 public:
106  explicit smt_push_commandt(std::size_t levels);
107  size_t levels() const;
108 };
109 
111 {
112 public:
113  explicit smt_pop_commandt(std::size_t levels);
114  size_t levels() const;
115 };
116 
118  : public smt_commandt,
119  private smt_logict::storert<smt_set_logic_commandt>
120 {
121 public:
123  const smt_logict &logic() const;
124 };
125 
127  : public smt_commandt,
128  private smt_optiont::storert<smt_set_option_commandt>
129 {
130 public:
132  const smt_optiont &option() const;
133 };
134 
136 {
137 public:
138 #define COMMAND_ID(the_id) \
139  virtual void visit(const smt_##the_id##_commandt &) = 0;
140 #include "smt_commands.def"
141 #undef COMMAND_ID
142 };
143 
147 {
148 private:
149  std::vector<smt_sortt> parameter_sorts;
151 
152 public:
153  explicit smt_command_functiont(
154  const smt_declare_function_commandt &function_declaration);
155  explicit smt_command_functiont(
156  const smt_define_function_commandt &function_definition);
157  irep_idt identifier() const;
158  smt_sortt return_sort(const std::vector<smt_termt> &arguments) const;
159  void validate(const std::vector<smt_termt> &arguments) const;
160 };
161 
162 #endif // CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_COMMANDS_H
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:38
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition: irep.h:364
irept()=default
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
Definition: irep.cpp:482
smt_assert_commandt(smt_termt condition)
const smt_termt & condition() const
A function generated from a command.
Definition: smt_commands.h:147
std::vector< smt_sortt > parameter_sorts
Definition: smt_commands.h:149
irep_idt identifier() const
smt_command_functiont(const smt_declare_function_commandt &function_declaration)
smt_sortt return_sort(const std::vector< smt_termt > &arguments) const
smt_identifier_termt _identifier
Definition: smt_commands.h:150
void validate(const std::vector< smt_termt > &arguments) const
void accept(smt_command_const_downcast_visitort &) const
bool operator==(const smt_commandt &) const
bool operator!=(const smt_commandt &) const
smt_commandt()=delete
const smt_identifier_termt & identifier() const
smt_declare_function_commandt(smt_identifier_termt identifier, std::vector< smt_sortt > parameter_sorts)
const smt_sortt & return_sort() const
std::vector< std::reference_wrapper< const smt_sortt > > parameter_sorts() const
const smt_termt & definition() const
const smt_identifier_termt & identifier() const
smt_define_function_commandt(irep_idt identifier, std::vector< smt_identifier_termt > parameters, smt_termt definition)
std::vector< std::reference_wrapper< const smt_identifier_termt > > parameters() const
const smt_sortt & return_sort() const
const smt_termt & descriptor() const
smt_get_value_commandt(smt_termt descriptor)
This constructor constructs the get-value command, such that it stores a single descriptor for which ...
Stores identifiers in unescaped and unquoted form.
Definition: smt_terms.h:93
Class for adding the ability to up and down cast smt_logict to and from irept.
Definition: smt_logics.h:32
Class for adding the ability to up and down cast smt_optiont to and from irept.
Definition: smt_options.h:32
size_t levels() const
smt_pop_commandt(std::size_t levels)
size_t levels() const
smt_push_commandt(std::size_t levels)
const smt_logict & logic() const
smt_set_logic_commandt(smt_logict logic)
smt_set_option_commandt(smt_optiont option)
const smt_optiont & option() const
Class for adding the ability to up and down cast smt_sortt to and from irept.
Definition: smt_sorts.h:39
Class for adding the ability to up and down cast smt_termt to and from irept.
Definition: smt_terms.h:44