void ana_AutoConfiguration(LIST Clauses, FLAGSTORE Flags, PRECEDENCE Precedence) /************************************************************** INPUT: A list of clauses, a flag store and a precedence. RETURNS: Nothing. EFFECT: Based on the values of the ana analysis module, an appropriate complete configuration of inference, reduction rules and other settings is established. ***************************************************************/ { LIST Scan, Functions, Predicates, Constants; Functions = symbol_GetAllFunctions(); Predicates = fol_GetNonFOLPredicates(); /* Set precedence */ Predicates = ana_CalculatePredicatePrecedence(Predicates, Clauses); Functions = ana_CalculateFunctionPrecedence(Functions, Clauses, Flags); Constants = list_Nil(); for (Scan=Functions; !list_Empty(Scan); Scan=list_Cdr(Scan)) if (symbol_IsConstant((SYMBOL)list_Car(Scan))) Constants = list_Cons(list_Car(Scan),Constants); Functions = list_NPointerDifference(Functions,Constants); Constants = list_NReverse(Constants); for ( ; !list_Empty(Functions); Functions = list_Pop(Functions)) symbol_SetIncreasedOrdering(Precedence, (SYMBOL)list_Car(Functions)); /* Predicates < Functions */ for ( ; !list_Empty(Predicates); Predicates = list_Pop(Predicates)) symbol_SetIncreasedOrdering(Precedence, (SYMBOL)list_Car(Predicates)); /* Constants < Predicates */ /* Predicates < Functions */ for ( ; !list_Empty(Constants); Constants = list_Pop(Constants)) symbol_SetIncreasedOrdering(Precedence, (SYMBOL)list_Car(Constants)); flag_ClearInferenceRules(Flags); flag_ClearReductionRules(Flags); flag_SetFlagIntValue(Flags, flag_ROBV, flag_ROBVON); flag_SetFlagIntValue(Flags, flag_RTAUT, flag_RTAUTSYNTACTIC); flag_SetFlagIntValue(Flags, flag_RFSUB, flag_RFSUBON); flag_SetFlagIntValue(Flags, flag_RBSUB, flag_RBSUBON); flag_SetFlagIntValue(Flags, flag_RFMRR, flag_RFMRRON); flag_SetFlagIntValue(Flags, flag_RBMRR, flag_RBMRRON); flag_SetFlagIntValue(Flags, flag_RUNC, flag_RUNCON); flag_SetFlagIntValue(Flags, flag_FULLRED, flag_FULLREDON); /*flag_SetFlagIntValue(Flags, flag_FUNCWEIGHT,1); flag_SetFlagIntValue(Flags, flag_VARWEIGHT,1);*/ flag_SetFlagIntValue(Flags, flag_WDRATIO,5); if (ana_NEQUATIONS) { flag_SetFlagIntValue(Flags, flag_IEQR, flag_EQUALITYRESOLUTIONON); if (ana_NONUNIT) { if (ana_NONTRIVDOMAIN) flag_SetFlagIntValue(Flags, flag_RAED, flag_RAEDPOTUNSOUND); else flag_SetFlagIntValue(Flags, flag_RAED, flag_RAEDSOUND); } } if (ana_PEQUATIONS) { flag_SetFlagIntValue(Flags, flag_ISPR, flag_SUPERPOSITIONRIGHTON); flag_SetFlagIntValue(Flags, flag_ISPL, flag_SUPERPOSITIONLEFTON); if (ana_NONHORNCLAUSES > 0) flag_SetFlagIntValue(Flags, flag_IEQF, flag_EQUALITYFACTORINGON); if (ana_NONUNIT) flag_SetFlagIntValue(Flags, flag_RCON, flag_RCONON); flag_SetFlagIntValue(Flags, flag_RFREW, flag_RFREWON); flag_SetFlagIntValue(Flags, flag_RBREW, flag_RBREWON); } if (ana_SORTRES) { flag_SetFlagIntValue(Flags, flag_SORTS, flag_SORTSMONADICWITHVARIABLE); flag_SetFlagIntValue(Flags, flag_IEMS, flag_EMPTYSORTON); flag_SetFlagIntValue(Flags, flag_ISOR, flag_SORTRESOLUTIONON); flag_SetFlagIntValue(Flags, flag_RSSI, flag_RSSION); if (!ana_PEQUATIONS || ana_SORTMANYEQUATIONS) flag_SetFlagIntValue(Flags, flag_RSST, flag_RSSTON); } else flag_SetFlagIntValue(Flags, flag_SORTS, flag_SORTSOFF); if (ana_MONADIC || ana_NONMONADIC) { /* Problem contains real predicates */ flag_SetFlagIntValue(Flags, flag_IORE, flag_ORDEREDRESOLUTIONNOEQUATIONS); if (ana_NONHORNCLAUSES > 0) flag_SetFlagIntValue(Flags, flag_IOFC, flag_FACTORINGONLYRIGHT); if (ana_NONUNIT) flag_SetFlagIntValue(Flags, flag_RCON, flag_RCONON); } if (!ana_FUNCTIONS) flag_SetFlagIntValue(Flags, flag_SELECT, flag_SELECTALWAYS); else if (ana_NONUNIT) flag_SetFlagIntValue(Flags, flag_SELECT, flag_SELECTIFSEVERALMAXIMAL); else flag_SetFlagIntValue(Flags, flag_SELECT, flag_SELECTOFF); if (ana_CONCLAUSES < ana_AXIOMCLAUSES || (ana_CONGROUND && !ana_PUREPROPOSITIONAL)) flag_SetFlagIntValue(Flags, flag_SATINPUT, flag_SATINPUTON); else flag_SetFlagIntValue(Flags, flag_SATINPUT, flag_SATINPUTOFF); if (ana_NONHORNCLAUSES > 0) flag_SetFlagIntValue(Flags, flag_SPLITS, flag_SPLITSUNLIMITED); else flag_SetFlagIntValue(Flags, flag_SPLITS, flag_SPLITSOFF); /* if (ana_PUREPROPOSITIONAL) */ /* flag_SetFlagIntValue(Flags, flag_SPLITHEURISTIC, flag_SPLITHEURISTICALWAYS); */ }
static SYMBOL symbol_SignatureCreate(char* String, int Type, int Arity, int Status, PRECEDENCE Precedence) /************************************************************** INPUT: A pointer to a string, a type, the arity and the status RETURNS: The symbol containing the passed parameters. SUMMARY: Establishes a new symbol in the symbol table and returns the internal representation (pointer and type). CAUTION: The string is not copied! ***************************************************************/ { SIGNATURE Entry; #ifdef CHECK if (!symbol_SignatureExists()) { misc_StartErrorReport(); misc_ErrorReport("\n In symbol_SignatureCreate:"); misc_ErrorReport(" Module was initialized with no signature.\n"); misc_FinishErrorReport(); } if (Type < 0 || Type >= symbol_SIGTYPES) { misc_StartErrorReport(); misc_ErrorReport("\n In symbol_SignatureCreate: Illegal input.\n"); misc_FinishErrorReport(); } #endif if ((int)symbol_ACTINDEX >= symbol__MAXSIGNATURE && list_Empty(symbol_FREEDSYMBOLS)) { misc_StartUserErrorReport(); misc_UserErrorReport("\n In symbol_SignatureCreate: No more symbols available.\n"); misc_FinishUserErrorReport(); } if (strlen(String)>=symbol__SYMBOLMAXLEN) { misc_StartUserErrorReport(); misc_UserErrorReport("\n In symbol_SignatureCreate: String too long.\n"); misc_FinishUserErrorReport(); } Entry = symbol_GetSignature(); Entry->weight = 1; Entry->props = 0; Entry->name = String; Entry->length = strlen(String); Entry->arity = Arity; Entry->generatedBy = list_Nil(); if (list_Empty(symbol_FREEDSYMBOLS)) { Entry->info = symbol_SignatureSymbol(symbol_ACTINDEX, Type, Status); symbol_SetSignature(symbol_ACTINDEX++, Entry); } else { int Index; Index = (int)list_Car(symbol_FREEDSYMBOLS); symbol_FREEDSYMBOLS = list_PointerDeleteElement(symbol_FREEDSYMBOLS, (POINTER)Index); Entry->info = symbol_SignatureSymbol(Index, Type, Status); symbol_SetSignature(Index, Entry); } /* Define precedence of symbol */ symbol_SetIncreasedOrdering(Precedence, Entry->info); return Entry->info; }