summaryrefslogtreecommitdiff
path: root/src/theory/quantifiers
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2020-03-23 13:30:48 -0500
committerGitHub <noreply@github.com>2020-03-23 13:30:48 -0500
commitdd515b59583cba1afed8fbb583f8012a214feaad (patch)
treee808f4ac62becd2b725c1e870f1020f7b7de4dd8 /src/theory/quantifiers
parent85121a067789d9c6ac7ff14c3e34a2bc5aa83d24 (diff)
Throw exception for non-well-founded unimplemented SyGuS types. (#4125)
Fixes #3931. Currently we print a warning for unimplemented types when constructing default SyGuS grammars. We should additionally throw an exception when the unimplemented type would lead to a non-well-founded datatype.
Diffstat (limited to 'src/theory/quantifiers')
-rw-r--r--src/theory/quantifiers/sygus/sygus_grammar_cons.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp b/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp
index bfb6c0f39..d33c72ede 100644
--- a/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp
+++ b/src/theory/quantifiers/sygus/sygus_grammar_cons.cpp
@@ -682,14 +682,6 @@ void CegGrammarConstructor::mkSygusDefaultGrammar(
sdts[i].addConstructor(consts[j], ss.str(), cargsEmpty);
}
}
- // ITE
- Kind k = ITE;
- Trace("sygus-grammar-def") << "...add for " << k << std::endl;
- std::vector<TypeNode> cargsIte;
- cargsIte.push_back(unres_bt);
- cargsIte.push_back(unres_t);
- cargsIte.push_back(unres_t);
- sdts[i].addConstructor(k, cargsIte);
if (types[i].isReal())
{
@@ -898,6 +890,26 @@ void CegGrammarConstructor::mkSygusDefaultGrammar(
<< "Warning: No implementation for default Sygus grammar of type "
<< types[i] << std::endl;
}
+
+ if (sdts[i].d_sdt.getNumConstructors() == 0)
+ {
+ // if there are no constructors yet by this point, we cannot make
+ // datatype, which can happen e.g. for unimplemented types
+ // that have no variables in the argument list of the
+ // function-to-synthesize.
+ std::stringstream ss;
+ ss << "Cannot make default grammar for " << types[i];
+ throw LogicException(ss.str());
+ }
+
+ // always add ITE
+ Kind k = ITE;
+ Trace("sygus-grammar-def") << "...add for " << k << std::endl;
+ std::vector<TypeNode> cargsIte;
+ cargsIte.push_back(unres_bt);
+ cargsIte.push_back(unres_t);
+ cargsIte.push_back(unres_t);
+ sdts[i].addConstructor(k, cargsIte);
}
std::map<TypeNode, unsigned>::iterator itgat;
// initialize the datatypes (except for the last one, reserved for Bool)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback