diff options
Diffstat (limited to 'src/theory/builtin')
-rw-r--r-- | src/theory/builtin/kinds | 3 | ||||
-rw-r--r-- | src/theory/builtin/theory_builtin_type_rules.h | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/theory/builtin/kinds b/src/theory/builtin/kinds index 48fe4d84a..c4c3435a2 100644 --- a/src/theory/builtin/kinds +++ b/src/theory/builtin/kinds @@ -298,6 +298,8 @@ variable BOUND_VARIABLE "bound variable" variable SKOLEM "skolem var" operator TUPLE 1: "a tuple" +operator LAMBDA 2 "lambda" + constant TYPE_CONSTANT \ ::CVC4::TypeConstant \ ::CVC4::TypeConstantHashFunction \ @@ -338,6 +340,7 @@ typerule APPLY ::CVC4::theory::builtin::ApplyTypeRule typerule EQUAL ::CVC4::theory::builtin::EqualityTypeRule typerule DISTINCT ::CVC4::theory::builtin::DistinctTypeRule typerule TUPLE ::CVC4::theory::builtin::TupleTypeRule +typerule LAMBDA ::CVC4::theory::builtin::LambdaTypeRule constant SUBTYPE_TYPE \ ::CVC4::Predicate \ diff --git a/src/theory/builtin/theory_builtin_type_rules.h b/src/theory/builtin/theory_builtin_type_rules.h index 68d9e8702..95ede1c46 100644 --- a/src/theory/builtin/theory_builtin_type_rules.h +++ b/src/theory/builtin/theory_builtin_type_rules.h @@ -145,6 +145,24 @@ public: } };/* class StringConstantTypeRule */ +class LambdaTypeRule { +public: + inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) { + if( n[0].getType(check) != nodeManager->boundVarListType() ) { + std::stringstream ss; + ss << "expected a bound var list for LAMBDA expression, got `" + << n[0].getType().toString() << "'"; + throw TypeCheckingExceptionPrivate(n, ss.str()); + } + std::vector<TypeNode> argTypes; + for(TNode::iterator i = n[0].begin(); i != n[0].end(); ++i) { + argTypes.push_back((*i).getType()); + } + TypeNode rangeType = n[1].getType(check); + return nodeManager->mkFunctionType(argTypes, rangeType); + } +};/* class LambdaTypeRule */ + class SortProperties { public: inline static bool isWellFounded(TypeNode type) { |