int main(int argc, char* argv[]) { /* Scanner_p in; */ CLState_p state; Scanner_p in; PCLProt_p prot; long steps, proof_steps, neg_steps; int i; assert(argv[0]); InitIO(NAME); ESignalSetup(SIGTERM); ESignalSetup(SIGINT); /* We need consistent name->var mappings here because we potentially read the compressed input format. */ ClausesHaveLocalVariables = false; state = process_options(argc, argv); GlobalOut = OutOpen(outname); OpenGlobalOut(outname); prot = PCLProtAlloc(); if(state->argc == 0) { CLStateInsertArg(state, "-"); } steps = 0; for(i=0; state->argv[i]; i++) { in = CreateScanner(StreamTypeFile, state->argv[i], true, NULL); ScannerSetFormat(in, TPTPFormat); steps+=PCLProtParse(in, prot); CheckInpTok(in, NoToken); DestroyScanner(in); } VERBOUT2("PCL input read\n"); PCLProtStripFOF(prot); PCLProtResetTreeData(prot, false); PCLProtMarkProofClauses(prot); PCLProtProofDistance(prot); PCLProtUpdateGRefs(prot); proof_steps = PCLProtCountProp(prot, PCLIsProofStep); neg_steps = proof_steps?neg_proportion*proof_steps:neg_examples; PCLProtSelectExamples(prot, neg_steps); fprintf(GlobalOut, "# Axioms:\n"); PCLProtPrintPropClauses(GlobalOut, prot, PCLIsInitial, lop_format); fprintf(GlobalOut, ".\n\n# Examples:\n"); PCLProtPrintExamples(GlobalOut, prot); PCLProtFree(prot); CLStateFree(state); fflush(GlobalOut); OutClose(GlobalOut); ExitIO(); #ifdef CLB_MEMORY_DEBUG MemFlushFreeList(); MemDebugPrintStats(stdout); #endif return EXIT_SUCCESS; }
int main(int argc, char* argv[]) { int retval = NO_ERROR; CLState_p state; ProofState_p proofstate; ProofControl_p proofcontrol; Clause_p success = NULL, filter_success; bool out_of_clauses; char *finals_state = "exists", *sat_status = "Derivation"; long raw_clause_no, preproc_removed=0, neg_conjectures, parsed_ax_no, relevancy_pruned = 0; double preproc_time; assert(argv[0]); pid = getpid(); InitIO(NAME); #ifdef STACK_SIZE IncreaseMaxStackSize(argv, STACK_SIZE); #endif ESignalSetup(SIGXCPU); h_parms = HeuristicParmsAlloc(); fvi_parms = FVIndexParmsAlloc(); wfcb_definitions = PStackAlloc(); hcb_definitions = PStackAlloc(); state = process_options(argc, argv); OpenGlobalOut(outname); print_info(); if(state->argc == 0) { CLStateInsertArg(state, "-"); } proofstate = parse_spec(state, parse_format, error_on_empty, free_symb_prop, &parsed_ax_no); relevancy_pruned += ProofStateSinE(proofstate, sine); relevancy_pruned += ProofStatePreprocess(proofstate, relevance_prune_level); if(strategy_scheduling) { ExecuteSchedule(StratSchedule, h_parms, print_rusage); } FormulaSetDocInital(GlobalOut, OutputLevel, proofstate->f_axioms); ClauseSetDocInital(GlobalOut, OutputLevel, proofstate->axioms); if(prune_only) { fprintf(GlobalOut, "\n# Pruning successful!\n"); TSTPOUT(GlobalOut, "Unknown"); goto cleanup1; } if(relevancy_pruned || incomplete) { proofstate->state_is_complete = false; } if(BuildProofObject) { FormulaSetArchive(proofstate->f_axioms, proofstate->f_ax_archive); } if((neg_conjectures = FormulaSetPreprocConjectures(proofstate->f_axioms, proofstate->f_ax_archive, answer_limit>0, conjectures_are_questions))) { VERBOUT("Negated conjectures.\n"); } if(FormulaSetCNF(proofstate->f_axioms, proofstate->f_ax_archive, proofstate->axioms, proofstate->original_terms, proofstate->freshvars, proofstate->gc_original_terms)) { VERBOUT("CNFization done\n"); } ProofStateInitWatchlist(proofstate, watchlist_filename, parse_format); raw_clause_no = proofstate->axioms->members; if(!no_preproc) { if(BuildProofObject) { ClauseSetArchive(proofstate->ax_archive, proofstate->axioms); if(proofstate->watchlist) { ClauseSetArchive(proofstate->ax_archive, proofstate->watchlist); } } preproc_removed = ClauseSetPreprocess(proofstate->axioms, proofstate->watchlist, proofstate->archive, proofstate->tmp_terms, eqdef_incrlimit, eqdef_maxclauses); } proofcontrol = ProofControlAlloc(); ProofControlInit(proofstate, proofcontrol, h_parms, fvi_parms, wfcb_definitions, hcb_definitions); PCLFullTerms = pcl_full_terms; /* Preprocessing always uses full terms, so we set the flag for the main proof search only now! */ ProofStateInit(proofstate, proofcontrol); VERBOUT2("Prover state initialized\n"); preproc_time = GetTotalCPUTime(); if(print_rusage) { fprintf(GlobalOut, "# Preprocessing time : %.3f s\n", preproc_time); } if(proofcontrol->heuristic_parms.presat_interreduction) { LiteralSelectionFun sel_strat = proofcontrol->heuristic_parms.selection_strategy; proofcontrol->heuristic_parms.selection_strategy = SelectNoGeneration; success = Saturate(proofstate, proofcontrol, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX); fprintf(GlobalOut, "# Presaturation interreduction done\n"); proofcontrol->heuristic_parms.selection_strategy = sel_strat; if(!success) { ProofStateResetProcessed(proofstate, proofcontrol); } } PERF_CTR_ENTRY(SatTimer); if(!success) { success = Saturate(proofstate, proofcontrol, step_limit, proc_limit, unproc_limit, total_limit, answer_limit); } PERF_CTR_EXIT(SatTimer); out_of_clauses = ClauseSetEmpty(proofstate->unprocessed); if(filter_sat) { filter_success = ProofStateFilterUnprocessed(proofstate, proofcontrol, filterdesc); if(filter_success) { success = filter_success; PStackPushP(proofstate->extract_roots, success); } } if(success||proofstate->answer_count) { assert(!PStackEmpty(proofstate->extract_roots)); if(success) { DocClauseQuoteDefault(2, success, "proof"); } fprintf(GlobalOut, "\n# Proof found!\n"); if(!proofstate->status_reported) { TSTPOUT(GlobalOut, neg_conjectures?"Theorem":"Unsatisfiable"); proofstate->status_reported = true; retval = PROOF_FOUND; } if(BuildProofObject) { DerivationComputeAndPrint(GlobalOut, proofstate->extract_roots, proofstate->signature, proof_graph); } } else if(proofstate->watchlist && ClauseSetEmpty(proofstate->watchlist)) { ProofStatePropDocQuote(GlobalOut, OutputLevel, CPSubsumesWatch, proofstate, "final_subsumes_wl"); fprintf(GlobalOut, "\n# Watchlist is empty!\n"); TSTPOUT(GlobalOut, "ResourceOut"); retval = RESOURCE_OUT; } else { if(out_of_clauses&& proofstate->state_is_complete&& (inf_sys_complete || assume_inf_sys_complete)) { finals_state = "final"; } ProofStatePropDocQuote(GlobalOut, OutputLevel, CPIgnoreProps, proofstate, finals_state); if(cnf_only) { fprintf(GlobalOut, "\n# CNFization successful!\n"); TSTPOUT(GlobalOut, "Unknown"); } else if(out_of_clauses) { if(!(inf_sys_complete || assume_inf_sys_complete)) { fprintf(GlobalOut, "\n# Clause set closed under " "restricted calculus!\n"); if(!SilentTimeOut) { TSTPOUT(GlobalOut, "GaveUp"); } retval = INCOMPLETE_PROOFSTATE; } else if(proofstate->state_is_complete && inf_sys_complete) { fprintf(GlobalOut, "\n# No proof found!\n"); TSTPOUT(GlobalOut, neg_conjectures?"CounterSatisfiable":"Satisfiable"); sat_status = "Saturation"; retval = SATISFIABLE; } else { fprintf(GlobalOut, "\n# Failure: Out of unprocessed clauses!\n"); if(!SilentTimeOut) { TSTPOUT(GlobalOut, "GaveUp"); } retval = INCOMPLETE_PROOFSTATE; } } else { fprintf(GlobalOut, "\n# Failure: User resource limit exceeded!\n"); if(!SilentTimeOut) { TSTPOUT(GlobalOut, "ResourceOut"); } retval = RESOURCE_OUT; } if(BuildProofObject && (retval!=INCOMPLETE_PROOFSTATE)&& (retval!=RESOURCE_OUT)) { ClauseSetPushClauses(proofstate->extract_roots, proofstate->processed_pos_rules); ClauseSetPushClauses(proofstate->extract_roots, proofstate->processed_pos_eqns); ClauseSetPushClauses(proofstate->extract_roots, proofstate->processed_neg_units); ClauseSetPushClauses(proofstate->extract_roots, proofstate->processed_non_units); if(cnf_only) { ClauseSetPushClauses(proofstate->extract_roots, proofstate->unprocessed); print_sat = false; } DerivationComputeAndPrint(GlobalOut, proofstate->extract_roots, proofstate->signature, proof_graph); } } /* ClauseSetDerivationStackStatistics(proofstate->unprocessed); */ if(print_sat) { if(proofstate->non_redundant_deleted) { fprintf(GlobalOut, "\n# Saturated system is incomplete!\n"); } if(success) { fprintf(GlobalOut, "# Saturated system contains the empty clause:\n"); ClausePrint(GlobalOut, success, true); fputc('\n',GlobalOut); fputc('\n',GlobalOut); } ProofStatePrintSelective(GlobalOut, proofstate, outdesc, outinfo); fprintf(GlobalOut, "\n"); } if(success) { ClauseFree(success); } fflush(GlobalOut); print_proof_stats(proofstate, parsed_ax_no, relevancy_pruned, raw_clause_no, preproc_removed); #ifndef FAST_EXIT #ifdef FULL_MEM_STATS fprintf(GlobalOut, "# sizeof TermCell : %ld\n" "# sizeof EqnCell : %ld\n" "# sizeof ClauseCell : %ld\n" "# sizeof PTreeCell : %ld\n" "# sizeof PDTNodeCell : %ld\n" "# sizeof EvalCell : %ld\n" "# sizeof ClausePosCell: %ld\n" "# sizeof PDArrayCell : %ld\n", sizeof(TermCell), sizeof(EqnCell), sizeof(ClauseCell), sizeof(PTreeCell), sizeof(PDTNodeCell), sizeof(EvalCell), sizeof(ClausePosCell), sizeof(PDArrayCell)); fprintf(GlobalOut, "# Estimated memory usage: %ld\n", ProofStateStorage(proofstate)); MemFreeListPrint(GlobalOut); #endif ProofControlFree(proofcontrol); #endif cleanup1: #ifndef FAST_EXIT ProofStateFree(proofstate); CLStateFree(state); PStackFree(hcb_definitions); PStackFree(wfcb_definitions); FVIndexParmsFree(fvi_parms); HeuristicParmsFree(h_parms); #ifdef FULL_MEM_STATS MemFreeListPrint(GlobalOut); #endif #endif if(print_rusage && !SilentTimeOut) { PrintRusage(GlobalOut); } #ifdef CLB_MEMORY_DEBUG RegMemCleanUp(); MemFlushFreeList(); MemDebugPrintStats(stdout); #endif OutClose(GlobalOut); return retval; }
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; }
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););