diff options
Diffstat (limited to 'src/api/cvc4cpp.h')
-rw-r--r-- | src/api/cvc4cpp.h | 103 |
1 files changed, 42 insertions, 61 deletions
diff --git a/src/api/cvc4cpp.h b/src/api/cvc4cpp.h index b8da070fc..c13c7919e 100644 --- a/src/api/cvc4cpp.h +++ b/src/api/cvc4cpp.h @@ -2,9 +2,9 @@ /*! \file cvc4cpp.h ** \verbatim ** Top contributors (to current version): - ** Aina Niemetz + ** Aina Niemetz, Andres Noetzli ** This file is part of the CVC4 project. - ** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS + ** Copyright (c) 2009-2019 by the authors listed in the file AUTHORS ** in the top-level source directory) and their institutional affiliations. ** All rights reserved. See the file COPYING in the top-level source ** directory for licensing information.\endverbatim @@ -16,10 +16,10 @@ #include "cvc4_public.h" -#ifndef __CVC4__API__CVC4CPP_H -#define __CVC4__API__CVC4CPP_H +#ifndef CVC4__API__CVC4CPP_H +#define CVC4__API__CVC4CPP_H -#include "cvc4cppkind.h" +#include "api/cvc4cppkind.h" #include <map> #include <memory> @@ -1456,6 +1456,16 @@ std::ostream& operator<<(std::ostream& out, const DatatypeConstructorDecl& ctordecl) CVC4_PUBLIC; /** + * Serialize a vector of datatype constructor declarations to given stream. + * @param out the output stream + * @param vector the vector of datatype constructor declarations to be + * serialized to the given stream + * @return the output stream + */ +std::ostream& operator<<(std::ostream& out, + const std::vector<DatatypeConstructorDecl>& vector); + +/** * Serialize a datatype selector declaration to given stream. * @param out the output stream * @param stordecl the datatype selector declaration to be serialized @@ -1693,14 +1703,6 @@ class CVC4_PUBLIC Solver Term mkTerm(Kind kind) const; /** - * Create 0-ary term of given kind and sort. - * @param kind the kind of the term - * @param sort the sort argument to this kind - * @return the Term - */ - Term mkTerm(Kind kind, Sort sort) const; - - /** * Create a unary term of given kind. * @param kind the kind of the term * @param child the child of the term @@ -2045,7 +2047,14 @@ class CVC4_PUBLIC Solver Term mkBitVector(const char* s, uint32_t base = 2) const; /** - * Create a bit-vector constant from a given string. + * Create a bit-vector constant from a given string of base 2, 10 or 16. + * + * The size of resulting bit-vector is + * - base 2: the size of the binary string + * - base 10: the min. size required to represent the decimal as a bit-vector + * - base 16: the max. size required to represent the hexadecimal as a + * bit-vector (4 * size of the given value string) + * * @param s the string representation of the constant * @param base the base of the string representation (2, 10, or 16) * @return the bit-vector constant @@ -2053,7 +2062,9 @@ class CVC4_PUBLIC Solver Term mkBitVector(const std::string& s, uint32_t base = 2) const; /** - * Create a bit-vector constant of a given bit-width from a given string. + * Create a bit-vector constant of a given bit-width from a given string of + * base 2, 10 or 16. + * * @param size the bit-width of the constant * @param s the string representation of the constant * @param base the base of the string representation (2, 10, or 16) @@ -2062,7 +2073,8 @@ class CVC4_PUBLIC Solver Term mkBitVector(uint32_t size, const char* s, uint32_t base) const; /** - * Create a bit-vector constant of a given bit-width from a given string. + * Create a bit-vector constant of a given bit-width from a given string of + * base 2, 10 or 16. * @param size the bit-width of the constant * @param s the string representation of the constant * @param base the base of the string representation (2, 10, or 16) @@ -2154,34 +2166,23 @@ class CVC4_PUBLIC Solver /* .................................................................... */ /** - * Create variable. - * @param symbol the name of the variable - * @param sort the sort of the variable - * @return the variable + * Create (first-order) constant (0-arity function symbol). + * SMT-LIB: ( declare-const <symbol> <sort> ) + * SMT-LIB: ( declare-fun <symbol> ( ) <sort> ) + * + * @param sort the sort of the constant + * @param symbol the name of the constant + * @return the first-order constant */ - Term mkVar(const std::string& symbol, Sort sort) const; + Term mkConst(Sort sort, const std::string& symbol = std::string()) const; /** - * Create variable. + * Create (bound) variable. * @param sort the sort of the variable - * @return the variable - */ - Term mkVar(Sort sort) const; - - /** - * Create bound variable. * @param symbol the name of the variable - * @param sort the sort of the variable * @return the variable */ - Term mkBoundVar(const std::string& symbol, Sort sort) const; - - /** - * Create bound variable. - * @param sort the sort of the variable - * @return the variable - */ - Term mkBoundVar(Sort sort) const; + Term mkVar(Sort sort, const std::string& symbol = std::string()) const; /* .................................................................... */ /* Formula Handling */ @@ -2248,17 +2249,6 @@ class CVC4_PUBLIC Solver Result checkValidAssuming(const std::vector<Term>& assumptions) const; /** - * Declare first-order constant (0-arity function symbol). - * SMT-LIB: ( declare-const <symbol> <sort> ) - * SMT-LIB: ( declare-fun <symbol> ( ) <sort> ) - * This command corresponds to mkVar(). - * @param symbol the name of the first-order constant - * @param sort the sort of the first-order constant - * @return the first-order constant - */ - Term declareConst(const std::string& symbol, Sort sort) const; - - /** * Create datatype sort. * SMT-LIB: ( declare-datatype <symbol> <datatype_decl> ) * @param symbol the name of the datatype sort @@ -2269,15 +2259,6 @@ class CVC4_PUBLIC Solver const std::vector<DatatypeConstructorDecl>& ctors) const; /** - * Declare 0-arity function symbol. - * SMT-LIB: ( declare-fun <symbol> ( ) <sort> ) - * @param symbol the name of the function - * @param sort the sort of the return value of this function - * @return the function - */ - Term declareFun(const std::string& symbol, Sort sort) const; - - /** * Declare n-ary function symbol. * SMT-LIB: ( declare-fun <symbol> ( <sort>* ) <sort> ) * @param symbol the name of the function @@ -2314,7 +2295,7 @@ class CVC4_PUBLIC Solver /** * Define n-ary function. * SMT-LIB: ( define-fun <function_def> ) - * Create parameter 'fun' with mkVar(). + * Create parameter 'fun' with mkConst(). * @param fun the sorted function * @param bound_vars the parameters to this function * @param term the function body @@ -2341,7 +2322,7 @@ class CVC4_PUBLIC Solver /** * Define recursive function. * SMT-LIB: ( define-fun-rec <function_def> ) - * Create parameter 'fun' with mkVar(). + * Create parameter 'fun' with mkConst(). * @param fun the sorted function * @param bound_vars the parameters to this function * @param term the function body @@ -2354,7 +2335,7 @@ class CVC4_PUBLIC Solver /** * Define recursive functions. * SMT-LIB: ( define-funs-rec ( <function_decl>^{n+1} ) ( <term>^{n+1} ) ) - * Create elements of parameter 'funs' with mkVar(). + * Create elements of parameter 'funs' with mkConst(). * @param funs the sorted functions * @param bound_vars the list of parameters to the functions * @param term the list of function bodies of the functions @@ -2517,7 +2498,7 @@ class CVC4_PUBLIC Solver void checkMkTerm(Kind kind, uint32_t nchildren) const; /* Helper for mk-functions that call d_exprMgr->mkConst(). */ template <typename T> - Term mkConstHelper(T t) const; + Term mkValHelper(T t) const; /* Helper for mkReal functions that take a string as argument. */ Term mkRealFromStrHelper(std::string s) const; /* Helper for mkBitVector functions that take a string as argument. */ |