Skip to content

Commit 3b3830a

Browse files
committed
Expand detection of background theory
1 parent cad6516 commit 3b3830a

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

src/bin/golem.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@ std::string tryDetectLogic(ASTNode const * root) {
1616
auto const & children = *(root->children);
1717
bool hasReals = false;
1818
bool hasIntegers = false;
19-
unsigned short examined = 0;
20-
constexpr unsigned short limit = 5;
21-
auto decide = [&] {
22-
if (hasReals ^ hasIntegers) {
23-
return hasReals ? "QF_LRA" : "QF_LIA";
24-
}
25-
return "";
19+
bool hasArrays = false;
20+
auto decide = [&]() -> std::string {
21+
if (hasReals and hasIntegers) { return ""; }
22+
return std::string("QF_") + (hasArrays ? "A" : "") + "L" + (hasIntegers ? "I" : "R") + "A";
2623
};
2724
for (ASTNode * child : children) {
2825
const tokens::smt2token token = child->getToken();
@@ -34,14 +31,22 @@ std::string tryDetectLogic(ASTNode const * root) {
3431
ASTNode const & args_node = **(it++);
3532
ASTNode const & ret_node = **(it++); (void)ret_node;
3633
assert(it == child->children->end());
37-
for (auto argNode : *(args_node.children)) {
34+
auto checkForRealsAndInts = [&](ASTNode const * const node) {
35+
hasReals = hasReals or strcmp(node->getValue(), "Real") == 0;
36+
hasIntegers = hasIntegers or strcmp(node->getValue(), "Int") == 0;
37+
};
38+
for (ASTNode const * const argNode : *(args_node.children)) {
3839
if (argNode->getType() == SYM_T) {
39-
hasReals = hasReals or strcmp(argNode->getValue(), "Real") == 0;
40-
hasIntegers = hasIntegers or strcmp(argNode->getValue(), "Int") == 0;
40+
checkForRealsAndInts(argNode);
41+
} else if (argNode->getType() == LID_T and argNode->children) {
42+
for (ASTNode const * const node : *(argNode->children)) {
43+
if (node->getType() == SYM_T) {
44+
hasArrays = hasArrays or strcmp(node->getValue(), "Array") == 0;
45+
checkForRealsAndInts(node);
46+
}
47+
}
4148
}
4249
}
43-
++examined;
44-
if (examined == limit) { return decide(); }
4550
break;
4651
}
4752
case tokens::t_assert:

0 commit comments

Comments
 (0)