00001 /*****************************************************************************/ 00002 /*! 00003 * \file kinds.h 00004 * 00005 * Author: Clark Barrett 00006 * 00007 * Created: Mon Jan 20 13:38:52 2003 00008 * 00009 * <hr> 00010 * 00011 * License to use, copy, modify, sell and/or distribute this software 00012 * and its documentation for any purpose is hereby granted without 00013 * royalty, subject to the terms and conditions defined in the \ref 00014 * LICENSE file provided with this distribution. 00015 * 00016 * <hr> 00017 * 00018 */ 00019 /*****************************************************************************/ 00020 00021 #ifndef _cvc3__include__kinds_h_ 00022 #define _cvc3__include__kinds_h_ 00023 00024 namespace CVC3 { 00025 00026 // The commonly used kinds and the kinds needed by the parser. All 00027 // these kinds are registered by the ExprManager and are readily 00028 // available for everyone else. 00029 typedef enum { 00030 NULL_KIND = 0, 00031 00032 // Constant (Leaf) Exprs 00033 TRUE_EXPR = 1, 00034 FALSE_EXPR = 2, 00035 RATIONAL_EXPR = 3, 00036 STRING_EXPR = 4, 00037 00038 // All constants should have kinds less than MAX_CONST 00039 MAX_CONST = 100, 00040 00041 // Generic LISP kinds for representing raw parsed expressions 00042 RAW_LIST, //!< May have any number of children >= 0 00043 //! Identifier is (ID (STRING_EXPR "name")) 00044 ID, 00045 // Types 00046 BOOLEAN, 00047 // TUPLE_TYPE, 00048 ANY_TYPE, 00049 ARROW, 00050 // The "type" of any expression type (as in BOOLEAN : TYPE). 00051 TYPE, 00052 // Declaration of new (uninterpreted) types: T1, T2, ... : TYPE 00053 // (TYPEDECL T1 T2 ...) 00054 TYPEDECL, 00055 // Declaration of a defined type T : TYPE = type === (TYPEDEF T type) 00056 TYPEDEF, 00057 00058 // Equality 00059 EQ, 00060 NEQ, 00061 DISTINCT, 00062 00063 // Propositional connectives 00064 NOT, 00065 AND, 00066 OR, 00067 XOR, 00068 IFF, 00069 IMPLIES, 00070 // BOOL_VAR, //!< Boolean variables are treated as 0-ary predicates 00071 00072 // Propositional relations (for circuit propagation) 00073 AND_R, 00074 IFF_R, 00075 ITE_R, 00076 00077 // (ITE c e1 e2) == IF c THEN e1 ELSE e2 ENDIF, the internal 00078 // representation of the conditional. Parser produces (IF ...). 00079 ITE, 00080 00081 // Quantifiers 00082 FORALL, 00083 EXISTS, 00084 00085 // Uninterpreted function 00086 UFUNC, 00087 // Application of a function 00088 APPLY, 00089 00090 // Top-level Commands 00091 ASSERT, 00092 QUERY, 00093 CHECKSAT, 00094 CONTINUE, 00095 RESTART, 00096 DBG, 00097 TRACE, 00098 UNTRACE, 00099 OPTION, 00100 HELP, 00101 TRANSFORM, 00102 PRINT, 00103 CALL, 00104 ECHO, 00105 INCLUDE, 00106 DUMP_PROOF, 00107 DUMP_ASSUMPTIONS, 00108 DUMP_SIG, 00109 DUMP_TCC, 00110 DUMP_TCC_ASSUMPTIONS, 00111 DUMP_TCC_PROOF, 00112 DUMP_CLOSURE, 00113 DUMP_CLOSURE_PROOF, 00114 WHERE, 00115 ASSERTIONS, 00116 ASSUMPTIONS, 00117 COUNTEREXAMPLE, 00118 COUNTERMODEL, 00119 PUSH, 00120 POP, 00121 POPTO, 00122 PUSH_SCOPE, 00123 POP_SCOPE, 00124 POPTO_SCOPE, 00125 RESET, 00126 CONTEXT, 00127 FORGET, 00128 GET_TYPE, 00129 CHECK_TYPE, 00130 GET_CHILD, 00131 SUBSTITUTE, 00132 SEQ, 00133 ARITH_VAR_ORDER, 00134 00135 // Kinds used mostly in the parser 00136 00137 TCC, 00138 // Variable declaration (VARDECL v1 v2 ... v_n type). A variable 00139 // can be an ID or a BOUNDVAR. 00140 VARDECL, 00141 // A list of variable declarations (VARDECLS (VARDECL ...) (VARDECL ...) ...) 00142 VARDECLS, 00143 00144 // Bound variables have a "printable name", the one the user typed 00145 // in, and a uniqueID used to distinguish it from other bound 00146 // variables, which is effectively the alpha-renaming: 00147 00148 // Op(BOUND_VAR (BOUND_ID "user_name" "uniqueID")). Note that 00149 // BOUND_VAR is an operator (Expr without children), just as UFUNC 00150 // and UCONST. 00151 00152 // The uniqueID normally is just a number, so one can print a bound 00153 // variable X as X_17. 00154 00155 // NOTE that in the parsed expressions like LET x: T = e IN foo(x), 00156 // the second instance of 'x' will be an ID, and *not* a BOUNDVAR. 00157 // The parser does not know how to resolve bound variables, and it 00158 // has to be resolved later. 00159 BOUND_VAR, 00160 BOUND_ID, 00161 00162 // Updator "e1 WITH <bunch of stuff> := e2" is represented as 00163 // (UPDATE e1 (UPDATE_SELECT <bunch of stuff>) e2), where <bunch 00164 // of stuff> is the list of accessors: 00165 // (READ idx) 00166 // ID (what's that for?) 00167 // (REC_SELECT ID) 00168 // and (TUPLE_SELECT num). 00169 // UPDATE, 00170 // UPDATE_SELECT, 00171 // Record type [# f1 : t1, f2 : t2 ... #] is represented as 00172 // (RECORD_TYPE (f1 t1) (f2 t2) ... ) 00173 // RECORD_TYPE, 00174 // // (# f1=e1, f2=e2, ...#) == (RECORD (f1 e1) ...) 00175 // RECORD, 00176 // RECORD_SELECT, 00177 // RECORD_UPDATE, 00178 00179 // // (e1, e2, ...) == (TUPLE e1 e2 ...) 00180 // TUPLE, 00181 // TUPLE_SELECT, 00182 // TUPLE_UPDATE, 00183 00184 // SUBRANGE, 00185 // Enumerated type (SCALARTYPE v1 v2 ...) 00186 // SCALARTYPE, 00187 // Predicate subtype: the argument is the predicate (lambda-expression) 00188 SUBTYPE, 00189 // Datatype is Expr(DATATYPE, Constructors), where Constructors is a 00190 // vector of Expr(CONSTRUCTOR, id [ , arg ]), where 'id' is an ID, 00191 // and 'arg' a VARDECL node (list of variable declarations with 00192 // types). If 'arg' is present, the constructor has arguments 00193 // corresponding to the declared variables. 00194 // DATATYPE, 00195 // THISTYPE, // Used to indicate recursion in recursive datatypes 00196 // CONSTRUCTOR, 00197 // SELECTOR, 00198 // TESTER, 00199 // Expression e WITH accessor := e2 is transformed by the command 00200 // processor into (DATATYPE_UPDATE e accessor e2), where e is the 00201 // original datatype value C(a1, ..., an) (here C is the 00202 // constructor), and "accessor" is the name of one of the arguments 00203 // a_i of C. 00204 // DATATYPE_UPDATE, 00205 // Statement IF c1 THEN e1 ELSIF c2 THEN e2 ... ELSE e_n ENDIF is 00206 // represented as (IF (IFTHEN c1 e1) (IFTHEN c2 e2) ... (ELSE e_n)) 00207 IF, 00208 IFTHEN, 00209 ELSE, 00210 // Lisp version of multi-branch IF: 00211 // (COND (c1 e1) (c2 e2) ... (ELSE en)) 00212 COND, 00213 00214 // LET x1: t1 = e1, x2: t2 = e2, ... IN e 00215 // Parser builds: 00216 // (LET (LETDECLS (LETDECL x1 t1 e1) (LETDECL x2 t2 e2) ... ) e) 00217 // where each x_i is a BOUNDVAR. 00218 // After processing, it is rebuilt to have (LETDECL var def); the 00219 // type is set as the attribute to var. 00220 LET, 00221 LETDECLS, 00222 LETDECL, 00223 // Lambda-abstraction LAMBDA (<vars>) : e === (LAMBDA <vars> e) 00224 LAMBDA, 00225 // Symbolic simulation operator 00226 SIMULATE, 00227 00228 // Uninterpreted constants (variables) x1, x2, ... , x_n : type 00229 // (CONST (VARLIST x1 x2 ... x_n) type) 00230 // Uninterpreted functions are declared as constants of functional type. 00231 00232 // After processing, uninterpreted functions and constants 00233 // (a.k.a. variables) are represented as Op(UFUNC, (ID "name")) and 00234 // Op(UCONST, (ID "name")) with the appropriate type attribute. 00235 CONST, 00236 VARLIST, 00237 UCONST, 00238 00239 // User function definition f(args) : type = e === (DEFUN args type e) 00240 // Here 'args' are bound var declarations 00241 DEFUN, 00242 00243 // Arithmetic types and operators 00244 // REAL, 00245 // INT, 00246 00247 // UMINUS, 00248 // PLUS, 00249 // MINUS, 00250 // MULT, 00251 // DIVIDE, 00252 // INTDIV, 00253 // MOD, 00254 // LT, 00255 // LE, 00256 // GT, 00257 // GE, 00258 // IS_INTEGER, 00259 // NEGINF, 00260 // POSINF, 00261 // DARK_SHADOW, 00262 // GRAY_SHADOW, 00263 00264 // //Floor theory operators 00265 // FLOOR, 00266 // Kind for Extension to Non-linear Arithmetic 00267 // POW, 00268 00269 // Kinds for proof terms 00270 PF_APPLY, 00271 PF_HOLE, 00272 00273 00274 // // Mlss 00275 // EMPTY, // {} 00276 // UNION, // + 00277 // INTER, // * 00278 // DIFF, 00279 // SINGLETON, 00280 // IN, 00281 // INCS, 00282 // INCIN, 00283 00284 //Skolem variable 00285 SKOLEM_VAR, 00286 // Expr that holds a theorem 00287 THEOREM_KIND, 00288 //! Must always be the last kind 00289 LAST_KIND 00290 } Kind; 00291 00292 } // end of namespace CVC3 00293 00294 #endif