return BooleanType(Type(d_nodeManager, new TypeNode(d_nodeManager->booleanType())));
}
+StringType ExprManager::stringType() const {
+ NodeManagerScope nms(d_nodeManager);
+ return StringType(Type(d_nodeManager, new TypeNode(d_nodeManager->stringType())));
+}
+
KindType ExprManager::kindType() const {
NodeManagerScope nms(d_nodeManager);
return KindType(Type(d_nodeManager, new TypeNode(d_nodeManager->kindType())));
/** Get the type for booleans */
BooleanType booleanType() const;
+ /** Get the type for strings. */
+ StringType stringType() const;
+
/** Get the type for sorts. */
KindType kindType() const;
/** Get the (singleton) type for pseudobooleans. */
inline TypeNode pseudobooleanType();
+ /** Get the (singleton) type for strings. */
+ inline TypeNode stringType();
+
/** Get the (singleton) type for sorts. */
inline TypeNode kindType();
return TypeNode(mkTypeConst<TypeConstant>(PSEUDOBOOLEAN_TYPE));
}
+/** Get the (singleton) type for strings. */
+inline TypeNode NodeManager::stringType() {
+ return TypeNode(mkTypeConst<TypeConstant>(STRING_TYPE));
+}
+
/** Get the (singleton) type for sorts. */
inline TypeNode NodeManager::kindType() {
return TypeNode(mkTypeConst<TypeConstant>(KIND_TYPE));
return PseudobooleanType(*this);
}
+/** Is this the string type? */
+bool Type::isString() const {
+ NodeManagerScope nms(d_nodeManager);
+ return d_typeNode->isString();
+}
+
+/** Cast to a string type */
+Type::operator StringType() const throw(AssertionException) {
+ NodeManagerScope nms(d_nodeManager);
+ Assert(isNull() || isString());
+ return StringType(*this);
+}
+
/** Is this the bit-vector type? */
bool Type::isBitVector() const {
NodeManagerScope nms(d_nodeManager);
Assert(isNull() || isPseudoboolean());
}
+StringType::StringType(const Type& t) throw(AssertionException) :
+ Type(t) {
+ Assert(isNull() || isString());
+}
+
BitVectorType::BitVectorType(const Type& t) throw(AssertionException) :
Type(t) {
Assert(isNull() || isBitVector());
class IntegerType;
class RealType;
class PseudobooleanType;
+class StringType;
class BitVectorType;
class ArrayType;
class DatatypeType;
*/
operator PseudobooleanType() const throw(AssertionException);
+ /**
+ * Is this the string type?
+ * @return true if the type is the string type
+ */
+ bool isString() const;
+
+ /**
+ * Cast this type to a string type
+ * @return the StringType
+ */
+ operator StringType() const throw(AssertionException);
+
/**
* Is this the bit-vector type?
* @return true if the type is a bit-vector type
PseudobooleanType(const Type& type) throw(AssertionException);
};/* class PseudobooleanType */
+/**
+ * Singleton class encapsulating the string type.
+ */
+class CVC4_PUBLIC StringType : public Type {
+
+public:
+
+ /** Construct from the base type */
+ StringType(const Type& type) throw(AssertionException);
+};/* class StringType */
+
/**
* Class encapsulating a function type.
*/
getConst<TypeConstant>() == PSEUDOBOOLEAN_TYPE;
}
+bool TypeNode::isString() const {
+ return getKind() == kind::TYPE_CONSTANT &&
+ getConst<TypeConstant>() == STRING_TYPE;
+}
+
bool TypeNode::isArray() const {
return getKind() == kind::ARRAY_TYPE;
}
/** Is this the Pseudoboolean type? */
bool isPseudoboolean() const;
+ /** Is this the String type? */
+ bool isString() const;
+
/** Is this an array type? */
bool isArray() const;
"::CVC4::theory::builtin::TupleProperties::mkGroundTerm(%TYPE%)" \
"theory/builtin/theory_builtin_type_rules.h"
+# These will eventually move to a theory of strings.
+#
+# For now these are unbounded strings over a fixed, finite alphabet
+# (this may change).
+sort STRING_TYPE \
+ Cardinality::INTEGERS \
+ well-founded \
+ "NodeManager::currentNM()->mkConst(::std::string())" \
+ "string" \
+ "String type"
+constant CONST_STRING \
+ ::std::string \
+ ::CVC4::StringHashStrategy \
+ "util/hash.h" \
+ "a string of characters"
+typerule CONST_STRING ::CVC4::theory::builtin::StringConstantTypeRule
+
typerule APPLY ::CVC4::theory::builtin::ApplyTypeRule
typerule EQUAL ::CVC4::theory::builtin::EqualityTypeRule
typerule DISTINCT ::CVC4::theory::builtin::DistinctTypeRule
}
};/* class TupleTypeRule */
+class StringConstantTypeRule {
+public:
+ inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) {
+ Assert(n.getKind() == kind::CONST_STRING);
+ return nodeManager->stringType();
+ }
+};/* class StringConstantTypeRule */
+
+
class FunctionProperties {
public:
inline static Cardinality computeCardinality(TypeNode type) {
}
};/* struct StringHashFunction */
+struct StringHashStrategy {
+ static size_t hash(const std::string& str) {
+ return std::hash<const char*>()(str.c_str());
+ }
+};/* struct StringHashStrategy */
+
}/* CVC4 namespace */
#endif /* __CVC4__HASH_H */
static const string mostCommonOptionsDescription = "\
Most commonly-used CVC4 options:\n\
--version | -V identify this CVC4 binary\n\
- --help | -h this command line reference\n\
+ --help | -h full command line reference\n\
--lang | -L force input language (default is `auto'; see --lang help)\n\
--output-lang force output language (default is `auto'; see --lang help)\n\
--verbose | -v increase verbosity (may be repeated)\n\