summaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2019-11-04 14:24:02 -0600
committerGitHub <noreply@github.com>2019-11-04 14:24:02 -0600
commit9ca190a3a2f7f952e1452efb69c78803ec302dd6 (patch)
tree6581bc7bbb2b40a82ac65abf88d7b0c8610ef14f /src/parser
parent9a2913c2f1a22ed43ed772467ec42ba2262bee17 (diff)
Avoid non-well-founded sygus grammars (#3434)
Diffstat (limited to 'src/parser')
-rw-r--r--src/parser/smt2/Smt2.g28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/parser/smt2/Smt2.g b/src/parser/smt2/Smt2.g
index 0cce030b0..a5033278d 100644
--- a/src/parser/smt2/Smt2.g
+++ b/src/parser/smt2/Smt2.g
@@ -1054,21 +1054,21 @@ sygusGrammar[CVC4::Type & ret,
// grammar. This results in the error below.
// We can also be in a case where the only rule specified was
// (Constant T), in which case we have not yet added a constructor. We
- // ensure an arbitrary constant is added in this case.
- if (datatypes[i].getNumConstructors() == 0)
+ // ensure an arbitrary constant is added in this case. We additionally
+ // add a constant if the grammar allows it regardless of whether the
+ // datatype has other constructors, since this ensures the datatype is
+ // well-founded (see 3423).
+ if (aci)
{
- if (aci)
- {
- Expr c = btt.mkGroundTerm();
- PARSER_STATE->addSygusConstructorTerm(datatypes[i], c, ntsToUnres);
- }
- else
- {
- std::stringstream se;
- se << "Grouped rule listing for " << datatypes[i].getName()
- << " produced an empty rule list.";
- PARSER_STATE->parseError(se.str());
- }
+ Expr c = btt.mkGroundTerm();
+ PARSER_STATE->addSygusConstructorTerm(datatypes[i], c, ntsToUnres);
+ }
+ else if (datatypes[i].getNumConstructors() == 0)
+ {
+ std::stringstream se;
+ se << "Grouped rule listing for " << datatypes[i].getName()
+ << " produced an empty rule list.";
+ PARSER_STATE->parseError(se.str());
}
}
// pop scope from the pre-declaration
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback