summaryrefslogtreecommitdiff
path: root/src/parser/tptp/Tptp.g
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/tptp/Tptp.g')
-rw-r--r--src/parser/tptp/Tptp.g22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/parser/tptp/Tptp.g b/src/parser/tptp/Tptp.g
index 54e9b0b4a..758198e0d 100644
--- a/src/parser/tptp/Tptp.g
+++ b/src/parser/tptp/Tptp.g
@@ -4,7 +4,7 @@
** Top contributors (to current version):
** Francois Bobot, Morgan Deters, Andrew Reynolds
** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS
+ ** Copyright (c) 2009-2019 by the authors listed in the file AUTHORS
** in the top-level source directory) and their institutional affiliations.
** All rights reserved. See the file COPYING in the top-level source
** directory for licensing information.\endverbatim
@@ -352,10 +352,24 @@ definedPred[CVC4::Expr& expr]
| '$lesseq' { expr = EXPR_MANAGER->operatorOf(CVC4::kind::LEQ); }
| '$greater' { expr = EXPR_MANAGER->operatorOf(CVC4::kind::GT); }
| '$greatereq' { expr = EXPR_MANAGER->operatorOf(CVC4::kind::GEQ); }
- | '$is_rat' // all "real" are actually "rat" in CVC4
+ | '$is_rat'
+ // a real n is a rational if there exists q,r integers such that
+ // to_real(q) = n*to_real(r),
+ // where r is non-zero.
{ Expr n = EXPR_MANAGER->mkBoundVar("N", EXPR_MANAGER->realType());
- n = MK_EXPR(CVC4::kind::BOUND_VAR_LIST, n);
- expr = MK_EXPR(CVC4::kind::LAMBDA, n, MK_CONST(bool(true)));
+ Expr q = EXPR_MANAGER->mkBoundVar("Q", EXPR_MANAGER->integerType());
+ Expr qr = MK_EXPR(CVC4::kind::TO_REAL, q);
+ Expr r = EXPR_MANAGER->mkBoundVar("R", EXPR_MANAGER->integerType());
+ Expr rr = MK_EXPR(CVC4::kind::TO_REAL, r);
+ Expr body =
+ MK_EXPR(CVC4::kind::AND,
+ MK_EXPR(CVC4::kind::NOT,
+ MK_EXPR(CVC4::kind::EQUAL, r, MK_CONST(Rational(0)))),
+ MK_EXPR(CVC4::kind::EQUAL, qr, MK_EXPR(CVC4::kind::MULT, n, rr)));
+ Expr bvl = MK_EXPR(CVC4::kind::BOUND_VAR_LIST, q, r);
+ body = MK_EXPR(CVC4::kind::EXISTS, bvl, body);
+ Expr lbvl = MK_EXPR(CVC4::kind::BOUND_VAR_LIST, n);
+ expr = MK_EXPR(CVC4::kind::LAMBDA, lbvl, body);
}
| '$is_int' { expr = EXPR_MANAGER->operatorOf(CVC4::kind::IS_INTEGER); }
| '$distinct' { expr = EXPR_MANAGER->operatorOf(CVC4::kind::DISTINCT); }
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback