diff options
author | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-07-27 20:55:10 +0000 |
---|---|---|
committer | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-07-27 20:55:10 +0000 |
commit | 01bd928fa45459114ae4f5effcc8fbcf91bef7e8 (patch) | |
tree | d29748d3b830c807cc6577e60742045490735df1 /src/theory/builtin | |
parent | 2564d8730f768a8305325d4b6cc08211d8a3281d (diff) |
Moving EQ->IFF handling from TheoryEngine to parser/type checker
Diffstat (limited to 'src/theory/builtin')
-rw-r--r-- | src/theory/builtin/theory_builtin_type_rules.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/theory/builtin/theory_builtin_type_rules.h b/src/theory/builtin/theory_builtin_type_rules.h index 4458931a9..33e4c942f 100644 --- a/src/theory/builtin/theory_builtin_type_rules.h +++ b/src/theory/builtin/theory_builtin_type_rules.h @@ -32,12 +32,21 @@ namespace builtin { class EqualityTypeRule { public: inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) throw (TypeCheckingExceptionPrivate) { + TypeNode booleanType = nodeManager->booleanType(); + if( check ) { - if (n[0].getType(check) != n[1].getType(check)) { + TypeNode lhsType = n[0].getType(check); + TypeNode rhsType = n[1].getType(check); + + if ( lhsType != rhsType ) { throw TypeCheckingExceptionPrivate(n, "Left and right hand side of the equation are not of the same type"); } + + if ( lhsType == booleanType ) { + throw TypeCheckingExceptionPrivate(n, "equality between two boolean terms (use IFF instead)"); + } } - return nodeManager->booleanType(); + return booleanType; } }; |