#ifndef _GROUNDGEN_
#define _GROUNDGEN_ 
#include "sharing.h"
#include "state.h"
typedef struct GROUNDGEN_HELP {
  MEMORY mem;
  SCLSTATE state;
  SHARER sharer;
  unsigned maxarity;
  ARRAY groundterms;
  ARRAY start;
  unsigned numsymbols;
  unsigned arity;
  unsigned tuple;
  unsigned function;
  unsigned prevnum;
  unsigned prevterm;
  unsigned prevtuple;
  ARRAY dp;
  ARRAY functions;
  ARRAY numterms;
} GROUNDGEN_NODE, *GROUNDGEN;
typedef struct ATOMSTREAM_HELP {
  TERM atom;
  ARRAY occ;
  ARRAY suffix;
  unsigned cursymbols;
  int pos;
  ARRAY restsymbols;
  ARRAY curterm;
  int profit;
  BOOL is_from_conjecture;
} ATOMSTREAM_NODE, *ATOMSTREAM;
GROUNDGEN groundgen_Create(MEMORY, SCLSTATE, SHARER);
void groundgen_Delete(GROUNDGEN);
ARRAY groundgen_GetCurrentGroundterms(GROUNDGEN);
void groundgen_AtomStreamSetProfit(ATOMSTREAM, int);
int groundgen_AtomStreamGetProfit(ATOMSTREAM);
void groundgen_AtomStreamIncreaseProfit(ATOMSTREAM, int);
BOOL groundgen_AtomStreamIsFromConjecture(ATOMSTREAM);
void groundgen_AtomStreamSetFromConjecture(ATOMSTREAM, BOOL);
TERM groundgen_AtomStreamGetAtom(ATOMSTREAM);
SHARER groundgen_GetSharer(GROUNDGEN);
TERM groundgen_GenerateNextTerm(GROUNDGEN);
unsigned long long groundgen_NumTermsWithNumSymbols(GROUNDGEN, unsigned);
unsigned long long groundgen_NumTermsWithLeqNumSymbols(GROUNDGEN, unsigned);
BOOL groundgen_AtMostKGroundAtoms(GROUNDGEN, SCLSTATE, unsigned);
ATOMSTREAM groundgen_CreateAtomStream(GROUNDGEN, TERM);
TERM groundgen_AtomStreamGetNext(GROUNDGEN, ATOMSTREAM);
void groundgen_DeleteAtomStream(GROUNDGEN, ATOMSTREAM);
#endif
