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