Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file g_waterproof.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197let_=Mltop.add_known_module"coq-waterproof.plugin"# 21 "src/g_waterproof.mlg"moduleTac2ffi=Ltac2_plugin.Tac2ffimoduleTac2env=Ltac2_plugin.Tac2envmoduleTac2expr=Ltac2_plugin.Tac2expropenProofviewopenProofview.NotationsopenTac2expropenTac2ffiopenExceptionsopenHint_dataset_declarationsopenWaterprovelet()=Vernacextend.vernac_extend~plugin:"coq-waterproof.plugin"~command:"AutomationShieldEnableSideEff"~classifier:(fun_->Vernacextend.classify_as_sideeff)?entry:None[(Vernacextend.TyML(false,Vernacextend.TyTerminal("Waterproof",Vernacextend.TyTerminal("Enable",Vernacextend.TyTerminal("Automation",Vernacextend.TyTerminal("Shield",Vernacextend.TyNil)))),(letcoqpp_body()=Vernacextend.vtdefault(fun()-># 40 "src/g_waterproof.mlg"automation_shield:=true)infun?loc~atts()->coqpp_body(Attributes.unsupported_attributesatts)),None))]let()=Vernacextend.vernac_extend~plugin:"coq-waterproof.plugin"~command:"AutomationShieldDisableSideEff"~classifier:(fun_->Vernacextend.classify_as_sideeff)?entry:None[(Vernacextend.TyML(false,Vernacextend.TyTerminal("Waterproof",Vernacextend.TyTerminal("Disable",Vernacextend.TyTerminal("Automation",Vernacextend.TyTerminal("Shield",Vernacextend.TyNil)))),(letcoqpp_body()=Vernacextend.vtdefault(fun()-># 47 "src/g_waterproof.mlg"automation_shield:=false)infun?loc~atts()->coqpp_body(Attributes.unsupported_attributesatts)),None))]# 52 "src/g_waterproof.mlg"(** Creates a name used to define the function interface *)letpname(s:string):ml_tactic_name={mltac_plugin="coq-core.plugins.coq-waterproof";mltac_tactic=s}(** Wrapper around {! Tac2env.define_primitive} to make easier the primitive definition *)letdefine_primitive(name:string)(arity:'aarity)(f:'a):unit=Tac2env.define_primitive(pnamename)(mk_closurearityf)(**
Defines a function of arity 0 (that only take a [unit] as an argument)
This function will be callable in Ltac2 with [Ltac2 @ external <ltac2_name>: unit := "coq-waterproof" "<name>".]
*)letdefine0(name:string)(f:valexprtactic):unit=define_primitivenamearity_one(fun_->f)(**
Defines a function of arity 1 (that only take one argument)
This function will be callable in Ltac2 with [Ltac2 @ external <ltac2_name>: <type> -> unit := "coq-waterproof" "<name>".]
*)letdefine1(name:string)(r0:'arepr)(f:'a->valexprtactic):unit=define_primitivenamearity_one@@funx->f(repr_tor0x)(**
Defines a function of arity 2 of the same way than {! define1}
*)letdefine2(name:string)(r0:'arepr)(r1:'brepr)(f:'a->'b->valexprtactic):unit=define_primitivename(arity_sucarity_one)@@funxy->f(repr_tor0x)(repr_tor1y)(**
Defines a function of arity 3 of the same way than {! define1}
*)letdefine3(name:string)(r0:'arepr)(r1:'brepr)(r2:'crepr)(f:'a->'b->'c->valexprtactic):unit=define_primitivename(arity_suc(arity_sucarity_one))@@funxyz->f(repr_tor0x)(repr_tor1y)(repr_tor2z)(**
Defines a function of arity 4 of the same way than {! define1}
*)letdefine4(name:string)(r0:'arepr)(r1:'brepr)(r2:'crepr)(r3:'drepr)(f:'a->'b->'c->'d->valexprtactic):unit=define_primitivename(arity_suc(arity_suc(arity_sucarity_one)))@@funx0x1x2x3->f(repr_tor0x0)(repr_tor1x1)(repr_tor2x2)(repr_tor3x3)(**
Defines a function of arity 5 of the same way than {! define1}
*)letdefine5(name:string)(r0:'arepr)(r1:'brepr)(r2:'crepr)(r3:'drepr)(r4:'erepr)(f:'a->'b->'c->'d->'e->valexprtactic):unit=define_primitivename(arity_suc(arity_suc(arity_suc(arity_sucarity_one))))@@funx0x1x2x3x4->f(repr_tor0x0)(repr_tor1x1)(repr_tor2x2)(repr_tor3x3)(repr_tor4x4)(**
Defines a function of arity 6 of the same way than {! define1}
*)letdefine6(name:string)(r0:'arepr)(r1:'brepr)(r2:'crepr)(r3:'drepr)(r4:'erepr)(r5:'frepr)(f:'a->'b->'c->'d->'e->'f->valexprtactic):unit=define_primitivename(arity_suc(arity_suc(arity_suc(arity_suc(arity_sucarity_one)))))@@funx0x1x2x3x4x5->f(repr_tor0x0)(repr_tor1x1)(repr_tor2x2)(repr_tor3x3)(repr_tor4x4)(repr_tor5x5)(**
Defines a function of arity 7 of the same way than {! define1}
*)letdefine7(name:string)(r0:'arepr)(r1:'brepr)(r2:'crepr)(r3:'drepr)(r4:'erepr)(r5:'frepr)(r6:'grepr)(f:'a->'b->'c->'d->'e->'f->'g->valexprtactic):unit=define_primitivename(arity_suc(arity_suc(arity_suc(arity_suc(arity_suc(arity_sucarity_one))))))@@funx0x1x2x3x4x5x6->f(repr_tor0x0)(repr_tor1x1)(repr_tor2x2)(repr_tor3x3)(repr_tor4x4)(repr_tor5x5)(repr_tor6x6)(** Comes from [coq/plugins/ltac2/tac2tactics.ml] *)letthaw(r:'arepr)(f:(unit,'a)fun1):'atactic=app_fun1funitr()(** Comes from [coq/plugins/ltac2/tac2tactics.ml] *)letdelayed_of_tactic(tac:'atactic)(env:Environ.env)(sigma:Evd.evar_map):(Evd.evar_map*'a)=let_,pv=Proofview.initsigma[]inletname,poly=Names.Id.of_string"ltac2_delayed",falseinletc,pv,_,_=Proofview.apply~name~polyenvtacpvinlet_,sigma=Proofview.proofviewpvin(sigma,c)(**
Utilitary function to cast OCaml types into Ltac2-compatibles types
Comes from [coq/plugins/ltac2/tac2tactics.ml]
*)letdelayed_of_thunk(r:'arepr)(tac:(unit,'a)fun1)(env:Environ.env)(sigma:Evd.evar_map):(Evd.evar_map*'a)=delayed_of_tactic(thawrtac)envsigma(** Converts a ['a repr] into a [(unit -> 'a) repr] *)letthunk(r:'arepr):(unit,'a)fun1repr=fun1unitrlet_=define0let_=define1let_=define2let_=define3let_=define5let_=define7(** Converts a {! Hint_dataset_declarations.database_type} into a [valexpr] *)letdatabase_type_to_valexp(database_type:database_type):valexpr=matchdatabase_typewith|Main->ValInt0|Decidability->ValInt1|Shorten->ValInt2(** Converts a [valexpr] into a {! Hint_dataset_declarations.database_type} *)letdatabase_type_from_valexp(value:valexpr):database_type=matchvaluewith|ValIntn->letdatabase_type=matchnwith|0->Main|1->Decidability|2->Shorten|_->throw(CastError"cannot cast something an [int] greater than 3 into a [database_type]")indatabase_type|_->throw(CastError"cannot cast something different than an [int] into a [database_type]")(* Exports {! Hint_dataset_declarations.database_type} to Ltac2 *)let()=define0"database_type_main"@@tclUNIT@@database_type_to_valexpMain;define0"database_type_decidability"@@tclUNIT@@database_type_to_valexpDecidability;define0"database_type_shorten"@@tclUNIT@@database_type_to_valexpShorten(* Exports {! Waterprove.waterprove} to Ltac2 *)let()=define4"waterprove"intbool(list(thunkconstr))(make_reprdatabase_type_to_valexpdatabase_type_from_valexp)@@fundepthshieldlemsdatabase_type->beginwaterprovedepth~shield(List.map(funlem->delayed_of_thunkconstrlem)lems)database_typeend>>=fun()->tclUNIT@@of_unit()(* Exports {! Waterprove.rwaterprove} to Ltac2 *)let()=define6"rwaterprove"intbool(list(thunkconstr))(make_reprdatabase_type_to_valexpdatabase_type_from_valexp)(listconstr)(listconstr)@@fundepthshieldlemsdatabase_typemust_useforbidden->beginrwaterprovedepth~shield(List.map(funlem->delayed_of_thunkconstrlem)lems)database_typemust_useforbiddenend>>=fun()->tclUNIT@@of_unit()