summaryrefslogtreecommitdiff
path: root/src/parser/tptp/Tptp.g
diff options
context:
space:
mode:
authormudathirmahgoub <mudathirmahgoub@gmail.com>2020-10-29 13:26:51 -0500
committerGitHub <noreply@github.com>2020-10-29 13:26:51 -0500
commitd23ba1433846b9baaf6149137aa999c1af60c516 (patch)
treeb75389566b726edcaf32cb0f8ab2059bba9e1528 /src/parser/tptp/Tptp.g
parent6898ab93a3858e78b20af38e537fe48ee9140c58 (diff)
Add mkInteger to the API (#5274)
This PR adds mkInteger to the API and update mkReal to ensure that the returned term has real sort. The parsers are modified to parse numbers like "0" "5" as integers and "0.0" and "15.0" as reals. This means subtyping is effectively eliminated from all theories except arithmetic. Other changes: Term::isValue is removed which was introduced to support parsing for constant arrays. It is no longer needed after this PR. Benchmarks are updated to match the changes in the parsers Co-authored-by: Andrew Reynolds andrew-reynolds@uiowa.edu
Diffstat (limited to 'src/parser/tptp/Tptp.g')
-rw-r--r--src/parser/tptp/Tptp.g16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/parser/tptp/Tptp.g b/src/parser/tptp/Tptp.g
index b99376685..8e29c25f1 100644
--- a/src/parser/tptp/Tptp.g
+++ b/src/parser/tptp/Tptp.g
@@ -477,7 +477,7 @@ definedPred[CVC4::ParseOp& p]
api::Term body =
MK_TERM(api::AND,
MK_TERM(api::NOT,
- MK_TERM(api::EQUAL, r, SOLVER->mkReal(0))),
+ MK_TERM(api::EQUAL, r, SOLVER->mkInteger(0))),
MK_TERM(api::EQUAL, qr, MK_TERM(api::MULT, n, rr)));
api::Term bvl = MK_TERM(api::BOUND_VAR_LIST, q, r);
body = MK_TERM(api::EXISTS, bvl, body);
@@ -537,7 +537,7 @@ thfDefinedPred[CVC4::ParseOp& p]
api::Term body = MK_TERM(
api::AND,
MK_TERM(api::NOT,
- MK_TERM(api::EQUAL, r, SOLVER->mkReal(0))),
+ MK_TERM(api::EQUAL, r, SOLVER->mkInteger(0))),
MK_TERM(api::EQUAL, qr, MK_TERM(api::MULT, n, rr)));
api::Term bvl = MK_TERM(api::BOUND_VAR_LIST, q, r);
body = MK_TERM(api::EXISTS, bvl, body);
@@ -708,7 +708,7 @@ definedFun[CVC4::ParseOp& p]
n,
SOLVER->mkReal(2)),
SOLVER->mkReal(1, 2))),
- SOLVER->mkReal(2))));
+ SOLVER->mkInteger(2))));
p.d_kind = api::LAMBDA;
p.d_expr = MK_TERM(api::LAMBDA, formals, expr);
}
@@ -1747,7 +1747,15 @@ NUMBER
: ( SIGN[pos]? num=DECIMAL
{ std::stringstream ss;
ss << ( pos ? "" : "-" ) << AntlrInput::tokenText($num);
- PARSER_STATE->d_tmp_expr = SOLVER->mkReal(ss.str());
+ std::string str = ss.str();
+ if (str.find(".") == std::string::npos)
+ {
+ PARSER_STATE->d_tmp_expr = SOLVER->mkInteger(str);
+ }
+ else
+ {
+ PARSER_STATE->d_tmp_expr = SOLVER->mkReal(str);
+ }
}
| SIGN[pos]? num=DECIMAL DOT den=DECIMAL (EXPONENT SIGN[posE]? e=DECIMAL)?
{
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback