Ejemplo n.º 1
0
ProofState_p parse_spec(CLState_p state, 
                        IOFormat parse_format,
                        bool error_on_empty,
                        FunctionProperties free_symb_prop,
                        long* ax_no)
{   
   ProofState_p proofstate;
   Scanner_p in;
   int i;
   StrTree_p skip_includes = NULL;
   long parsed_ax_no;

   proofstate = ProofStateAlloc(free_symb_prop);
   for(i=0; state->argv[i]; i++)
   {
      in = CreateScanner(StreamTypeFile, state->argv[i], true, NULL);
      ScannerSetFormat(in, parse_format);
      
      FormulaAndClauseSetParse(in, proofstate->axioms, 
                               proofstate->f_axioms,
                               proofstate->original_terms, 
                               NULL,
                               &skip_includes);
      CheckInpTok(in, NoToken);
      DestroyScanner(in); 
   }
   VERBOUT2("Specification read\n");

   parsed_ax_no = ProofStateAxNo(proofstate);

   if(error_on_empty && (parsed_ax_no == 0))
   {
#ifdef PRINT_SOMEERRORS_STDOUT
      fprintf(GlobalOut, "# Error: Input file contains no clauses or formulas\n");
      TSTPOUT(GlobalOut, "InputError");
#endif
      Error("Input file contains no clauses or formulas", OTHER_ERROR);
   }
   *ax_no = parsed_ax_no;
   return proofstate;
}
Ejemplo n.º 2
0
int main(int argc, char* argv[])
{
   ProofState_p    fstate;
   Scanner_p       in;    
   int             i;
   CLState_p       state;
   SpecFeatureCell features;
   SpecLimits_p    limits;
   StrTree_p       skip_includes = NULL;

   assert(argv[0]);
   
   InitIO(NAME);

   limits = SpecLimitsAlloc();
   state = process_options(argc, argv, limits);
    
   OpenGlobalOut(outname);

   if(state->argc ==  0)
   {
      CLStateInsertArg(state, "-");
   }
   
   if(parse_features)
   {
      if(raw_classify)
      {
         process_raw_feature_files(state->argv, limits);
      }
      else
      {
         process_feature_files(state->argv, limits);
      }
   }
   else
   {      
      for(i=0; state->argv[i]; i++)
      {
         fstate = ProofStateAlloc(FPIgnoreProps);
         in    = CreateScanner(StreamTypeFile, state->argv[i], true, NULL);
         ScannerSetFormat(in, parse_format);
         
         FormulaAndClauseSetParse(in, fstate->axioms, 
                                  fstate->f_axioms,
                                  fstate->original_terms, NULL, &
                                  skip_includes);
         if(raw_classify)
         {
            do_raw_classification(state->argv[i], fstate, limits);
         }
         else
         {
            FormulaSetPreprocConjectures(fstate->f_axioms, fstate->f_ax_archive, 
                                         false, false);
            FormulaSetCNF(fstate->f_axioms, 
                          fstate->f_ax_archive,
                          fstate->axioms, 
                          fstate->original_terms, 
                          fstate->freshvars,
                          fstate->gc_original_terms);
            
            if(!no_preproc)
            {
               ClauseSetPreprocess(fstate->axioms,
                                   fstate->watchlist,
                                   fstate->archive,
                                   fstate->tmp_terms,
                                   eqdef_incrlimit,
                                   eqdef_maxclauses);
            }
            SpecFeaturesCompute(&features, fstate->axioms, fstate->signature);
            SpecFeaturesAddEval(&features, limits);
            
            
            if(!tptp_header)
            {
               fprintf(GlobalOut, "%s : ", state->argv[i]);
               SpecFeaturesPrint(GlobalOut, &features);
               fprintf(GlobalOut, " : ");
               SpecTypePrint(GlobalOut, &features, mask);
               fprintf(GlobalOut, "\n");
            }
            else
            {
               print_tptp_header(fstate, features);
            }
            DestroyScanner(in);
            ProofStateFree(fstate);
         }
      }
   }
   CLStateFree(state);
   SpecLimitsCellFree(limits);
   
   fflush(GlobalOut);
   OutClose(GlobalOut);
   ExitIO();

#ifdef CLB_MEMORY_DEBUG
   MemFlushFreeList();
   MemDebugPrintStats(stdout);
#endif
   
   return 0;
}
Ejemplo n.º 3
0
int main(int argc, char* argv[])
{
   TB_p            terms;
   GCAdmin_p       collector;
   VarBank_p       freshvars;
   Sig_p           sig;
   ClauseSet_p     clauses;
   FormulaSet_p    formulas, f_ax_archive;
   Scanner_p       in;    
   int             i;
   CLState_p       state;
   StrTree_p       skip_includes = NULL;
   ClauseSet_p     demodulators[1];
   OCB_p           ocb;

   assert(argv[0]);
   
   InitIO(NAME);
#ifdef STACK_SIZE
   IncreaseMaxStackSize(argv, STACK_SIZE);
#endif   
   ESignalSetup(SIGXCPU);

   state = process_options(argc, argv);
   
   OpenGlobalOut(outname);
   
   if(state->argc ==  0)
   {
      CLStateInsertArg(state, "-");
   }
   
   sig          = SigAlloc(); 
   SigInsertInternalCodes(sig);
   terms        = TBAlloc(sig);
   collector    = GCAdminAlloc(terms);
   clauses      = ClauseSetAlloc();
   formulas     = FormulaSetAlloc();
   f_ax_archive = FormulaSetAlloc();

   GCRegisterClauseSet(collector, clauses);
   GCRegisterFormulaSet(collector, formulas);
   GCRegisterFormulaSet(collector, f_ax_archive);

   for(i=0; state->argv[i]; i++)
   {
      in = CreateScanner(StreamTypeFile, state->argv[i], true, NULL);
      ScannerSetFormat(in, parse_format);
      /* ClauseSetParseList(in, clauses, terms); */
      FormulaAndClauseSetParse(in,clauses, formulas, terms, 
         NULL, &skip_includes);
      CheckInpTok(in, NoToken);
      DestroyScanner(in);
   }
   CLStateFree(state);

   if(FormulaSetPreprocConjectures(formulas, f_ax_archive, false, false))
   {
      VERBOUT("Negated conjectures.\n");
   }
   freshvars = VarBankAlloc();
   if(FormulaSetCNF(formulas, f_ax_archive, 
                    clauses, terms, freshvars, collector))
   {
      VERBOUT("CNFization done\n");
   }
   VarBankFree(freshvars);

   GCDeregisterFormulaSet(collector, formulas);
   FormulaSetFree(formulas);
   GCDeregisterFormulaSet(collector, f_ax_archive);
   FormulaSetFree(f_ax_archive);

   demodulators[0] = ClauseSetAlloc();
   demodulators[0]->demod_index = PDTreeAlloc();
   GCRegisterClauseSet(collector, demodulators[0]);

   build_rw_system(demodulators[0], clauses);


   GCDeregisterClauseSet(collector, clauses);
   ClauseSetFree(clauses);  

   VERBOUT("# Demodulators\n");
   VERBOSE(ClauseSetPrint(stderr, demodulators[0], true););