[14] | 1 | /**CHeaderFile***************************************************************** |
---|
| 2 | |
---|
| 3 | FileName [ctlsp.h] |
---|
| 4 | |
---|
| 5 | PackageName [ctlsp] |
---|
| 6 | |
---|
| 7 | Synopsis [Routines for parsing, writing and accessing CTL* formulas.] |
---|
| 8 | |
---|
| 9 | Description [This package implements a parser for CTL* formulas. CTL* is |
---|
| 10 | a language used to describe properties of systems.] |
---|
| 11 | |
---|
| 12 | SeeAlso [] |
---|
| 13 | |
---|
| 14 | Author [Mohammad Awedh] |
---|
| 15 | |
---|
| 16 | Copyright [This file was created at the University of Colorado at Boulder. |
---|
| 17 | The University of Colorado at Boulder makes no warranty about the suitability |
---|
| 18 | of this software for any purpose. It is presented on an AS IS basis.] |
---|
| 19 | |
---|
| 20 | Revision [$Id: ctlsp.h,v 1.28 2009/04/11 01:32:36 fabio Exp $] |
---|
| 21 | |
---|
| 22 | ******************************************************************************/ |
---|
| 23 | |
---|
| 24 | #ifndef _CTLSP |
---|
| 25 | #define _CTLSP |
---|
| 26 | |
---|
| 27 | #include "vm.h" |
---|
| 28 | #include "ctlp.h" |
---|
| 29 | |
---|
| 30 | /*---------------------------------------------------------------------------*/ |
---|
| 31 | /* Structure declarations */ |
---|
| 32 | /*---------------------------------------------------------------------------*/ |
---|
| 33 | |
---|
| 34 | /**Enum************************************************************************ |
---|
| 35 | |
---|
| 36 | Synopsis [Types of operators allowed in CTL* formulas.] |
---|
| 37 | |
---|
| 38 | Description [The types of nodes in a CTL* formula parse tree. ID, TRUE, and |
---|
| 39 | FALSE are leaves, and all others are internal nodes.] |
---|
| 40 | |
---|
| 41 | SeeAlso [Ctlsp_FormulaReadType] |
---|
| 42 | |
---|
| 43 | ******************************************************************************/ |
---|
| 44 | typedef enum { |
---|
| 45 | Ctlsp_E_c, /* there exists */ |
---|
| 46 | Ctlsp_A_c, /* for all paths*/ |
---|
| 47 | Ctlsp_X_c, /* Next */ |
---|
| 48 | Ctlsp_G_c, /* globally */ |
---|
| 49 | Ctlsp_F_c, /* finally */ |
---|
| 50 | Ctlsp_U_c, /* until (not symmetric in args) */ |
---|
| 51 | Ctlsp_R_c, /* release (not symmetric in args) */ |
---|
| 52 | Ctlsp_W_c, /* weak until (not symmetric in args) */ |
---|
| 53 | Ctlsp_OR_c, /* Boolean disjunction */ |
---|
| 54 | Ctlsp_AND_c, /* Boolean conjunction */ |
---|
| 55 | Ctlsp_NOT_c, /* Boolean negation*/ |
---|
| 56 | Ctlsp_THEN_c, /* Boolean implies (not symmetric) */ |
---|
| 57 | Ctlsp_XOR_c, /* Boolean XOR */ |
---|
| 58 | Ctlsp_EQ_c, /* Boolean equal */ |
---|
| 59 | Ctlsp_ID_c, /* an atomic proposition */ |
---|
| 60 | Ctlsp_TRUE_c, /* tautology (used only for translation to exist. form) */ |
---|
| 61 | Ctlsp_FALSE_c, /* empty (used only for translation to exist. form) */ |
---|
| 62 | Ctlsp_Fwd_c, /* forward */ |
---|
| 63 | Ctlsp_Y_c, /* previous state */ |
---|
| 64 | Ctlsp_H_c, /* past */ |
---|
| 65 | Ctlsp_Init_c, /* initial states */ |
---|
| 66 | Ctlsp_Cmp_c /* compare two leaves in forward CTL* */ |
---|
| 67 | } Ctlsp_FormulaType; |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | /**Enum************************************************************************ |
---|
| 71 | |
---|
| 72 | Synopsis [Types of operators allowed in CTL formulas.] |
---|
| 73 | |
---|
| 74 | Description [The types of nodes in a CTL formula parse tree. ID, TRUE, and |
---|
| 75 | FALSE are leaves, and all others are internal nodes.] |
---|
| 76 | |
---|
| 77 | SeeAlso [Ctlsp_FormulaReadType] |
---|
| 78 | |
---|
| 79 | ******************************************************************************/ |
---|
| 80 | typedef enum { |
---|
| 81 | Ctlsp_ECTL_c, |
---|
| 82 | Ctlsp_ACTL_c, |
---|
| 83 | Ctlsp_Mixed_c, |
---|
| 84 | Ctlsp_QuantifierFree_c, |
---|
| 85 | Ctlsp_LTL_c, |
---|
| 86 | Ctlsp_stateFormuls_c, |
---|
| 87 | Ctlsp_invalid_c |
---|
| 88 | } Ctlsp_FormulaClass; |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | /**Enum************************************************************************ |
---|
| 92 | |
---|
| 93 | Synopsis [Types of approximations that are possible] |
---|
| 94 | |
---|
| 95 | Description [We can have overapproximations, underapproximations, exact |
---|
| 96 | approximations, or incomparable sets. Question: is ctlsp the right place for |
---|
| 97 | this? It is used in ctlsp, mc, rch. (RB)] |
---|
| 98 | |
---|
| 99 | SeeAlso [] |
---|
| 100 | |
---|
| 101 | ******************************************************************************/ |
---|
| 102 | typedef enum { |
---|
| 103 | Ctlsp_Incomparable_c, |
---|
| 104 | Ctlsp_Underapprox_c, |
---|
| 105 | Ctlsp_Overapprox_c, |
---|
| 106 | Ctlsp_Exact_c |
---|
| 107 | } Ctlsp_Approx_t; |
---|
| 108 | |
---|
| 109 | /**Enum************************************************************************ |
---|
| 110 | |
---|
| 111 | Synopsis [ Class of CTL* formulas.] |
---|
| 112 | |
---|
| 113 | Description [The classes of nodes in CTL* formula.] |
---|
| 114 | |
---|
| 115 | Note: [We explicity assign values to the enumerated values becuase we |
---|
| 116 | are going to use the numerical values in determining the class of |
---|
| 117 | a CTL* formula. These values are used in table1, table2, and |
---|
| 118 | table3 macros.] |
---|
| 119 | |
---|
| 120 | SeeAlso [ctlspInt.h] |
---|
| 121 | |
---|
| 122 | ******************************************************************************/ |
---|
| 123 | typedef enum { |
---|
| 124 | Ctlsp_propformula_c = 0, |
---|
| 125 | Ctlsp_LTLformula_c = 1, |
---|
| 126 | Ctlsp_stateformula_c = 2, |
---|
| 127 | Ctlsp_pathformula_c = 3 |
---|
| 128 | } Ctlsp_ClassOfFormula; |
---|
| 129 | |
---|
| 130 | |
---|
| 131 | /**Enum************************************************************************ |
---|
| 132 | |
---|
| 133 | Synopsis [ Class of CTL formulas.] |
---|
| 134 | |
---|
| 135 | Description [The classes of CTL formula. This help to find out whether a |
---|
| 136 | formula is CTL or not. During the parsing of a CTL* formula |
---|
| 137 | the parser determines whether the subformula is a CTL formula, |
---|
| 138 | (Ctlsp_CTL_c) can be CTL formula (Ctlsp_PathCTL_c), or not |
---|
| 139 | CTL formula (Ctlsp_NotCTL_c).] |
---|
| 140 | |
---|
| 141 | SeeAlso [ctlsp.y] |
---|
| 142 | |
---|
| 143 | ******************************************************************************/ |
---|
| 144 | typedef enum { |
---|
| 145 | Ctlsp_NotCTL_c, |
---|
| 146 | Ctlsp_PathCTL_c, |
---|
| 147 | Ctlsp_CTL_c |
---|
| 148 | } Ctlsp_ClassOfCTLFormula; |
---|
| 149 | |
---|
| 150 | |
---|
| 151 | /*---------------------------------------------------------------------------*/ |
---|
| 152 | /* Type declarations */ |
---|
| 153 | /*---------------------------------------------------------------------------*/ |
---|
| 154 | typedef struct CtlspFormulaStruct Ctlsp_Formula_t; |
---|
| 155 | typedef void (*Ctlsp_DbgInfoFreeFn) (Ctlsp_Formula_t *); |
---|
| 156 | |
---|
| 157 | |
---|
| 158 | /**AutomaticStart*************************************************************/ |
---|
| 159 | |
---|
| 160 | /*---------------------------------------------------------------------------*/ |
---|
| 161 | /* Function prototypes */ |
---|
| 162 | /*---------------------------------------------------------------------------*/ |
---|
| 163 | |
---|
| 164 | EXTERN void Ctlsp_Init(void); |
---|
| 165 | EXTERN void Ctlsp_End(void); |
---|
| 166 | EXTERN array_t * Ctlsp_FileParseFormulaArray(FILE * fp); |
---|
| 167 | EXTERN array_t * Ctlsp_FileParseCTLFormulaArray(FILE * fp); |
---|
| 168 | EXTERN char * Ctlsp_FormulaConvertToString(Ctlsp_Formula_t * formula); |
---|
| 169 | EXTERN void Ctlsp_FormulaPrint(FILE * fp, Ctlsp_Formula_t * formula); |
---|
| 170 | EXTERN Ctlsp_FormulaType Ctlsp_FormulaReadType(Ctlsp_Formula_t * formula); |
---|
| 171 | EXTERN int Ctlsp_FormulaReadCompareValue(Ctlsp_Formula_t * formula); |
---|
| 172 | EXTERN char * Ctlsp_FormulaReadVariableName(Ctlsp_Formula_t * formula); |
---|
| 173 | EXTERN char * Ctlsp_FormulaReadValueName(Ctlsp_Formula_t * formula); |
---|
| 174 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaReadLeftChild(Ctlsp_Formula_t * formula); |
---|
| 175 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaReadRightChild(Ctlsp_Formula_t * formula); |
---|
| 176 | EXTERN mdd_t * Ctlsp_FormulaObtainStates(Ctlsp_Formula_t * formula); |
---|
| 177 | EXTERN mdd_t * Ctlsp_FormulaObtainApproxStates(Ctlsp_Formula_t *formula, Ctlsp_Approx_t approx); |
---|
| 178 | EXTERN void Ctlsp_FormulaSetStates(Ctlsp_Formula_t * formula, mdd_t * states); |
---|
| 179 | EXTERN void Ctlsp_FormulaSetApproxStates(Ctlsp_Formula_t * formula, mdd_t * states, Ctlsp_Approx_t approx); |
---|
| 180 | EXTERN void Ctlsp_FormulaSetDbgInfo(Ctlsp_Formula_t * formula, void *data, Ctlsp_DbgInfoFreeFn freeFn); |
---|
| 181 | EXTERN void * Ctlsp_FormulaReadDebugData(Ctlsp_Formula_t * formula); |
---|
| 182 | EXTERN boolean Ctlsp_FormulaTestIsConverted(Ctlsp_Formula_t * formula); |
---|
| 183 | EXTERN boolean Ctlsp_FormulaTestIsQuantifierFree(Ctlsp_Formula_t *formula); |
---|
| 184 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaReadOriginalFormula(Ctlsp_Formula_t * formula); |
---|
| 185 | EXTERN int Ctlsp_FormulaReadABIndex(Ctlsp_Formula_t * formula); |
---|
| 186 | EXTERN void Ctlsp_FormulaSetABIndex(Ctlsp_Formula_t * formula, int ab_idx); |
---|
| 187 | EXTERN int Ctlsp_FormulaReadLabelIndex(Ctlsp_Formula_t * formula); |
---|
| 188 | EXTERN void Ctlsp_FormulaSetLabelIndex(Ctlsp_Formula_t * formula, int label_idx); |
---|
| 189 | EXTERN char Ctlsp_FormulaReadRhs(Ctlsp_Formula_t * formula); |
---|
| 190 | EXTERN void Ctlsp_FormulaSetRhs(Ctlsp_Formula_t * formula); |
---|
| 191 | EXTERN void Ctlsp_FormulaResetRhs(Ctlsp_Formula_t * formula); |
---|
| 192 | EXTERN char Ctlsp_FormulaReadMarked(Ctlsp_Formula_t * formula); |
---|
| 193 | EXTERN void Ctlsp_FormulaSetMarked(Ctlsp_Formula_t * formula); |
---|
| 194 | EXTERN void Ctlsp_FormulaResetMarked(Ctlsp_Formula_t * formula); |
---|
| 195 | EXTERN void Ctlsp_FormulaFree(Ctlsp_Formula_t *formula); |
---|
| 196 | EXTERN void Ctlsp_FlushStates(Ctlsp_Formula_t * formula); |
---|
| 197 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaDup(Ctlsp_Formula_t * formula); |
---|
| 198 | EXTERN void Ctlsp_FormulaArrayFree(array_t * formulaArray); |
---|
| 199 | EXTERN array_t * Ctlsp_FormulaArrayConvertToDAG(array_t *formulaArray); |
---|
| 200 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaCreate(Ctlsp_FormulaType type, void * left_, void * right_); |
---|
| 201 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaCreateOr(char *name, char *valueStr); |
---|
| 202 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaCreateVectorAnd(char *nameVector, char *value); |
---|
| 203 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaCreateVectorOr(char *nameVector, char *valueStr); |
---|
| 204 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaCreateEquiv(char *left, char *right); |
---|
| 205 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaCreateVectorEquiv(char *left, char *right); |
---|
| 206 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaCreateXMult(char *string, Ctlsp_Formula_t *formula); |
---|
| 207 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaCreateEXMult(char *string, Ctlsp_Formula_t *formula); |
---|
| 208 | EXTERN Ctlsp_Formula_t * Ctlsp_FormulaCreateAXMult(char *string, Ctlsp_Formula_t *formula); |
---|
| 209 | EXTERN char * Ctlsp_FormulaGetTypeString(Ctlsp_Formula_t *formula); |
---|
| 210 | EXTERN Ctlsp_FormulaClass Ctlsp_CheckClassOfExistentialFormula(Ctlsp_Formula_t *formula); |
---|
| 211 | EXTERN Ctlsp_FormulaClass Ctlsp_CheckClassOfExistentialFormulaArray(array_t *formulaArray); |
---|
| 212 | EXTERN Ctlsp_ClassOfFormula Ctlsp_FormulaReadClass(Ctlsp_Formula_t *formula); |
---|
| 213 | EXTERN void Ctlsp_FormulaSetClass(Ctlsp_Formula_t *formula, Ctlsp_ClassOfFormula newClass); |
---|
| 214 | EXTERN Ctlsp_ClassOfCTLFormula Ctlsp_FormulaReadClassOfCTL(Ctlsp_Formula_t *formula); |
---|
| 215 | EXTERN void Ctlsp_FormulaSetClassOfCTL(Ctlsp_Formula_t *formula, Ctlsp_ClassOfCTLFormula newCTLclass); |
---|
| 216 | EXTERN array_t * Ctlsp_FormulaArrayConvertToLTL(array_t *formulaArray); |
---|
| 217 | EXTERN array_t * Ctlsp_FormulaArrayConvertToCTL(array_t *formulaArray); |
---|
| 218 | EXTERN Ctlp_Formula_t * Ctlsp_FormulaConvertToCTL(Ctlsp_Formula_t *formula); |
---|
| 219 | EXTERN Ctlp_Formula_t * Ctlsp_PropositionalFormulaToCTL(Ctlsp_Formula_t *formula); |
---|
| 220 | EXTERN int Ctlsp_isPropositionalFormula(Ctlsp_Formula_t *formula); |
---|
| 221 | EXTERN int Ctlsp_isCtlFormula(Ctlsp_Formula_t *formula); |
---|
| 222 | EXTERN int Ctlsp_isLtlFormula(Ctlsp_Formula_t *formula); |
---|
| 223 | EXTERN Ctlsp_Formula_t * Ctlsp_LtllFormulaNegate(Ctlsp_Formula_t *ltlFormula); |
---|
| 224 | EXTERN void Ctlsp_LtlSetClass(Ctlsp_Formula_t *formula); |
---|
| 225 | EXTERN int Ctlsp_LtlFormulaIsGFp(Ctlsp_Formula_t *formula); |
---|
| 226 | EXTERN boolean Ctlsp_LtlFormulaIsGp(Ctlsp_Formula_t *formula); |
---|
| 227 | EXTERN boolean Ctlsp_LtlFormulaIsFp(Ctlsp_Formula_t *formula); |
---|
| 228 | EXTERN boolean Ctlsp_LtlFormulaIsSafety(Ctlsp_Formula_t *formula); |
---|
| 229 | EXTERN void Ctlsp_FormulaArrayAddLtlFairnessConstraints(array_t *formulaArray, array_t *constraintArray); |
---|
| 230 | EXTERN Ctlsp_Formula_t * Ctlsp_CtlFormulaToCtlsp(Ctlp_Formula_t *F); |
---|
| 231 | EXTERN Ctlsp_Formula_t * Ctlsp_LtlFormulaExpandAbbreviation(Ctlsp_Formula_t *formula); |
---|
| 232 | EXTERN Ctlsp_Formula_t * Ctlsp_LtlFormulaNegationNormalForm(Ctlsp_Formula_t *formula); |
---|
| 233 | EXTERN Ctlsp_Formula_t * Ctlsp_LtlFormulaHashIntoUniqueTable(Ctlsp_Formula_t *F, st_table *uniqueTable); |
---|
| 234 | EXTERN void Ctlsp_LtlFormulaClearMarks(Ctlsp_Formula_t *F); |
---|
| 235 | EXTERN int Ctlsp_LtlFormulaCountNumber(Ctlsp_Formula_t *F); |
---|
| 236 | EXTERN st_table * Ctlsp_LtlFormulaCreateUniqueTable(void); |
---|
| 237 | EXTERN int Ctlsp_LtlFormulaIsElementary2(Ctlsp_Formula_t *F); |
---|
| 238 | EXTERN int Ctlsp_LtlFormulaIsElementary(Ctlsp_Formula_t *F); |
---|
| 239 | EXTERN boolean Ctlsp_LtlFormulaTestIsBounded(Ctlsp_Formula_t *formula, int *depth); |
---|
| 240 | EXTERN int Ctlsp_LtlFormulaDepth(Ctlsp_Formula_t *formula); |
---|
| 241 | EXTERN boolean Ctlsp_LtlFormulaTestIsSyntacticallyCoSafe(Ctlsp_Formula_t *formula); |
---|
| 242 | EXTERN int Ctlsp_LtlFormulaArrayIsPropositional(array_t * formulaArray); |
---|
| 243 | EXTERN int Ctlsp_LtlFormulaIsPropositional(Ctlsp_Formula_t *F); |
---|
| 244 | EXTERN int Ctlsp_LtlFormulaIsAtomicPropositional(Ctlsp_Formula_t *F); |
---|
| 245 | EXTERN int Ctlsp_LtlFormulaIsFG(Ctlsp_Formula_t *F); |
---|
| 246 | EXTERN int Ctlsp_LtlFormulaIsGF(Ctlsp_Formula_t *F); |
---|
| 247 | EXTERN int Ctlsp_LtlFormulaIsFGorGF(Ctlsp_Formula_t *F); |
---|
| 248 | EXTERN int Ctlsp_LtlFormulaSimplyImply(Ctlsp_Formula_t *from, Ctlsp_Formula_t *to); |
---|
| 249 | EXTERN array_t * Ctlsp_LtlTranslateIntoSNF(Ctlsp_Formula_t *formula); |
---|
| 250 | EXTERN void Ctlsp_LtlTranslateIntoSNFRecursive(Ctlsp_Formula_t *propNode, Ctlsp_Formula_t *formula, array_t *formulaArray, int *index); |
---|
| 251 | EXTERN Ctlsp_Formula_t * Ctlsp_LtlFormulaSimpleRewriting(Ctlsp_Formula_t *formula); |
---|
| 252 | |
---|
| 253 | /**AutomaticEnd***************************************************************/ |
---|
| 254 | |
---|
| 255 | #endif /* _CTLSP */ |
---|