#ifndef _INST_
#define _INST_ 
#include "clause.h"
#include "sharing.h"
#include "folsubst.h"
#include "trail.h"
typedef struct INST_HELP * INST;
typedef struct INST_QUERY_HELP * INST_QUERY;
struct INST_HELP {
  CLAUSE origin;
  unsigned watched1;
  unsigned watched2;
  SUBST subst;
  BOOL emptyTrail;
  INST_QUERY firstQuery;
  INST_QUERY secondQuery;
};
struct INST_QUERY_HELP {
  INST inst;
  BOOL firstWatched;
};
INST inst_Create(MEMORY, CLAUSE, unsigned, unsigned, SUBST, BOOL);
INST inst_CreateEmpty(MEMORY);
INST inst_CreateFromInstAndSubst(MEMORY, SHARER, TERMSTATE, INST, SUBST, BOOL);
INST inst_CreateFromInstAndContext(MEMORY, SHARER, TERMSTATE, INST, SUBSTSTATE, BOOL, BOOL);
void inst_ShareSubstOfNew(SHARER, INST);
void inst_Delete(MEMORY, INST);
BOOL inst_Equal(SYMBSTATE, INST, INST);
unsigned inst_GetFirstWatched(INST);
void inst_SetFirstWatched(INST, unsigned);
void inst_SetFirstWatchedTheoryConflict(INST, unsigned);
unsigned inst_GetSecondWatched(INST);
void inst_SetSecondWatched(INST, unsigned);
CLAUSE inst_GetOrigin(INST);
void inst_SetOrigin(INST,CLAUSE);
SUBST inst_GetSubst(INST);
BOOL inst_GetEmptyTrail(INST);
INST_QUERY inst_GetFirstQuery(INST);
INST_QUERY inst_GetSecondQuery(INST);
void inst_Print(TERMSTATE, INST);
void inst_InitiallyPickWatched(INST, TERMSTATE, TRAIL, unsigned);
void inst_NewCreatedPickNewWatched(INST, TERMSTATE, unsigned, TRAIL, unsigned);
BOOL inst_PickNewWatched(INST, TERMSTATE, BOOL, TRAIL);
BOOL inst_PickNewWatchedPos(INST, TERMSTATE, BOOL, TRAIL, unsigned);
void inst_CheckPotentialFalseLiteralsOfNewInst(INST, TERMSTATE, TRAIL, unsigned);
void inst_CheckForDifferentWatched(INST, TERMSTATE);
BOOL inst_CheckAllNotWatchedFalse(INST, TERMSTATE, TRAIL, unsigned);
void inst_PrintLiteralStatus(INST, TERMSTATE, TRAIL, unsigned);
unsigned inst_LastTrailpositionOfNotWatchedLiteral(INST, TERMSTATE, TRAIL);
void inst_CheckWatchedCorrect(INST, TERMSTATE, TRAIL, unsigned);
void inst_CheckWatchedCorrectAfterExhaustiveApplication(INST, TERMSTATE, TRAIL);
void inst_CheckSubstShared(INST, TERMSTATE);
INST_QUERY inst_QueryCreate(MEMORY, INST, BOOL);
void inst_QueryDelete(MEMORY, INST_QUERY);
INST inst_GetQueryInst(INST_QUERY);
BOOL inst_GetQueryFirstWatched(INST_QUERY);
void inst_DestrPrint(TERMSTATE, INST_QUERY);
void inst_Test(MEMORY, ARRAY, SHARER, TERMSTATE, SUBSTSTATE, SYMBSTATE, FOLSTATE, SYMBOL);
#endif
