type.h
Go to the documentation of this file.
/********************* */
#include "cvc4_public.h"
#ifndef __CVC4__TYPE_H
#define __CVC4__TYPE_H
#include <string>
#include <vector>
#include <limits.h>
#include <stdint.h>
#include "util/cardinality.h"
#include "util/subrange_bound.h"
namespace CVC4 {
class NodeManager;
class CVC4_PUBLIC ExprManager;
class CVC4_PUBLIC Expr;
class TypeNode;
struct CVC4_PUBLIC ExprManagerMapCollection;
class CVC4_PUBLIC SmtEngine;
class CVC4_PUBLIC Datatype;
class CVC4_PUBLIC Record;
template <bool ref_count>
class NodeTemplate;
class BooleanType;
class IntegerType;
class RealType;
class StringType;
class BitVectorType;
class ArrayType;
class SetType;
class DatatypeType;
class ConstructorType;
class SelectorType;
class TesterType;
class FunctionType;
class TupleType;
class RecordType;
class SExprType;
class SortType;
class SortConstructorType;
// not in release 1.0
//class PredicateSubtype;
class SubrangeType;
class Type;
struct CVC4_PUBLIC TypeHashFunction {
size_t operator()(const CVC4::Type& t) const;
};/* struct TypeHashFunction */
std::ostream& operator<<(std::ostream& out, const Type& t) CVC4_PUBLIC;
namespace expr {
TypeNode exportTypeInternal(TypeNode n, NodeManager* from, NodeManager* nm, ExprManagerMapCollection& vmap);
}/* CVC4::expr namespace */
class CVC4_PUBLIC Type {
friend class SmtEngine;
friend class ExprManager;
friend class NodeManager;
friend class TypeNode;
friend std::ostream& CVC4::operator<<(std::ostream& out, const Type& t);
friend TypeNode expr::exportTypeInternal(TypeNode n, NodeManager* from, NodeManager* nm, ExprManagerMapCollection& vmap);
protected:
TypeNode* d_typeNode;
NodeManager* d_nodeManager;
Type makeType(const TypeNode& typeNode) const;
Type(NodeManager* em, TypeNode* typeNode);
static TypeNode* getTypeNode(const Type& t) throw() { return t.d_typeNode; }
public:
virtual ~Type();
Type();
Type(const Type& t);
bool isNull() const;
Cardinality getCardinality() const;
bool isWellFounded() const;
Expr mkGroundTerm() const;
bool isSubtypeOf(Type t) const;
bool isComparableTo(Type t) const;
Type getBaseType() const;
Type substitute(const Type& type, const Type& replacement) const;
Type substitute(const std::vector<Type>& types,
const std::vector<Type>& replacements) const;
ExprManager* getExprManager() const;
Type exportTo(ExprManager* exprManager, ExprManagerMapCollection& vmap) const;
Type& operator=(const Type& t);
bool operator==(const Type& t) const;
bool operator!=(const Type& t) const;
bool operator<(const Type& t) const;
bool operator<=(const Type& t) const;
bool operator>(const Type& t) const;
bool operator>=(const Type& t) const;
bool isBoolean() const;
bool isInteger() const;
bool isReal() const;
bool isString() const;
bool isBitVector() const;
bool isFunction() const;
bool isPredicate() const;
bool isTuple() const;
bool isRecord() const;
bool isSExpr() const;
bool isArray() const;
bool isSet() const;
bool isDatatype() const;
bool isConstructor() const;
bool isSelector() const;
bool isTester() const;
bool isSort() const;
bool isSortConstructor() const;
// not in release 1.0
//bool isPredicateSubtype() const;
bool isSubrange() const;
void toStream(std::ostream& out) const;
std::string toString() const;
};/* class Type */
class CVC4_PUBLIC BooleanType : public Type {
public:
BooleanType(const Type& type = Type()) throw(IllegalArgumentException);
};/* class BooleanType */
class CVC4_PUBLIC IntegerType : public Type {
public:
IntegerType(const Type& type = Type()) throw(IllegalArgumentException);
};/* class IntegerType */
class CVC4_PUBLIC RealType : public Type {
public:
RealType(const Type& type = Type()) throw(IllegalArgumentException);
};/* class RealType */
class CVC4_PUBLIC StringType : public Type {
public:
StringType(const Type& type) throw(IllegalArgumentException);
};/* class StringType */
class CVC4_PUBLIC FunctionType : public Type {
public:
FunctionType(const Type& type = Type()) throw(IllegalArgumentException);
size_t getArity() const;
std::vector<Type> getArgTypes() const;
Type getRangeType() const;
};/* class FunctionType */
class CVC4_PUBLIC TupleType : public Type {
public:
TupleType(const Type& type = Type()) throw(IllegalArgumentException);
size_t getLength() const;
std::vector<Type> getTypes() const;
};/* class TupleType */
class CVC4_PUBLIC RecordType : public Type {
public:
RecordType(const Type& type = Type()) throw(IllegalArgumentException);
const Record& getRecord() const;
};/* class RecordType */
class CVC4_PUBLIC SExprType : public Type {
public:
SExprType(const Type& type = Type()) throw(IllegalArgumentException);
std::vector<Type> getTypes() const;
};/* class SExprType */
class CVC4_PUBLIC ArrayType : public Type {
public:
ArrayType(const Type& type = Type()) throw(IllegalArgumentException);
Type getIndexType() const;
Type getConstituentType() const;
};/* class ArrayType */
class CVC4_PUBLIC SetType : public Type {
public:
SetType(const Type& type = Type()) throw(IllegalArgumentException);
Type getElementType() const;
};/* class SetType */
class CVC4_PUBLIC SortType : public Type {
public:
SortType(const Type& type = Type()) throw(IllegalArgumentException);
std::string getName() const;
bool isParameterized() const;
std::vector<Type> getParamTypes() const;
};/* class SortType */
class CVC4_PUBLIC SortConstructorType : public Type {
public:
SortConstructorType(const Type& type = Type()) throw(IllegalArgumentException);
std::string getName() const;
size_t getArity() const;
SortType instantiate(const std::vector<Type>& params) const;
};/* class SortConstructorType */
// not in release 1.0
#if 0
class CVC4_PUBLIC PredicateSubtype : public Type {
public:
PredicateSubtype(const Type& type = Type()) throw(IllegalArgumentException);
Expr getPredicate() const;
Type getParentType() const;
};/* class PredicateSubtype */
#endif /* 0 */
class CVC4_PUBLIC SubrangeType : public Type {
public:
SubrangeType(const Type& type = Type()) throw(IllegalArgumentException);
SubrangeBounds getSubrangeBounds() const;
};/* class SubrangeType */
class CVC4_PUBLIC BitVectorType : public Type {
public:
BitVectorType(const Type& type = Type()) throw(IllegalArgumentException);
unsigned getSize() const;
};/* class BitVectorType */
class CVC4_PUBLIC DatatypeType : public Type {
public:
DatatypeType(const Type& type = Type()) throw(IllegalArgumentException);
const Datatype& getDatatype() const;
bool isParametric() const;
Expr getConstructor(std::string name) const;
bool isInstantiated() const;
bool isParameterInstantiated(unsigned n) const;
std::vector<Type> getParamTypes() const;
size_t getArity() const;
DatatypeType instantiate(const std::vector<Type>& params) const;
};/* class DatatypeType */
class CVC4_PUBLIC ConstructorType : public Type {
public:
ConstructorType(const Type& type = Type()) throw(IllegalArgumentException);
DatatypeType getRangeType() const;
std::vector<Type> getArgTypes() const;
size_t getArity() const;
};/* class ConstructorType */
class CVC4_PUBLIC SelectorType : public Type {
public:
SelectorType(const Type& type = Type()) throw(IllegalArgumentException);
DatatypeType getDomain() const;
Type getRangeType() const;
};/* class SelectorType */
class CVC4_PUBLIC TesterType : public Type {
public:
TesterType(const Type& type = Type()) throw(IllegalArgumentException);
DatatypeType getDomain() const;
BooleanType getRangeType() const;
};/* class TesterType */
}/* CVC4 namespace */
#endif /* __CVC4__TYPE_H */
Expr
void * Expr
Definition c_interface_defs.h:46
Type
void * Type
Definition c_interface_defs.h:48
ExprManager
void * ExprManager
Definition c_interface_defs.h:43
cardinality.h
Representation of cardinality.
CVC4::ArrayType
Class encapsulating an array type.
Definition type.h:484
CVC4::ArrayType::ArrayType
ArrayType(const Type &type=Type())
Construct from the base type.
CVC4::BitVectorType
Class encapsulating the bit-vector type.
Definition type.h:596
CVC4::BitVectorType::BitVectorType
BitVectorType(const Type &type=Type())
Construct from the base type.
CVC4::BooleanType
Singleton class encapsulating the Boolean type.
Definition type.h:374
CVC4::BooleanType::BooleanType
BooleanType(const Type &type=Type())
Construct from the base type.
CVC4::Cardinality
A simple representation of a cardinality.
Definition cardinality.h:65
CVC4::ConstructorType
Class encapsulating the constructor type.
Definition type.h:661
CVC4::ConstructorType::ConstructorType
ConstructorType(const Type &type=Type())
Construct from the base type.
CVC4::DatatypeType
Class encapsulating the datatype type.
Definition type.h:615
CVC4::DatatypeType::DatatypeType
DatatypeType(const Type &type=Type())
Construct from the base type.
CVC4::Datatype
The representation of an inductive datatype.
Definition datatype.h:423
CVC4::ExprManager
Definition expr_manager.h:124
CVC4::Expr
Class encapsulating CVC4 expressions and methods for constructing new expressions.
Definition expr.h:227
CVC4::FunctionType
Class encapsulating a function type.
Definition type.h:418
CVC4::FunctionType::FunctionType
FunctionType(const Type &type=Type())
Construct from the base type.
CVC4::IllegalArgumentException
Definition exception.h:79
CVC4::IntegerType
Singleton class encapsulating the integer type.
Definition type.h:385
CVC4::IntegerType::IntegerType
IntegerType(const Type &type=Type())
Construct from the base type.
CVC4::RealType
Singleton class encapsulating the real type.
Definition type.h:396
CVC4::RealType::RealType
RealType(const Type &type=Type())
Construct from the base type.
CVC4::RecordType
Class encapsulating a record type.
Definition type.h:456
CVC4::RecordType::RecordType
RecordType(const Type &type=Type())
Construct from the base type.
CVC4::Record
Definition record.h:84
CVC4::SExprType
Class encapsulating a tuple type.
Definition type.h:470
CVC4::SExprType::SExprType
SExprType(const Type &type=Type())
Construct from the base type.
CVC4::SelectorType
Class encapsulating the Selector type.
Definition type.h:683
CVC4::SelectorType::SelectorType
SelectorType(const Type &type=Type())
Construct from the base type.
CVC4::SetType
Class encapsulating an set type.
Definition type.h:501
CVC4::SetType::SetType
SetType(const Type &type=Type())
Construct from the base type.
CVC4::SmtEngine
Definition smt_engine.h:113
CVC4::SortConstructorType
Class encapsulating a user-defined sort constructor.
Definition type.h:536
CVC4::SortConstructorType::SortConstructorType
SortConstructorType(const Type &type=Type())
Construct from the base type.
CVC4::SortType
Class encapsulating a user-defined sort.
Definition type.h:515
CVC4::SortType::SortType
SortType(const Type &type=Type())
Construct from the base type.
CVC4::StringType
Singleton class encapsulating the string type.
Definition type.h:407
CVC4::StringType::StringType
StringType(const Type &type)
Construct from the base type.
CVC4::SubrangeBounds
Definition subrange_bound.h:150
CVC4::SubrangeType
Class encapsulating an integer subrange type.
Definition type.h:581
CVC4::SubrangeType::SubrangeType
SubrangeType(const Type &type=Type())
Construct from the base type.
CVC4::TesterType
Class encapsulating the Tester type.
Definition type.h:701
CVC4::TesterType::TesterType
TesterType(const Type &type=Type())
Construct from the base type.
CVC4::TupleType
Class encapsulating a tuple type.
Definition type.h:438
CVC4::TupleType::TupleType
TupleType(const Type &type=Type())
Construct from the base type.
CVC4::Type
Class encapsulating CVC4 expression types.
Definition type.h:89
CVC4::Type::getCardinality
Cardinality getCardinality() const
Return the cardinality of this type.
CVC4::Type::operator>
bool operator>(const Type &t) const
An ordering on Types so they can be stored in maps, etc.
CVC4::Type::getExprManager
ExprManager * getExprManager() const
Get this type's ExprManager.
CVC4::Type::Type
Type()
Default constructor.
CVC4::Type::isTuple
bool isTuple() const
Is this a tuple type?
CVC4::Type::getBaseType
Type getBaseType() const
Get the most general base type of this type.
CVC4::Type::isSubtypeOf
bool isSubtypeOf(Type t) const
Is this type a subtype of the given type?
CVC4::Type::isWellFounded
bool isWellFounded() const
Is this a well-founded type?
CVC4::Type::isTester
bool isTester() const
Is this a tester type?
CVC4::Type::substitute
Type substitute(const Type &type, const Type &replacement) const
Substitution of Types.
CVC4::Type::isSet
bool isSet() const
Is this a Set type?
CVC4::Type::isReal
bool isReal() const
Is this the real type?
CVC4::Type::isArray
bool isArray() const
Is this an array type?
CVC4::Type::isBitVector
bool isBitVector() const
Is this the bit-vector type?
CVC4::Type::isInteger
bool isInteger() const
Is this the integer type?
CVC4::Type::operator<=
bool operator<=(const Type &t) const
An ordering on Types so they can be stored in maps, etc.
CVC4::Type::isNull
bool isNull() const
Check whether this is a null type.
CVC4::Type::isDatatype
bool isDatatype() const
Is this a datatype type?
CVC4::Type::operator!=
bool operator!=(const Type &t) const
Comparison for structural disequality.
CVC4::Type::substitute
Type substitute(const std::vector< Type > &types, const std::vector< Type > &replacements) const
Simultaneous substitution of Types.
CVC4::Type::operator>=
bool operator>=(const Type &t) const
An ordering on Types so they can be stored in maps, etc.
CVC4::Type::isSortConstructor
bool isSortConstructor() const
Is this a sort constructor kind?
CVC4::Type::operator==
bool operator==(const Type &t) const
Comparison for structural equality.
CVC4::Type::getTypeNode
static TypeNode * getTypeNode(const Type &t)
Accessor for derived classes.
Definition type.h:121
CVC4::Type::isSelector
bool isSelector() const
Is this a selector type?
CVC4::Type::d_nodeManager
NodeManager * d_nodeManager
The responsible expression manager.
Definition type.h:104
CVC4::Type::isSubrange
bool isSubrange() const
Is this a predicate subtype?
CVC4::Type::operator<
bool operator<(const Type &t) const
An ordering on Types so they can be stored in maps, etc.
CVC4::Type::Type
Type(const Type &t)
Copy constructor.
CVC4::Type::toStream
void toStream(std::ostream &out) const
Outputs a string representation of this type to the stream.
CVC4::Type::isFunction
bool isFunction() const
Is this a function type?
CVC4::Type::isRecord
bool isRecord() const
Is this a record type?
CVC4::Type::isComparableTo
bool isComparableTo(Type t) const
Is this type comparable to the given type (i.e., do they share a common ancestor in the subtype tree)...
CVC4::Type::isSExpr
bool isSExpr() const
Is this a symbolic expression type?
CVC4::Type::isString
bool isString() const
Is this the string type?
CVC4::Type::isPredicate
bool isPredicate() const
Is this a predicate type, i.e.
CVC4::Type::operator=
Type & operator=(const Type &t)
Assignment operator.
CVC4::Type::toString
std::string toString() const
Constructs a string representation of this type.
CVC4::Type::makeType
Type makeType(const TypeNode &typeNode) const
Construct a new type given the typeNode, for internal use only.
CVC4::Type::~Type
virtual ~Type()
Force a virtual destructor for safety.
CVC4::Type::isSort
bool isSort() const
Is this a sort kind?
CVC4::Type::isBoolean
bool isBoolean() const
Is this the Boolean type?
CVC4::Type::mkGroundTerm
Expr mkGroundTerm() const
Construct and return a ground term for this Type.
CVC4::Type::exportTo
Type exportTo(ExprManager *exprManager, ExprManagerMapCollection &vmap) const
Exports this type into a different ExprManager.
CVC4::Type::isConstructor
bool isConstructor() const
Is this a constructor type?
CVC4::Type::Type
Type(NodeManager *em, TypeNode *typeNode)
Constructor for internal purposes.
CVC4::Type::d_typeNode
TypeNode * d_typeNode
The internal expression representation.
Definition type.h:101
cvc4_public.h
Macros that should be defined everywhere during the building of the libraries and driver binary,...
CVC4_PUBLIC
#define CVC4_PUBLIC
Definition cvc4_public.h:30
CVC4::expr::exportTypeInternal
TypeNode exportTypeInternal(TypeNode n, NodeManager *from, NodeManager *nm, ExprManagerMapCollection &vmap)
CVC4
Definition expr.h:106
CVC4::operator<<
std::ostream & operator<<(std::ostream &out, const TypeCheckingException &e)
std
STL namespace.
CVC4::ExprManagerMapCollection
Definition variable_type_map.h:54
CVC4::TypeHashFunction
Hash function for Types.
Definition type.h:69
CVC4::TypeHashFunction::operator()
size_t operator()(const CVC4::Type &t) const
Return a hash code for type t.
subrange_bound.h
Representation of subrange bounds.