123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570(******************************************************************************)(* *)(* The Alt-Ergo theorem prover *)(* Copyright (C) 2006-2013 *)(* *)(* Sylvain Conchon *)(* Evelyne Contejean *)(* *)(* Francois Bobot *)(* Mohamed Iguernelala *)(* Stephane Lescuyer *)(* Alain Mebsout *)(* *)(* CNRS - INRIA - Universite Paris Sud *)(* *)(* This file is distributed under the terms of the Apache Software *)(* License version 2.0 *)(* *)(* ------------------------------------------------------------------------ *)(* *)(* Alt-Ergo: The SMT Solver For Software Verification *)(* Copyright (C) 2013-2018 --- OCamlPro SAS *)(* *)(* This file is distributed under the terms of the Apache Software *)(* License version 2.0 *)(* *)(******************************************************************************)(* Formatter declarations, getters and setters *)letfmt_std=refFormat.std_formatterletfmt_err=refFormat.err_formatterletfmt_wrn=refFormat.err_formatterletfmt_dbg=refFormat.err_formatterletfmt_mdl=refFormat.std_formatterletfmt_usc=refFormat.std_formatterletset_std_fmtf=fmt_std:=f;fmt_mdl:=f;fmt_usc:=fletset_err_fmtf=fmt_err:=f;fmt_wrn:=f;fmt_dbg:=fletget_fmt_std()=!fmt_stdletget_fmt_err()=!fmt_errletget_fmt_wrn()=!fmt_wrnletget_fmt_dbg()=!fmt_dbgletget_fmt_mdl()=!fmt_mdlletget_fmt_usc()=!fmt_uscletset_fmt_stdf=fmt_std:=fletset_fmt_errf=fmt_err:=fletset_fmt_wrnf=fmt_wrn:=fletset_fmt_dbgf=fmt_dbg:=fletset_fmt_mdlf=fmt_mdl:=fletset_fmt_uscf=fmt_usc:=f(* Declaration of all the options as refs with default values *)typemodel=MNone|MDefault|MAll|MCompletetypeinstantiation_heuristic=INormal|IAuto|IGreedytypeinput_format=Native|Smtlib2|Why3(* | SZS *)|Unknownofstringtypeoutput_format=input_formatletmatch_extensione=matchewith|".ae"->Native|".smt2"|".psmt2"->Smtlib2|".why"|".mlw"->Why3(* | ".szs" -> SZS *)|s->Unknownstypeknown_status=Status_Sat|Status_Unsat|Status_Unknown|Status_Undefinedofstringletmatch_known_statuss=matchswith|"sat"->Status_Sat|"unsat"->Status_Unsat|"unknown"->Status_Unknown|s->Status_Undefineds(* We don't want to handle functions with more than 10 arguments so
we need to split the debug options to gather them in the end.
Problems with this way of doing is the options in each "group" are sorted
alphabetically before we split the corresponding group. Adding a new one may
break the sorting which is why each group contains 7/8/9 options as of now
to allow the adding of new ones in the right group
*)letdebug=reffalseletdebug_ac=reffalseletdebug_adt=reffalseletdebug_arith=reffalseletdebug_arrays=reffalseletdebug_bitv=reffalseletdebug_cc=reffalseletdebug_combine=reffalseletdebug_constr=reffalseletdebug_explanations=reffalseletdebug_fm=reffalseletdebug_fpa=ref0letdebug_gc=reffalseletdebug_interpretation=reffalseletdebug_ite=reffalseletdebug_matching=ref0letdebug_sat=reffalseletdebug_split=reffalseletdebug_sum=reffalseletdebug_triggers=reffalseletdebug_types=reffalseletdebug_typing=reffalseletdebug_uf=reffalseletdebug_unsat_core=reffalseletdebug_use=reffalseletdebug_warnings=reffalseletrule=ref(-1)letset_debugb=debug:=bletset_debug_acb=debug_ac:=bletset_debug_adtb=debug_adt:=bletset_debug_arithb=debug_arith:=bletset_debug_arraysb=debug_arrays:=bletset_debug_bitvb=debug_bitv:=bletset_debug_ccb=debug_cc:=bletset_debug_combineb=debug_combine:=bletset_debug_constrb=debug_constr:=bletset_debug_explanationsb=debug_explanations:=bletset_debug_fmb=debug_fm:=bletset_debug_fpai=debug_fpa:=iletset_debug_gcb=debug_gc:=bletset_debug_interpretationb=debug_interpretation:=bletset_debug_iteb=debug_ite:=bletset_debug_matchingi=debug_matching:=iletset_debug_satb=debug_sat:=bletset_debug_splitb=debug_split:=bletset_debug_sumb=debug_sum:=bletset_debug_triggersb=debug_triggers:=bletset_debug_typesb=debug_types:=bletset_debug_typingb=debug_typing:=bletset_debug_ufb=debug_uf:=bletset_debug_unsat_coreb=debug_unsat_core:=bletset_debug_useb=debug_use:=bletset_debug_warningsb=debug_warnings:=bletset_ruleb=rule:=bletget_debug()=!debugletget_debug_ac()=!debug_acletget_debug_adt()=!debug_adtletget_debug_arith()=!debug_arithletget_debug_arrays()=!debug_arraysletget_debug_bitv()=!debug_bitvletget_debug_cc()=!debug_ccletget_debug_combine()=!debug_combineletget_debug_constr()=!debug_constrletget_debug_explanations()=!debug_explanationsletget_debug_fm()=!debug_fmletget_debug_fpa()=!debug_fpaletget_debug_gc()=!debug_gcletget_debug_interpretation()=!debug_interpretationletget_debug_ite()=!debug_iteletget_debug_matching()=!debug_matchingletget_debug_sat()=!debug_satletget_debug_split()=!debug_splitletget_debug_sum()=!debug_sumletget_debug_triggers()=!debug_triggersletget_debug_types()=!debug_typesletget_debug_typing()=!debug_typingletget_debug_uf()=!debug_ufletget_debug_unsat_core()=!debug_unsat_coreletget_debug_use()=!debug_useletget_debug_warnings()=!debug_warningsletget_rule()=!rule(** Case split options *)letcase_split_policy=refUtil.AfterTheoryAssumeletenable_adts_cs=reffalseletmax_split=ref(Numbers.Q.from_int1000000)(* Case split setters *)letset_case_split_policyp=case_split_policy:=pletset_enable_adts_csb=enable_adts_cs:=bletset_max_splitn=max_split:=n(* Case split getters *)letget_case_split_policy()=!case_split_policyletget_enable_adts_cs()=!enable_adts_csletget_max_split()=!max_split(** Context options *)letreplay=reffalseletreplay_all_used_context=reffalseletreplay_used_context=reffalseletsave_used_context=reffalseletset_replayb=replay:=bletset_replay_all_used_contextb=replay_all_used_context:=bletset_replay_used_contextb=replay_used_context:=bletset_save_used_contextb=save_used_context:=bletget_replay()=!replayletget_replay_used_context()=!replay_used_contextletget_replay_all_used_context()=!replay_all_used_contextletget_save_used_context()=!save_used_context(** Execution options *)letanswers_with_loc=reftrueletoutput_with_colors=reffalseletoutput_with_headers=reftrueletoutput_with_formatting=reftrueletoutput_with_forced_flush=reftrueletfrontend=ref"legacy"letinput_format=refNativeletinfer_input_format=reftrueletparse_only=reffalseletparsers=ref[]letpreludes=ref[]lettype_only=reffalselettype_smt2=reffalseletset_answers_with_locb=answers_with_loc:=bletset_output_with_colorsb=output_with_colors:=bletset_output_with_headersb=output_with_headers:=bletset_output_with_formattingb=output_with_formatting:=bletset_output_with_forced_flushb=output_with_forced_flush:=bletset_frontendf=frontend:=fletset_input_formatf=input_format:=fletset_infer_input_formatf=infer_input_format:=(f=None)letset_parse_onlyb=parse_only:=bletset_parsersp=parsers:=pletset_preludesp=preludes:=pletset_type_onlyb=type_only:=bletset_type_smt2b=type_smt2:=bletget_answers_with_locs()=!answers_with_locletget_output_with_colors()=!output_with_colorsletget_output_with_headers()=!output_with_headersletget_output_with_formatting()=!output_with_formattingletget_output_with_forced_flush()=!output_with_forced_flushletget_frontend()=!frontendletget_input_format()=!input_formatletget_infer_input_format()=!infer_input_formatletget_parse_only()=!parse_onlyletget_parsers()=!parsersletget_preludes()=!preludesletget_type_only()=!type_onlyletget_type_smt2()=!type_smt2(** Internal options *)letdisable_weaks=reffalseletenable_assertions=reffalseletwarning_as_error=reffalseletset_disable_weaksb=disable_weaks:=bletset_enable_assertionsb=enable_assertions:=bletset_warning_as_errorb=warning_as_error:=bletget_disable_weaks()=!disable_weaksletget_enable_assertions()=!enable_assertionsletget_warning_as_error()=!warning_as_error(** Limit options *)letage_bound=ref50letfm_cross_limit=ref(Numbers.Q.from_int10_000)letsteps_bound=ref(-1)lettimelimit=ref0.lettimelimit_interpretation=ref(ifSys.win32then0.else1.)lettimelimit_per_goal=reffalseletset_age_boundi=age_bound:=iletset_fm_cross_limitl=fm_cross_limit:=lletset_steps_boundi=steps_bound:=iletset_timelimitl=timelimit:=lletset_timelimit_interpretationl=timelimit_interpretation:=lletset_timelimit_per_goall=timelimit_per_goal:=lletget_age_bound()=!age_boundletget_fm_cross_limit()=!fm_cross_limitletget_steps_bound()=!steps_boundletget_timelimit()=!timelimitletget_timelimit_interpretation()=!timelimit_interpretationletget_timelimit_per_goal()=!timelimit_per_goal(** Output options *)letinterpretation=ref0letmodel=refMNoneletoutput_format=refNativeletinfer_output_format=reftrueletunsat_core=reffalseletset_interpretationb=interpretation:=bletset_modelb=model:=bletset_output_formatb=output_format:=bletset_infer_output_formatf=infer_output_format:=f=Noneletset_unsat_coreb=unsat_core:=bletget_interpretation()=!interpretationletget_model()=!model=MDefault||!model=MCompleteletget_complete_model()=!model=MCompleteletget_all_models()=!model=MAllletget_output_format()=!output_formatletget_infer_output_format()=!infer_output_formatletget_unsat_core()=!unsat_core||!save_used_context||!debug_unsat_core(** Profiling options *)letcumulative_time_profiling=reffalseletprofiling=reffalseletprofiling_period=ref0.letprofiling_plugin=ref""letverbose=reffalseletset_cumulative_time_profilingb=cumulative_time_profiling:=bletset_profilingbf=profiling:=b;profiling_period:=ifbthenfelse0.letset_profiling_periodp=profiling_period:=pletset_profiling_pluginp=profiling_plugin:=pletset_verboseb=verbose:=bletget_cumulative_time_profiling()=!cumulative_time_profilingletget_profiling()=!profilingletget_profiling_period()=!profiling_periodletget_profiling_plugin()=!profiling_pluginletget_verbose()=!verbose(** Quantifiers options *)letinstantiation_heuristic=refIAutoletinstantiate_after_backjump=reffalseletmax_multi_triggers_size=ref4letnb_triggers=ref2letno_ematching=reffalseletno_user_triggers=reffalseletnormalize_instances=reffalselettriggers_var=reffalseletset_instantiation_heuristici=instantiation_heuristic:=iletset_instantiate_after_backjumpb=instantiate_after_backjump:=bletset_max_multi_triggers_sizeb=max_multi_triggers_size:=bletset_nb_triggersb=nb_triggers:=bletset_no_ematchingb=no_ematching:=bletset_no_user_triggersb=no_user_triggers:=bletset_normalize_instancesb=normalize_instances:=bletset_triggers_varb=triggers_var:=bletget_instantiation_heuristic()=!instantiation_heuristicletget_greedy()=!instantiation_heuristic=IGreedyletget_instantiate_after_backjump()=!instantiate_after_backjumpletget_max_multi_triggers_size()=!max_multi_triggers_sizeletget_nb_triggers()=!nb_triggersletget_no_ematching()=!no_ematchingletget_no_user_triggers()=!no_user_triggersletget_normalize_instances()=!normalize_instancesletget_triggers_var()=!triggers_var(** Sat options *)letarith_matching=reffalseletbottom_classes=reffalseletcdcl_tableaux_inst=reffalseletcdcl_tableaux_th=reffalseletdisable_flat_formulas_simplification=reffalseletenable_restarts=reffalseletminimal_bj=reffalseletno_backjumping=reffalseletno_backward=reffalseletno_decisions=reffalseletno_decisions_on=refUtil.SS.emptyletno_sat_learning=reffalseletsat_plugin=ref""letsat_solver=refUtil.CDCL_Tableauxlettableaux_cdcl=reffalseletset_arith_matchingb=arith_matching:=bletset_bottom_classesb=bottom_classes:=bletset_cdcl_tableaux_instb=cdcl_tableaux_inst:=bletset_cdcl_tableaux_thb=cdcl_tableaux_th:=bletset_disable_flat_formulas_simplificationb=disable_flat_formulas_simplification:=bletset_enable_restartsb=enable_restarts:=bletset_minimal_bjb=minimal_bj:=bletset_no_backjumpingb=no_backjumping:=bletset_no_backwardb=no_backward:=bletset_no_decisionsb=no_decisions:=bletset_no_decisions_ons=no_decisions_on:=sletset_no_sat_learningb=no_sat_learning:=bletset_sat_pluginp=sat_plugin:=pletset_sat_solvers=sat_solver:=sletset_tableaux_cdclb=tableaux_cdcl:=bletget_arith_matching()=!arith_matchingletget_bottom_classes()=!bottom_classesletget_cdcl_tableaux()=!cdcl_tableaux_th||!cdcl_tableaux_instletget_cdcl_tableaux_inst()=!cdcl_tableaux_instletget_cdcl_tableaux_th()=!cdcl_tableaux_thletget_disable_flat_formulas_simplification()=!disable_flat_formulas_simplificationletget_enable_restarts()=!enable_restartsletget_minimal_bj()=!minimal_bjletget_no_backjumping()=!no_backjumpingletget_no_backward()=!no_backwardletget_no_decisions()=!no_decisionsletget_can_decide_ons=letss=!no_decisions_oninss==Util.SS.empty||not(Util.SS.memsss)(* let get_no_decisions_on () = !no_decisions_on *)letget_no_decisions_on_is_empty()=!no_decisions_on==Util.SS.emptyletget_no_sat_learning()=!no_sat_learningletget_sat_learning()=not(!no_sat_learning)letget_sat_plugin()=!sat_pluginletget_sat_solver()=!sat_solverletget_tableaux_cdcl()=!tableaux_cdcl(** Term options *)letdisable_ites=reffalseletinline_lets=reffalseletrewriting=reffalseletterm_like_pp=reffalseletset_disable_itesb=disable_ites:=bletset_inline_letsb=inline_lets:=bletset_rewritingb=rewriting:=bletset_term_like_ppb=term_like_pp:=bletget_disable_ites()=!disable_itesletget_inline_lets()=!inline_letsletget_rewriting()=!rewritingletget_term_like_pp()=!term_like_pp(** Theory options *)letdisable_adts=reffalseletinequalities_plugin=ref""letno_ac=reffalseletno_contracongru=reffalseletno_fm=reffalseletno_nla=reffalseletno_tcp=reffalseletno_theory=reffalseletrestricted=reffalselettighten_vars=reffalseletuse_fpa=reffalseletset_disable_adtsb=disable_adts:=bletset_inequalities_pluginb=inequalities_plugin:=bletset_no_acb=no_ac:=bletset_no_contracongrub=no_contracongru:=bletset_no_fmb=no_fm:=bletset_no_nlab=no_nla:=bletset_no_tcpb=no_tcp:=bletset_no_theoryb=no_theory:=bletset_restrictedb=restricted:=bletset_tighten_varsb=tighten_vars:=bletset_use_fpab=use_fpa:=bletget_disable_adts()=!disable_adtsletget_inequalities_plugin()=!inequalities_pluginletget_no_ac()=!no_acletget_no_contracongru()=!no_contracongruletget_no_fm()=!no_fmletget_no_nla()=!no_nlaletget_no_tcp()=!no_tcpletget_no_theory()=!no_theoryletget_restricted()=!restrictedletget_tighten_vars()=!tighten_varsletget_use_fpa()=!use_fpa(** Other options *)lettimers=reffalseletfile=ref""letstatus=refStatus_Unknownletsession_file=ref""letused_context_file=ref""letjs_mode=reffalseletset_timersb=timers:=bletset_statuss=status:=match_known_statussletset_filef=file:=fletset_session_filef=session_file:=fletset_used_context_filef=used_context_file:=fletset_js_modeb=js_mode:=bletget_timers()=!timers||!profilingletget_file()=!fileletget_status()=!statusletget_session_file()=!session_fileletget_used_context_file()=!used_context_fileletget_js_mode()=!js_mode(** particular getters : functions that are immediately executed **************)letthread_yield=ref(fun()->())letset_thread_yieldf=thread_yield:=flet(timeout:(unit->unit)ref)=ref(fun()->raiseUtil.Timeout)letset_timeoutf=timeout:=fletexec_thread_yield()=!thread_yield()letexec_timeout()=!timeout()lettool_reqnmsg=ifget_rule()=nthenFormat.fprintf(get_fmt_dbg())"[rule] %s@."msg(** Simple Timer module **)moduleTime=structletu=ref0.0letstart()=u:=MyUnix.cur_time()letvalue()=MyUnix.cur_time()-.!uletset_timeout~is_guitm=MyUnix.set_timeout~is_guitmletunset_timeout~is_gui=ifget_timelimit()<>0.thenMyUnix.unset_timeout~is_guiend(** globals **)(** open Options in every module to hide polymorphic versions of Stdlib **)let(<>)(a:int)(b:int)=a<>blet(=)(a:int)(b:int)=a=blet(<)(a:int)(b:int)=a<blet(>)(a:int)(b:int)=a>blet(<=)(a:int)(b:int)=a<=blet(>=)(a:int)(b:int)=a>=bletcompare(a:int)(b:int)=Stdlib.compareab(* extra **)letis_gui=reffalseletset_is_guib=is_gui:=bletget_is_gui()=!is_guiletset_file_for_jsfilename=set_filefilename;set_js_modetrue(* Printer **)letprint_output_formatfmtmsg=matchget_output_format()with|Smtlib2->Format.fprintffmt"; %s"msg;|Native|Why3|Unknown_->Format.fprintffmt"%s"msg