cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
smt_core_theory.cpp
Go to the documentation of this file.
1
// Author: Diffblue Ltd.
2
3
#include "
smt_core_theory.h
"
4
5
const
char
*
smt_core_theoryt::nott::identifier
()
6
{
7
return
"not"
;
8
}
9
10
smt_sortt
smt_core_theoryt::nott::return_sort
(
const
smt_termt
&operand)
11
{
12
return
smt_bool_sortt
{};
13
}
14
15
void
smt_core_theoryt::nott::validate
(
const
smt_termt
&operand)
16
{
17
INVARIANT
(
18
operand.
get_sort
() ==
smt_bool_sortt
{},
19
"\"not\" may only be applied to terms which have bool sort."
);
20
}
21
22
const
smt_function_application_termt::factoryt<smt_core_theoryt::nott>
23
smt_core_theoryt::make_not
{};
24
25
const
char
*
smt_core_theoryt::impliest::identifier
()
26
{
27
return
"=>"
;
28
}
29
30
smt_sortt
31
smt_core_theoryt::impliest::return_sort
(
const
smt_termt
&,
const
smt_termt
&)
32
{
33
return
smt_bool_sortt
{};
34
}
35
36
void
smt_core_theoryt::impliest::validate
(
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
48
const
smt_function_application_termt::factoryt<smt_core_theoryt::impliest>
49
smt_core_theoryt::implies
{};
50
51
const
char
*
smt_core_theoryt::andt::identifier
()
52
{
53
return
"and"
;
54
}
55
56
smt_sortt
57
smt_core_theoryt::andt::return_sort
(
const
smt_termt
&,
const
smt_termt
&)
58
{
59
return
smt_bool_sortt
{};
60
}
61
62
void
smt_core_theoryt::andt::validate
(
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
74
const
smt_function_application_termt::factoryt<smt_core_theoryt::andt>
75
smt_core_theoryt::make_and
{};
76
77
const
char
*
smt_core_theoryt::ort::identifier
()
78
{
79
return
"or"
;
80
}
81
82
smt_sortt
83
smt_core_theoryt::ort::return_sort
(
const
smt_termt
&,
const
smt_termt
&)
84
{
85
return
smt_bool_sortt
{};
86
}
87
88
void
smt_core_theoryt::ort::validate
(
const
smt_termt
&lhs,
const
smt_termt
&rhs)
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
98
const
smt_function_application_termt::factoryt<smt_core_theoryt::ort>
99
smt_core_theoryt::make_or
{};
100
101
const
char
*
smt_core_theoryt::xort::identifier
()
102
{
103
return
"xor"
;
104
}
105
106
smt_sortt
107
smt_core_theoryt::xort::return_sort
(
const
smt_termt
&,
const
smt_termt
&)
108
{
109
return
smt_bool_sortt
{};
110
}
111
112
void
smt_core_theoryt::xort::validate
(
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
124
const
smt_function_application_termt::factoryt<smt_core_theoryt::xort>
125
smt_core_theoryt::make_xor
{};
126
127
const
char
*
smt_core_theoryt::equalt::identifier
()
128
{
129
return
"="
;
130
}
131
132
smt_sortt
133
smt_core_theoryt::equalt::return_sort
(
const
smt_termt
&,
const
smt_termt
&)
134
{
135
return
smt_bool_sortt
{};
136
}
137
138
void
smt_core_theoryt::equalt::validate
(
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
147
const
smt_function_application_termt::factoryt<smt_core_theoryt::equalt>
148
smt_core_theoryt::equal
{};
149
150
const
char
*
smt_core_theoryt::distinctt::identifier
()
151
{
152
return
"distinct"
;
153
}
154
155
smt_sortt
156
smt_core_theoryt::distinctt::return_sort
(
const
smt_termt
&,
const
smt_termt
&)
157
{
158
return
smt_bool_sortt
{};
159
}
160
161
void
smt_core_theoryt::distinctt::validate
(
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
170
const
smt_function_application_termt::factoryt<smt_core_theoryt::distinctt>
171
smt_core_theoryt::distinct
{};
172
173
const
char
*
smt_core_theoryt::if_then_elset::identifier
()
174
{
175
return
"ite"
;
176
}
177
178
smt_sortt
smt_core_theoryt::if_then_elset::return_sort
(
179
const
smt_termt
&,
180
const
smt_termt
&then_term,
181
const
smt_termt
&)
182
{
183
return
then_term.
get_sort
();
184
}
185
186
void
smt_core_theoryt::if_then_elset::validate
(
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
199
const
smt_function_application_termt::factoryt<smt_core_theoryt::if_then_elset>
200
smt_core_theoryt::if_then_else
;
smt_bool_sortt
Definition
smt_sorts.h:78
smt_core_theoryt::distinct
static const smt_function_application_termt::factoryt< distinctt > distinct
Makes applications of the function which returns true iff its two arguments are not identical.
Definition
smt_core_theory.h:171
smt_core_theoryt::if_then_else
static const smt_function_application_termt::factoryt< if_then_elset > if_then_else
Definition
smt_core_theory.h:82
smt_core_theoryt::implies
static const smt_function_application_termt::factoryt< impliest > implies
Definition
smt_core_theory.h:49
smt_core_theoryt::make_or
static const smt_function_application_termt::factoryt< ort > make_or
Definition
smt_core_theory.h:99
smt_core_theoryt::equal
static const smt_function_application_termt::factoryt< equalt > equal
Definition
smt_core_theory.h:148
smt_core_theoryt::make_and
static const smt_function_application_termt::factoryt< andt > make_and
Definition
smt_core_theory.h:75
smt_core_theoryt::make_xor
static const smt_function_application_termt::factoryt< xort > make_xor
Definition
smt_core_theory.h:125
smt_core_theoryt::make_not
static const smt_function_application_termt::factoryt< nott > make_not
Definition
smt_core_theory.h:23
smt_function_application_termt::factoryt
Definition
smt_terms.h:173
smt_sortt
Definition
smt_sorts.h:18
smt_termt
Definition
smt_terms.h:21
smt_termt::get_sort
const smt_sortt & get_sort() const
Definition
smt_terms.cpp:36
smt_core_theory.h
INVARIANT
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
Definition
invariant.h:423
smt_core_theoryt::andt::validate
static void validate(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:62
smt_core_theoryt::andt::identifier
static const char * identifier()
Definition
smt_core_theory.cpp:51
smt_core_theoryt::andt::return_sort
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:57
smt_core_theoryt::distinctt::return_sort
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:156
smt_core_theoryt::distinctt::validate
static void validate(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:161
smt_core_theoryt::distinctt::identifier
static const char * identifier()
Definition
smt_core_theory.cpp:150
smt_core_theoryt::equalt::identifier
static const char * identifier()
Definition
smt_core_theory.cpp:127
smt_core_theoryt::equalt::return_sort
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:133
smt_core_theoryt::equalt::validate
static void validate(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:138
smt_core_theoryt::if_then_elset::validate
static void validate(const smt_termt &condition, const smt_termt &then_term, const smt_termt &else_term)
Definition
smt_core_theory.cpp:186
smt_core_theoryt::if_then_elset::identifier
static const char * identifier()
Definition
smt_core_theory.cpp:173
smt_core_theoryt::if_then_elset::return_sort
static smt_sortt return_sort(const smt_termt &condition, const smt_termt &then_term, const smt_termt &else_term)
Definition
smt_core_theory.cpp:178
smt_core_theoryt::impliest::return_sort
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:31
smt_core_theoryt::impliest::identifier
static const char * identifier()
Definition
smt_core_theory.cpp:25
smt_core_theoryt::impliest::validate
static void validate(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:36
smt_core_theoryt::nott::return_sort
static smt_sortt return_sort(const smt_termt &operand)
Definition
smt_core_theory.cpp:10
smt_core_theoryt::nott::validate
static void validate(const smt_termt &operand)
Definition
smt_core_theory.cpp:15
smt_core_theoryt::nott::identifier
static const char * identifier()
Definition
smt_core_theory.cpp:5
smt_core_theoryt::ort::validate
static void validate(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:88
smt_core_theoryt::ort::identifier
static const char * identifier()
Definition
smt_core_theory.cpp:77
smt_core_theoryt::ort::return_sort
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:83
smt_core_theoryt::xort::identifier
static const char * identifier()
Definition
smt_core_theory.cpp:101
smt_core_theoryt::xort::validate
static void validate(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:112
smt_core_theoryt::xort::return_sort
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs)
Definition
smt_core_theory.cpp:107
solvers
smt2_incremental
theories
smt_core_theory.cpp
Generated by
1.17.0