123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676(* This file is free software, part of Zipperposition. See file "license" for more details. *)(** {1 Implementation of Phases} *)openLogtkopenLogtk_parsersopenLogtk_proofsopenLibzipperpositionopenLibzipperposition_calculiopenPhases.InfixmoduleT=TermmoduleO=OrderingmoduleLit=Literalletsection=Const.sectionlet_db_w=ref1let_lmb_w=ref1let_kbo_wf=ref"invfreqrank"let_prec_fun=ref"invfreq"let_trim_implications=reffalselet_take_only_defs=reffalselet_ignore_k_most_common_symbols=refNonelet_take_conj_defs=reftruelet_sine_d_min=ref1let_sine_d_max=ref5let_sine_tolerance=ref1.5let_sine_threshold=ref(-1)(** setup an alarm for abrupt stop *)letsetup_alarmtimeout=lethandler_=Format.printf"%% SZS status ResourceOut@.";exit0inignore(Sys.signalSys.sigalrm(Sys.Signal_handlehandler));Unix.alarm(max1(int_of_floattimeout))(* TODO: move into Zipperposition *)letprint_version~params=ifparams.Params.versionthen(Format.printf"zipperposition %s@."Const.version;exit0)(* have a list of extensions that should be loaded, and load them
in phase Phases.LoadExtension
FIXME: still too global? *)(* TODO: just use a list, not "register" *)letload_extensions=letopenLibzipperposition_calculiinPhases.start_phasePhases.LoadExtensions>>=fun()->Extensions.registerLazy_cnf.extension;Extensions.registerCombinators.extension;Extensions.registerHigher_order.extension;Extensions.registerSuperposition.extension;Extensions.registerBce_pe_fixpoint.extension;Extensions.registerBce.extension;Extensions.registerPred_elim.extension;Extensions.registerHlt_elim.extension;Extensions.registerAC.extension;Extensions.registerHeuristics.extension;Extensions.registerLibzipperposition_avatar.extension;Extensions.registerEnumTypes.extension;Extensions.registerLibzipperposition_induction.extension;Extensions.registerRewriting.extension;Extensions.registerInd_types.extension;Extensions.registerFool.extension;Extensions.registerBooleans.extension;Extensions.registerLift_lambdas.extension;Extensions.registerBool_encode.extension;Extensions.registerApp_encode.extension;Extensions.registerEq_encode.extension;Extensions.registerPure_literal_elim.extension;letl=Extensions.extensions()inPhases.return_phasel(* apply functions of [field e], for each extensions [e], to update
the current state given some parameter [x]. *)letdo_extensions~x~field=Extensions.extensions()|>Phases.fold_l~x:()~f:(fun()e->Phases.fold_l(fielde)~x:()~f:(fun()f->Phases.update~f:(fx)))letapply_modifiers~fieldo=Extensions.extensions()|>CCList.fold_left(funoe->fielde|>CCList.fold_left(funom->mo)o)oletstart_filefile=Phases.start_phasePhases.Start_file>>=fun()->Util.debugf~section1"@[@{<Yellow>### process file@ `%s` ###@}@]"(funk->kfile);do_extensions~field:(fune->e.Extensions.start_file_actions)~x:file>>=fun()->Phases.return_phase()letparse_prelude(params:Params.t)=Phases.start_phasePhases.Parse_prelude>>=fun()->letprelude_files=params.Params.preludeinletres=ifCCVector.is_emptyprelude_filesthenCCResult.returnIter.emptyelse(CCVector.to_listprelude_files|>CCResult.map_l(funfile->Util.debugf~section1"@[@{<Yellow>### parse prelude file@ `%s` ###@}@]"(funk->kfile);letfmt=Parsing_utils.guess_inputfileinParsing_utils.parse_filefmtfile)|>CCResult.mapIter.of_list|>CCResult.mapIter.flatten)inPhases.return_phase_errresletparse_filefile=Phases.start_phasePhases.Parse_file>>=fun()->letinput=Parsing_utils.input_of_filefileinParsing_utils.parse_fileinputfile>>?=funparsed->do_extensions~field:(fune->e.Extensions.post_parse_actions)~x:parsed>>=fun()->Phases.return_phase(input,parsed)lethas_arithstmt:bool=letmoduleTS=TypedSTerminletis_arithty=TS.equaltyTS.Ty.real||TS.equaltyTS.Ty.intinbeginCCVector.to_iterstmt|>Iter.flat_mapStatement.Seq.to_iter|>Iter.flat_map(function|`Tyty->Iter.returnty|`Termt|`Formt->TS.Seq.subtermst|>Iter.filter_mapTS.ty|`ID_->Iter.empty)|>Iter.existsis_arithendletsine_filterstmts=if(!_sine_threshold<0||CCVector.lengthstmts<!_sine_threshold)then(stmts)else(letseq=CCVector.to_iterstmtsinletfiltered=Statement.sine_axiom_selector~ignore_k_most_common_symbols:!_ignore_k_most_common_symbols~take_conj_defs:!_take_conj_defs~take_only_defs:!_take_only_defs~trim_implications:!_trim_implications~depth_start:!_sine_d_min~depth_end:!_sine_d_max~tolerance:!_sine_toleranceseqinCCVector.freeze(CCVector.of_iterfiltered))lettyping~fileprelude(input,stmts)=Phases.start_phasePhases.Typing>>=fun()->Phases.get_keyParams.key>>=funparams->letdef_as_rewrite=params.Params.def_as_rewriteinTypeInference.infer_statements~on_var:(Input_format.on_varinput)~on_undef:(Input_format.on_undef_idinput)~on_shadow:(Input_format.on_shadowinput)~implicit_ty_args:(Input_format.implicit_ty_argsinput)~def_as_rewrite?ctx:None~file(Iter.appendpreludestmts)>>?=funstmts->letstmts=sine_filterstmtsinUtil.debugf~section3"@[<hv2>@{<green>typed statements@}@ %a@]"(funk->k(Util.pp_iterStatement.pp_input)(CCVector.to_iterstmts));beginifhas_arithstmtsthen(Util.debug~section1"problem contains arithmetic, lost completeness";Phases.set_keyCtx.Key.lost_completenesstrue)elseif!_sine_threshold>=0then(Util.debug~section1"sine is applied, lost completeness";Phases.set_keyCtx.Key.lost_completenesstrue)elsePhases.return()end>>=fun()->do_extensions~field:(fune->e.Extensions.post_typing_actions)~x:stmts>>=fun()->Phases.return_phasestmts(* obtain clauses *)letcnf~sk_ctxdecls=Phases.start_phasePhases.CNF>>=fun()->letopts=if!Lazy_cnf.enabledthen[Cnf.LazyCnf]else[]inletstmts=decls|>CCVector.to_iter|>Cnf.cnf_of_iter~ctx:sk_ctx~opts|>CCVector.to_iter|>apply_modifiers~field:(fune->e.Extensions.post_cnf_modifiers)|>Cnf.convertindo_extensions~field:(fune->e.Extensions.post_cnf_actions)~x:stmts>>=fun()->Phases.return_phasestmts(* compute a precedence *)letcompute_prec~signaturestmts=Phases.start_phasePhases.Compute_prec>>=fun()->(* use extensions *)Phases.get>>=funstate->letcp=Extensions.extensions()|>List.fold_left(funcpe->List.fold_left(funcpf->fstatecp)cpe.Extensions.prec_actions)Compute_prec.empty(* add constraint about inductive constructors, etc. *)|>Compute_prec.add_constr10Classify_cst.prec_constr|>Compute_prec.set_weight_rule(funstmts->letsym_depth=stmts|>Iter.flat_mapStatement.Seq.terms|>Iter.flat_map(funt->Term.Seq.subterms_deptht|>Iter.filter_map(fun(st,d)->CCOpt.map(funid->(id,d))(Term.headst)))inletlits=Iter.flat_map(Statement.Seq.lits)stmtsinPrecedence.weight_fun_of_string~signature~lits~lm_w:!_lmb_w~db_w:!_db_w!_kbo_wfsym_depth)(* |> Compute_prec.set_weight_rule (fun _ -> Classify_cst.weight_fun) *)(* use "invfreq", with low priority *)|>Compute_prec.add_constr_rule90(funseq->letsyms=Signature.Seq.symbolssignatureinPrecedence.Constr.prec_fun_of_str!_prec_fun~signaturesyms)inletprec=Compute_prec.mk_precedence~signature~db_w:!_db_w~lmb_w:!_lmb_wcpstmtsinPhases.return_phaseprecletcompute_ord_selectprecedence=Phases.start_phasePhases.Compute_ord_select>>=fun()->Phases.get_keyParams.key>>=funparams->letord=Ordering.by_name!(params.Params.ord)precedenceinUtil.debugf~section2"@[<2>ordering %s@]"(funk->k(Ordering.nameord));letselect=Selection.from_string~ordparams.Params.selectindo_extensions~field:(fune->e.Extensions.ord_select_actions)~x:(ord,select)>>=fun()->Util.debugf~section2"@[<2>selection function:@ %s@]"(funk->kparams.Params.select);Phases.return_phase(ord,select)letmake_ctx~signature~ord~select~sk_ctx()=Phases.start_phasePhases.MakeCtx>>=fun()->letmoduleRes=structletsignature=signatureletord=ordletselect=selectletsk_ctx=sk_ctxendinletmoduleMyCtx=Ctx.Make(Res)inletctx=(moduleMyCtx:Ctx_intf.S)inPhases.get>>=funst->(* did any previous extension break completeness? *)letlost_comp=Flex_state.get_or~or_:falseCtx.Key.lost_completenessstiniflost_compthenMyCtx.lost_completeness();do_extensions~field:(fune->e.Extensions.ctx_actions)~x:ctx>>=fun()->Phases.return_phasectxletmake_env~ctx:(moduleCtx:Ctx_intf.S)~paramsstmts=Phases.start_phasePhases.MakeEnv>>=fun()->Phases.get>>=funstate->letmoduleMyEnv=Env.Make(structmoduleCtx=Ctxletparams=paramsletflex_state=stateend)inletenv1=(moduleMyEnv:Env.S)in(* use extensions to customize env *)Extensions.extensions()|>List.iter(fune->List.iter(funf->fenv1)e.Extensions.env_actions);(* convert statements to clauses *)letc_sets=MyEnv.convert_input_statementsstmtsinletenv2=(moduleMyEnv:Env.SwithtypeC.t=MyEnv.C.t)inPhases.return_phase(Phases.Env_clauses(env2,c_sets))(* FIXME: move this into Env! *)lethas_goal_=reffalse(* print stats *)letprint_stats_env(typec)(moduleEnv:Env.SwithtypeC.t=c)=letcomment=Options.comment()inletprint_hashcons_statswhat(sz,num,sum_length,small,median,big)=Format.printf"@[<h>%shashcons stats for %s: size %d, num %d, sum length %d, \
buckets: small %d, median %d, big %d@]@."commentwhatsznumsum_lengthsmallmedianbigandprint_state_stats(num_active,num_passive,num_simpl)=Format.printf"%sproof state stats: {active %d, passive %d, simpl %d}@."commentnum_activenum_passivenum_simpl;inifEnv.params.Params.statsthen(print_hashcons_stats"terms"(InnerTerm.hashcons_stats());print_state_stats(Env.stats());)(* print stats *)letprint_stats()=Phases.start_phasePhases.Print_stats>>=fun()->Signal.sendSignals.on_print_stats();letcomment=Options.comment()inletprint_gc()=letstats=Gc.stat()inFormat.printf"@[<h>%sGC: minor words %.0f; major_words: %.0f; max_heap: %d; \
minor collections %d; major collections %d@]@."commentstats.Gc.minor_wordsstats.Gc.major_wordsstats.Gc.top_heap_wordsstats.Gc.minor_collectionsstats.Gc.major_collections;inPhases.get_keyParams.key>>=funparams->ifparams.Params.statsthen(print_gc();Util.print_global_stats~comment(););Phases.return_phase()(* pre-saturation *)letpresaturate_clauses(typec)(moduleEnv:Env.SwithtypeC.t=c)(c_sets:cClause.sets)=Phases.start_phasePhases.Pre_saturate>>=fun()->letmoduleSat=Saturate.Make(Env)inletnum_clauses=CCVector.lengthc_sets.Clause.c_setinifEnv.params.Params.presaturatethen(Util.debug~section1"presaturate initial clauses";Env.add_passive(CCVector.to_iterc_sets.Clause.c_set);letresult,num=Sat.presaturate()inUtil.debugf~section1"initial presaturation in %d steps"(funk->knum);(* pre-saturated set of clauses *)letc_set=Env.get_active()|>CCVector.of_iter|>CCVector.freezeinletclauses={c_setswithClause.c_set;}in(* remove clauses from [env] *)Env.remove_active(CCVector.to_iterc_set);Env.remove_passive(CCVector.to_iterc_set);Util.debugf~section2"@[<2>%d clauses pre-saturated into:@ @[<hv>%a@]@]"(funk->knum_clauses(Util.pp_iter~sep:" "Env.C.pp)(CCVector.to_iterc_set));Phases.return_phase(result,clauses))elsePhases.return_phase(Saturate.Unknown,c_sets)(* try to refute the set of clauses contained in the [env]. Parameters are
used to influence how saturation is done, for how long it runs, etc. *)lettry_to_refute(typec)(moduleEnv:Env.SwithtypeC.t=c)clausesresult=Phases.start_phasePhases.Saturate>>=fun()->letmoduleSat=Saturate.Make(Env)in(* add clauses to passive set of [env], and SOS to active set *)ifnot(CCVector.is_emptyclauses.Clause.c_sos)then(Env.Ctx.lost_completeness(););Env.add_active(CCVector.to_iterclauses.Clause.c_sos);Env.add_passive(CCVector.to_iterclauses.Clause.c_set);letsteps=ifEnv.params.Params.steps<0thenNoneelse(Util.debugf~section1"run for %d steps"(funk->kEnv.params.Params.steps);SomeEnv.params.Params.steps)andtimeout=ifEnv.params.Params.timeout=0.thenNoneelse(Util.debugf~section1"run for %.3f s"(funk->kEnv.params.Params.timeout);(* FIXME: only do that for zipperposition, not the library? *)ignore(setup_alarmEnv.params.Params.timeout);Some(Util.total_time_s()+.Env.params.Params.timeout-.0.25))inUtil.debugf~section1"active: @[%a@]"(funk->k(Iter.pp_seqEnv.C.pp)(Env.get_active()));Util.debugf~section1"passive: @[%a@]"(funk->k(Iter.pp_seqEnv.C.pp)(Env.get_passive()));Signal.sendEnv.on_start();letresult,num=matchresultwith|Saturate.Unsat_->result,0(* already found unsat during presaturation *)|_->Sat.given_clause~generating:true?steps?timeout()inletcomment=Options.comment()inFormat.printf"%sdone %d iterations in %.3fs@."commentnum(Util.total_time_s());Util.debugf~section1"@[<2>final precedence:@ @[%a@]@]"(funk->kPrecedence.pp(Env.precedence()));Phases.return_phaseresult(* Print some content of the state, based on environment variables *)letprint_dots(typec)(moduleEnv:Env_intf.SwithtypeC.t=c)(result:Saturate.szs_status)=Phases.start_phasePhases.Print_dot>>=fun()->Signal.sendSignals.on_dot_output();(* see if we need to print proof state *)beginmatchEnv.params.Params.dot_file,resultwith|Somedot_f,Saturate.Unsatproof->letname="unsat_graph"in(* print proof of false *)letproof=ifEnv.params.Params.dot_all_rootsthenEnv.(Iter.append(get_active())(get_passive()))|>Iter.filter_map(func->ifLiterals.is_absurd(Env.C.litsc)thenSome(Env.C.proofc)elseNone)elseIter.singletonproofinProof.S.pp_dot_seq_file~namedot_fproof|Somedot_f,(Saturate.Sat|Saturate.Unknown)whenEnv.params.Params.dot_sat->(* print saturated set *)letname="sat_set"inletseq=Iter.append(Env.get_active())(Env.get_passive())inletseq=Iter.mapEnv.C.proofseqinProof.S.pp_dot_seq_file~namedot_fseq|_->()end;Phases.return_phase()(* TODO: parametrize, remove side effect *)letsat_to_str()=if!has_goal_then"CounterSatisfiable"else"Satisfiable"letunsat_to_str()=if!has_goal_then"Theorem"else"Unsatisfiable"letprint_szs_result(typec)~file(moduleEnv:Env_intf.SwithtypeC.t=c)(result:Saturate.szs_status)=Phases.start_phasePhases.Print_result>>=fun()->letcomment=Options.comment()inbeginmatchresultwith|Saturate.Unknown|Saturate.Timeout->Format.printf"%sSZS status ResourceOut for '%s'@."commentfile|Saturate.Errors->Format.printf"%sSZS status InternalError for '%s'@."commentfile;Util.debugf~section1"error is:@ %s"(funk->ks);|Saturate.SatwhenEnv.Ctx.is_completeness_preserved()->Format.printf"%% Final clauses: %d@."(Iter.length(Env.get_active()));Format.printf"%sSZS status %s for '%s'@."comment(sat_to_str())file|Saturate.Sat->Format.printf"%% Final clauses: %d@."(Iter.length(Env.get_active()));Format.printf"%sSZS status GaveUp for '%s'@."commentfile;beginmatch!Options.outputwith|Options.O_none->()|Options.O_zf->failwith"not implemented: printing in ZF"(* TODO *)|Options.O_tptp->Util.debugf~section1"@[<2>saturated set:@ @[<hv>%a@]@]"(funk->k(Util.pp_iter~sep:" "Env.C.pp_tstp_full)(Env.get_active()))|Options.O_normal->Util.debugf~section1"@[<2>saturated set:@ @[<hv>%a@]@]"(funk->k(Util.pp_iter~sep:" "Env.C.pp)(Env.get_active()))end|Saturate.Unsatproof->(* print status then proof *)Format.printf"%sSZS status %s for '%s'@."comment(unsat_to_str())file;Format.printf"%sSZS output start Refutation@."comment;Format.printf"%a@."(Proof.S.pp_in!Options.output)proof;Format.printf"%sSZS output end Refutation@."comment;end;Phases.return_phase()(* print weight of [s] within precedence [prec] *)letpp_weightprecouts=Format.fprintfout"w(%a)=%a"ID.ppsPrecedence.Weight.pp(Precedence.weightprecs)(* does the sequence of declarations contain at least one conjecture? *)lethas_goal_decls_decls=CCVector.exists(funst->matchStatement.viewstwith|Statement.Goal_->true|_->false)decls(* parse CLI options and list of files to deal with *)letparse_cli=Phases.start_phasePhases.Parse_CLI>>=fun()->CCFormat.set_color_defaulttrue;(* parse arguments *)letparams=Params.parse_args()inletfiles=CCVector.to_listparams.Params.filesinPhases.set_keyParams.keyparams>>=fun()->print_version~params;Phases.return_phase(files,params)letsyms_in_conjdecls=letopenIterindecls|>CCVector.to_iter|>flat_map(funst->letpr=Statement.proof_stepstinifCCOpt.is_some(Proof.Step.distance_to_goalpr)then(Statement.Seq.symbolsst)elseempty)(* Process the given file (try to solve it) *)letprocess_file?(prelude=Iter.empty)file=start_filefile>>=fun()->parse_filefile>>=funstmts->typing~filepreludestmts>>=fundecls->(* declare inductive types and constants *)CCVector.iterStatement.scan_simple_stmt_for_ind_tydecls;lethas_goal=has_goal_decls_declsinUtil.debugf~section1"parsed %d declarations (%s goal(s))"(funk->k(CCVector.lengthdecls)(ifhas_goalthen"some"else"no"));lettransformed=Booleans.preprocess_booleans(Rewriting.unfold_def_before_cnfdecls)inletsk_ctx=Skolem.create()incnf~sk_ctxtransformed>>=funstmts->(* Removed it because it is painfully slow (@VISA.) *)(* let stmts = Booleans.preprocess_cnf_booleans stmts in *)(* compute signature, precedence, ordering *)letconj_syms=syms_in_conjstmtsinletsignature=Statement.signature~conj_syms:conj_syms(CCVector.to_iterstmts)incompute_prec~signature(CCVector.to_iterstmts)>>=funprecedence->Util.debugf~section1"@[<2>precedence:@ @[%a@]@]"(funk->kPrecedence.ppprecedence);compute_ord_selectprecedence>>=fun(ord,select)->(* HO *)Phases.get_keyParams.key>>=funparams->(* build the context and env *)make_ctx~signature~ord~select~sk_ctx()>>=functx->make_env~params~ctxstmts>>=fun(Phases.Env_clauses(env,clauses))->(* main workload *)has_goal_:=has_goal;(* FIXME: should be computed at Env initialization *)(* pre-saturation *)presaturate_clausesenvclauses>>=fun(result,clauses)->(* saturate, possibly changing env *)try_to_refuteenvclausesresult>>=funresult->Phases.return(Phases.Env_result(env,result))letprintfileenvresult=(* print some statistics *)print_stats_envenv;print_szs_result~fileenvresult>>=fun()->print_dotsenvresultletcheckres=Phases.start_phasePhases.Check_proof>>=fun()->Phases.get_keyParams.key>>=funparams->letcomment=Options.comment()inleterrcode=matchreswith|Saturate.Unsatpwhenparams.Params.check->(* check proof! *)Util.debug~section1"start checking proof…";letp'=LLProof_conv.convpin(* check *)letstart=Util.total_time_s()inletdot_prefix=params.Params.dot_checkinletres,stats=LLProof_check.check?dot_prefixp'inletstop=Util.total_time_s()inFormat.printf"%s(@[<h>proof_check@ :res %a@ :stats %a :time %.3fs@])@."commentLLProof_check.pp_resresLLProof_check.pp_statsstats(stop-.start);(* print proof? (do it after check, results are cached) *)beginmatchparams.Params.dot_llproofwith|None->()|Somefile->Util.debugf~section2"print LLProof into `%s`"(funk->kfile);LLProof.Dot.pp_dot_filefilep';end;(* exit code *)ifres=LLProof_check.R_failthen15else0|_->0inPhases.return_phaseerrcodeletsetup_gc=Phases.start_phasePhases.Setup_gc>>=fun()->(* GC! increase max overhead because we want the GC to be faster, even if
it implies more wasted memory. *)letgc=Gc.get()inGc.set{gcwithGc.space_overhead=150;};Phases.return_phase()letsetup_signal=Phases.start_phasePhases.Setup_signal>>=fun()->(* signal handler. Re-raise, bugs shouldn't keep hidden *)Signal.set_exn_handler(fune->letstack=Printexc.get_backtrace()inletmsg=Printexc.to_stringeinoutput_stringstderr("exception raised in signal: "^msg^"\n");output_stringstderrstack;flushstderr;raisee);Phases.return_phase()(* process several files, printing the result *)letprocess_files_and_print?(params=Params.default)files=parse_preludeparams>>=funprelude->letffile=process_file~preludefile>>=fun(Phases.Env_result(env,res))->printfileenvres>>=fun()->checkresinletphases=List.mapffilesinPhases.run_parallelphases>>=funr->print_stats()>>=fun()->Phases.returnrletmain_cli?setup_gc:(gc=true)()=letopenPhases.Infixin(ifgcthensetup_gcelsePhases.return())>>=fun()->setup_signal>>=fun()->parse_cli>>=fun(files,params)->load_extensions>>=fun_->process_files_and_print~paramsfiles>>=funerrcode->Phases.exit>|=fun()->errcodeletskip_parse_cli?(params=Params.default)file=Phases.start_phasePhases.Parse_CLI>>=fun()->CCFormat.set_color_defaulttrue;Phases.set_keyParams.keyparams>>=fun()->Phases.return_phase([file],params)letmain?setup_gc:(gc=true)?paramsfile=letopenPhases.Infixin(ifgcthensetup_gcelsePhases.return())>>=fun()->(* pseudo-parse *)skip_parse_cli?paramsfile>>=fun(files,params)->load_extensions>>=fun_->process_files_and_print~paramsfiles>>=funerrcode->Phases.exit>|=fun()->errcodelet()=letopenLibzipperpositioninParams.add_opts["--de-bruijn-weight",Arg.Set_int_db_w," Set weight of de Bruijn index for KBO";"--lambda-weight",Arg.Set_int_lmb_w," Set weight of lambda symbol for KBO";"--kbo-weight-fun",Arg.Set_string_kbo_wf," Set the function for symbol weight calculation.";"--prec-gen-fun",Arg.Set_string_prec_fun," Set the function used for precedence generation";"--sine-depth-min",Arg.Int(funv->if!_sine_threshold==(-1)then_sine_threshold:=100;_sine_d_min:=v)," Turn on SinE with threshold and set min SinE depth.";"--sine-depth-max",Arg.Int(funv->if!_sine_threshold==(-1)then_sine_threshold:=100;_sine_d_max:=v)," Turn on SinE with threshold and set max SinE depth.";"--sine-tolerance",Arg.Float(funv->if!_sine_threshold==(-1)then_sine_threshold:=100;_sine_tolerance:=v)," Turn on SinE with threshold of 100 and set SinE symbol tolerance.";"--sine-trim-implications",Arg.Bool((:=)_trim_implications)," trim long implications while getting symbols from conjecture";"--sine-take-only-defs",Arg.Bool((:=)_take_only_defs)," take only axioms marked as definitions and the conjecture";"--sine-ignore-k-most-common-syms",Arg.Int(funv->_ignore_k_most_common_symbols:=Somev)," if conjecture symbol is within k most common occurring ones, then it will be disregarded as conjecture symbol";"--sine-take-conj-defs",Arg.Bool((:=)_take_conj_defs)," force taking definitions of symbols ocurring in conjecture";"--sine",Arg.Set_int_sine_threshold," Set SinE axiom number threshold (negative number turns it off)"^" with default settings: depth in range 1-5 and tolerance 1.5"];Params.add_to_mode"ho-pragmatic"(fun()->_lmb_w:=20;_db_w:=10;);Params.add_to_mode"ho-complete-basic"(fun()->_lmb_w:=20;_db_w:=10;);Params.add_to_mode"ho-competitive"(fun()->_lmb_w:=20;_db_w:=10;);