CBMC
smt_core_theory.cpp
Go to the documentation of this file.
1 // Author: Diffblue Ltd.
2 
3 #include "smt_core_theory.h"
4 
6 {
7  return "not";
8 }
9 
11 {
12  return smt_bool_sortt{};
13 }
14 
16 {
17  INVARIANT(
18  operand.get_sort() == smt_bool_sortt{},
19  "\"not\" may only be applied to terms which have bool sort.");
20 }
21 
24 
26 {
27  return "=>";
28 }
29 
32 {
33  return smt_bool_sortt{};
34 }
35 
37  const smt_termt &lhs,
38  const smt_termt &rhs)
39 {
40  INVARIANT(
41  lhs.get_sort() == smt_bool_sortt{},
42  "Left hand side of \"=>\" must have bool sort.");
43  INVARIANT(
44  rhs.get_sort() == smt_bool_sortt{},
45  "Right hand side of \"=>\" must have bool sort.");
46 }
47 
50 
52 {
53  return "and";
54 }
55 
58 {
59  return smt_bool_sortt{};
60 }
61 
63  const smt_termt &lhs,
64  const smt_termt &rhs)
65 {
66  INVARIANT(
67  lhs.get_sort() == smt_bool_sortt{},
68  "Left hand side of \"and\" must have bool sort.");
69  INVARIANT(
70  rhs.get_sort() == smt_bool_sortt{},
71  "Right hand side of \"and\" must have bool sort.");
72 }
73 
76 
78 {
79  return "or";
80 }
81 
84 {
85  return smt_bool_sortt{};
86 }
87 
89 {
90  INVARIANT(
91  lhs.get_sort() == smt_bool_sortt{},
92  "Left hand side of \"or\" must have bool sort.");
93  INVARIANT(
94  rhs.get_sort() == smt_bool_sortt{},
95  "Right hand side of \"or\" must have bool sort.");
96 }
97 
100 
102 {
103  return "xor";
104 }
105 
106 smt_sortt
108 {
109  return smt_bool_sortt{};
110 }
111 
113  const smt_termt &lhs,
114  const smt_termt &rhs)
115 {
116  INVARIANT(
117  lhs.get_sort() == smt_bool_sortt{},
118  "Left hand side of \"xor\" must have bool sort.");
119  INVARIANT(
120  rhs.get_sort() == smt_bool_sortt{},
121  "Right hand side of \"xor\" must have bool sort.");
122 }
123 
126 
128 {
129  return "=";
130 }
131 
132 smt_sortt
134 {
135  return smt_bool_sortt{};
136 }
137 
139  const smt_termt &lhs,
140  const smt_termt &rhs)
141 {
142  INVARIANT(
143  lhs.get_sort() == rhs.get_sort(),
144  "\"=\" may only be applied to terms which have the same sort.");
145 }
146 
149 
151 {
152  return "distinct";
153 }
154 
155 smt_sortt
157 {
158  return smt_bool_sortt{};
159 }
160 
162  const smt_termt &lhs,
163  const smt_termt &rhs)
164 {
165  INVARIANT(
166  lhs.get_sort() == rhs.get_sort(),
167  "\"distinct\" may only be applied to terms which have the same sort.");
168 }
169 
172 
174 {
175  return "ite";
176 }
177 
179  const smt_termt &,
180  const smt_termt &then_term,
181  const smt_termt &)
182 {
183  return then_term.get_sort();
184 }
185 
187  const smt_termt &condition,
188  const smt_termt &then_term,
189  const smt_termt &else_term)
190 {
191  INVARIANT(
192  condition.get_sort() == smt_bool_sortt{},
193  "Condition term must have bool sort.");
194  INVARIANT(
195  then_term.get_sort() == else_term.get_sort(),
196  "\"ite\" must have \"then\" and \"else\" terms of the same sort.");
197 }
198 
static const smt_function_application_termt::factoryt< distinctt > distinct
Makes applications of the function which returns true iff its two arguments are not identical.
static const smt_function_application_termt::factoryt< if_then_elset > if_then_else
static const smt_function_application_termt::factoryt< impliest > implies
static const smt_function_application_termt::factoryt< ort > make_or
static const smt_function_application_termt::factoryt< equalt > equal
static const smt_function_application_termt::factoryt< andt > make_and
static const smt_function_application_termt::factoryt< xort > make_xor
static const smt_function_application_termt::factoryt< nott > make_not
const smt_sortt & get_sort() const
Definition: smt_terms.cpp:36
static void validate(const smt_termt &lhs, const smt_termt &rhs)
static const char * identifier()
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)
static void validate(const smt_termt &lhs, const smt_termt &rhs)
static const char * identifier()
static const char * identifier()
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)
static void validate(const smt_termt &lhs, const smt_termt &rhs)
static void validate(const smt_termt &condition, const smt_termt &then_term, const smt_termt &else_term)
static const char * identifier()
static smt_sortt return_sort(const smt_termt &condition, const smt_termt &then_term, const smt_termt &else_term)
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)
static const char * identifier()
static void validate(const smt_termt &lhs, const smt_termt &rhs)
static smt_sortt return_sort(const smt_termt &operand)
static void validate(const smt_termt &operand)
static const char * identifier()
static void validate(const smt_termt &lhs, const smt_termt &rhs)
static const char * identifier()
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)
static const char * identifier()
static void validate(const smt_termt &lhs, const smt_termt &rhs)
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)