diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2021-04-14 17:10:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-14 22:10:09 +0000 |
commit | 6d79f73a8dffa7f16b1763a5949bd483bec4c333 (patch) | |
tree | de90fbc3a388d9d91d1f71550289761008b2c85a /src/theory/sets | |
parent | 729b25ea1270344a2ad168f272fd68f53256b661 (diff) |
Fix type rule for relations join image (#6349)
The join image type rule restricted that an argument was a constant. This is a logic restriction that should not be a part of the type checker.
This is required for not throwing type checking exceptions during proof conversion to LFSC.
Diffstat (limited to 'src/theory/sets')
-rw-r--r-- | src/theory/sets/theory_sets_private.cpp | 22 | ||||
-rw-r--r-- | src/theory/sets/theory_sets_type_rules.h | 13 |
2 files changed, 22 insertions, 13 deletions
diff --git a/src/theory/sets/theory_sets_private.cpp b/src/theory/sets/theory_sets_private.cpp index eea90da41..034af2848 100644 --- a/src/theory/sets/theory_sets_private.cpp +++ b/src/theory/sets/theory_sets_private.cpp @@ -16,6 +16,7 @@ #include "theory/sets/theory_sets_private.h" #include <algorithm> +#include <climits> #include "expr/emptyset.h" #include "expr/node_algorithm.h" @@ -1279,6 +1280,27 @@ void TheorySetsPrivate::preRegisterTerm(TNode node) d_equalityEngine->addTriggerPredicate(node); } break; + case kind::JOIN_IMAGE: + { + // these are logic exceptions, not type checking exceptions + if (node[1].getKind() != kind::CONST_RATIONAL) + { + throw LogicException( + "JoinImage cardinality constraint must be a constant"); + } + cvc5::Rational r(INT_MAX); + if (node[1].getConst<Rational>() > r) + { + throw LogicException( + "JoinImage Exceeded INT_MAX in cardinality constraint"); + } + if (node[1].getConst<Rational>().getNumerator().getSignedInt() < 0) + { + throw LogicException( + "JoinImage cardinality constraint must be non-negative"); + } + } + break; default: d_equalityEngine->addTerm(node); break; } } diff --git a/src/theory/sets/theory_sets_type_rules.h b/src/theory/sets/theory_sets_type_rules.h index ca89728d6..94e18dc64 100644 --- a/src/theory/sets/theory_sets_type_rules.h +++ b/src/theory/sets/theory_sets_type_rules.h @@ -385,19 +385,6 @@ struct JoinImageTypeRule { throw TypeCheckingExceptionPrivate( n, " JoinImage cardinality constraint must be integer"); } - if (n[1].getKind() != kind::CONST_RATIONAL) { - throw TypeCheckingExceptionPrivate( - n, " JoinImage cardinality constraint must be a constant"); - } - cvc5::Rational r(INT_MAX); - if (n[1].getConst<Rational>() > r) { - throw TypeCheckingExceptionPrivate( - n, " JoinImage Exceeded INT_MAX in cardinality constraint"); - } - if (n[1].getConst<Rational>().getNumerator().getSignedInt() < 0) { - throw TypeCheckingExceptionPrivate( - n, " JoinImage cardinality constraint must be non-negative"); - } std::vector<TypeNode> newTupleTypes; newTupleTypes.push_back(tupleTypes[0]); return nodeManager->mkSetType(nodeManager->mkTupleType(newTupleTypes)); |