#ifndef _TWFO_
#define _TWFO_ 
#include "instset.h"
#include "prlits.h"
typedef struct TWFO_HELP {
  MEMORY mem;
  SUBSTSTATE subststate;
  TERMSTATE termstate;
  SYMBSTATE symbstate;
  FOLSTATE folstate;
  SHARER sharer;
  INSTSET instset;
  PRLITS prlit;
  ARRAY candidates;
  ARRAY newInstances;
  ARRAY props;
  unsigned factors;
} * TWFO;
TWFO twfo_Create(MEMORY, SUBSTSTATE, TERMSTATE, SYMBSTATE, FOLSTATE, SHARER, ARRAY, TRAIL);
void twfo_Delete(TWFO);
MEMORY twfo_GetMemory(TWFO);
SUBSTSTATE twfo_GetSubststate(TWFO);
TERMSTATE twfo_GetTermstate(TWFO);
SYMBSTATE twfo_GetSymbstate(TWFO);
FOLSTATE twfo_GetFolstate(TWFO);
INSTSET twfo_GetInstset(TWFO);
PRLITS twfo_GetPrlit(TWFO);
ARRAY twfo_GetCandidates(TWFO);
void twfo_SetCandidates(TWFO, ARRAY);
ARRAY twfo_GetNewInstances(TWFO);
void twfo_SetNewInstances(TWFO, ARRAY);
unsigned twfo_GetFactors(TWFO);
void twfo_SetFactors(TWFO, unsigned);
void twfo_IncrementFactors(TWFO);
SHARER twfo_Sharer(TWFO);
ARRAY twfo_GetProps(TWFO);
void twfo_PushProp(TWFO, CLAUSE, SUBST, unsigned);
void twfo_PopProp(TWFO, CLAUSE *, SUBST *, unsigned *);
BOOL twfo_CheckInstContextSize(TWFO, INST);
INST twfo_CheckForUnifiableWatched(TWFO, INST, TRAIL, unsigned);
BOOL twfo_CheckForUnit(SYMBSTATE, INST);
void twfo_FullyFactorizeInst(TWFO, INST, TRAIL, BOOL, unsigned);
void twfo_Backtrack(TWFO, TRAIL);
void twfo_ClearStackDeletedUnits(TWFO);
void twfo_LearnNewClause(TWFO, TRAIL, CLAUSE, BOOL, unsigned);
void twfo_BacktrackAndLearn(TWFO, TRAIL, CLAUSE);
unsigned twfo_ComputeBacktrackLevelLearnNewClause(TWFO, TRAIL, CLAUSE);
void twfo_GenerateAllFalseInstancesFromWatched(TWFO, INST, BOOL, TRAIL, ARRAY *);
INST twfo_CheckInstForRuleApplications(TWFO, INST, TRAIL);
INST twfo_CheckArrayOfInstsForRuleApplications(TWFO, ARRAY *, TRAIL);
INST twfo_CheckArrayOfInstsForRuleApplicationsPos(TWFO, ARRAY *, TRAIL, unsigned);
INST twfo_NewLiteralOnTrail(TWFO, TRAIL);
void twfo_RestartForgetAndGrow(TWFO, ARRAY, ARRAY, TRAIL, BOOL);
void twfo_RefreshInstances(TWFO);
void twfo_FactorizeRefreshedInstances(TWFO, TRAIL);
void twfo_PrintPropLiterals(TWFO);
void twfo_CheckSetOfOriginsDuplicateFree(TERMSTATE, ARRAY);
void twfo_CheckIfOriginNoDuplicates(TERMSTATE, CLAUSE);
void twfo_CheckIfNotSimpleTautology(TERMSTATE, CLAUSE);
void twfo_CheckIfOriginIsShared(TERMSTATE, CLAUSE);
void twfo_Test(MEMORY, ARRAY, SHARER, SUBSTSTATE, TERMSTATE, SYMBSTATE, FOLSTATE, SYMBOL);
#endif
