Debian Codegraph @

plugins/ssr/ssrcommon.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 (* This file is (C) Copyright 2006-2015 Microsoft Corporation and Inria. *)
12
13 open Names
14 open Environ
15 open Evd
16 open Constrexpr
17 open Ssrast
18
19 open Ltac_plugin
20
21 open Ssrmatching_plugin
22
23 val allocc : ssrocc
24
25 (******************************** hyps ************************************)
26
27 val hyp_id : ssrhyp -> Id.t
28 val hyps_ids : ssrhyps -> Id.t list
29 val check_hyp_exists : ('a, 'b, 'r) Context.Named.pt -> ssrhyp -> unit
30 val test_hyp_exists : ('a, 'b, 'r) Context.Named.pt -> ssrhyp -> bool
31 val check_hyps_uniq : Id.t list -> ssrhyps -> unit
32 val not_section_id : Id.t -> bool
33 val hyp_err : ?loc:Loc.t -> string -> Id.t -> 'a
34 val hoik : (ssrhyp -> 'a) -> ssrhyp_or_id -> 'a
35 val hoi_id : ssrhyp_or_id -> Id.t
36
37 (******************************* hints ***********************************)
38
39 val mk_hint : 'a -> 'a ssrhint
40 val mk_orhint : 'a -> bool * 'a
41 val nullhint : bool * 'a list
42 val nohint : 'a ssrhint
43
44 (******************************** misc ************************************)
45
46 val errorstrm : Pp.t -> 'a
47 val anomaly : string -> 'a
48
49 val array_app_tl : 'a array -> 'a list -> 'a list
50 val array_list_of_tl : 'a array -> 'a list
51 val array_fold_right_from : int -> ('a -> 'b -> 'b) -> 'a array -> 'b -> 'b
52
53 val option_assert_get : 'a option -> Pp.t -> 'a
54
55 (************************ ssr tactic arguments ******************************)
56
57
58 (*********************** Misc helpers *****************************)
59 val mkRHole : Glob_term.glob_constr
60 val mkRHoles : int -> Glob_term.glob_constr list
61 val isRHoles : Glob_term.glob_constr list -> bool
62 val mkRApp : Glob_term.glob_constr -> Glob_term.glob_constr list -> Glob_term.glob_constr
63 val mkRVar : Id.t -> Glob_term.glob_constr
64 val mkRltacVar : Id.t -> Glob_term.glob_constr
65 val mkRCast : Glob_term.glob_constr -> Glob_term.glob_constr -> Glob_term.glob_constr
66 val mkRType : Glob_term.glob_constr
67 val mkRProp : Glob_term.glob_constr
68 val mkRArrow : Glob_term.glob_constr -> Glob_term.glob_constr -> Glob_term.glob_constr
69 val mkRConstruct : Names.constructor -> Glob_term.glob_constr
70 val mkRInd : Names.inductive -> Glob_term.glob_constr
71 val mkRLambda : Name.t -> Glob_term.glob_constr -> Glob_term.glob_constr -> Glob_term.glob_constr
72 val mkRnat : int -> Glob_term.glob_constr
73
74
75 val mkCHole : Loc.t option -> constr_expr
76 val mkCHoles : ?loc:Loc.t -> int -> constr_expr list
77 val mkCVar : ?loc:Loc.t -> Id.t -> constr_expr
78 val mkCCast : ?loc:Loc.t -> constr_expr -> constr_expr -> constr_expr
79 val mkCType : Loc.t option -> constr_expr
80 val mkCProp : Loc.t option -> constr_expr
81 val mkCArrow : ?loc:Loc.t -> constr_expr -> constr_expr -> constr_expr
82 val mkCLambda : ?loc:Loc.t -> Name.t -> constr_expr -> constr_expr -> constr_expr
83
84 val isCHoles : constr_expr list -> bool
85 val isCxHoles : (constr_expr * 'a option) list -> bool
86
87 val intern_term :
88 Tacinterp.interp_sign -> env ->
89 ssrterm -> Glob_term.glob_constr
90
91 val interp_term :
92 Environ.env -> Evd.evar_map ->
93 Tacinterp.interp_sign ->
94 ssrterm -> evar_map * EConstr.t
95
96 val interp_hyp : ist -> env -> evar_map -> ssrhyp -> ssrhyp
97 val interp_hyps : ist -> env -> evar_map -> ssrhyps -> ssrhyps
98
99 val interp_refine :
100 Environ.env -> Evd.evar_map -> Tacinterp.interp_sign -> concl:EConstr.constr ->
101 Glob_term.glob_constr -> evar_map * EConstr.constr
102
103 val interp_open_constr :
104 Environ.env -> Evd.evar_map ->
105 Tacinterp.interp_sign ->
106 Genintern.glob_constr_and_expr -> evar_map * EConstr.t
107
108 val splay_open_constr :
109 Environ.env ->
110 evar_map * EConstr.t ->
111 (Names.Name.t EConstr.binder_annot * EConstr.t) list * EConstr.t
112 val isAppInd : Environ.env -> Evd.evar_map -> EConstr.types -> bool
113
114 val mk_term : ssrtermkind -> constr_expr -> ssrterm
115 val mk_lterm : constr_expr -> ssrterm
116
117 val mk_ast_closure_term :
118 [ `None | `Parens | `DoubleParens | `At ] ->
119 Constrexpr.constr_expr -> ast_closure_term
120 val interp_ast_closure_term : Geninterp.interp_sign -> env -> evar_map -> ast_closure_term -> ast_closure_term
121 val subst_ast_closure_term : Mod_subst.substitution -> ast_closure_term -> ast_closure_term
122 val glob_ast_closure_term : Genintern.glob_sign -> ast_closure_term -> ast_closure_term
123 val ssrterm_of_ast_closure_term : ast_closure_term -> ssrterm
124
125 val ssrdgens_of_parsed_dgens :
126 (ssrdocc * Ssrmatching.cpattern) list list * ssrclear -> ssrdgens
127
128 val is_internal_name : string -> bool
129 val add_internal_name : (string -> bool) -> unit
130 val mk_internal_id : string -> Id.t
131 val mk_tagged_id : string -> int -> Id.t
132 val mk_evar_name : int -> Name.t
133 val ssr_anon_hyp : string
134 val type_id : Environ.env -> Evd.evar_map -> EConstr.types -> Id.t
135
136 val abs_evars :
137 Environ.env -> Evd.evar_map -> ?rigid:Evar.t list ->
138 evar_map * EConstr.t ->
139 EConstr.t * Evar.t list *
140 UState.t
141 val abs_cterm :
142 Environ.env -> Evd.evar_map -> int -> EConstr.t -> EConstr.t
143
144 val constr_name : evar_map -> EConstr.t -> Name.t
145
146 val mkSsrRef : string -> GlobRef.t
147 val mkSsrRRef : string -> Glob_term.glob_constr * 'a option
148 val mkSsrConst : Environ.env -> Evd.evar_map -> string -> Evd.evar_map * EConstr.t
149
150 val is_discharged_id : Id.t -> bool
151 val mk_discharged_id : Id.t -> Id.t
152 val is_tagged : string -> string -> bool
153 val has_discharged_tag : string -> bool
154 val ssrqid : string -> Libnames.qualid
155 val mk_anon_id : string -> named_context_val -> Id.t
156 val nbargs_open_constr : Environ.env -> Evd.evar_map * EConstr.t -> int
157 val pf_nbargs : Environ.env -> Evd.evar_map -> EConstr.t -> int
158
159 val ssrevaltac :
160 Tacinterp.interp_sign -> Tacinterp.Value.t -> unit Proofview.tactic
161
162 val convert_concl_no_check : EConstr.t -> unit Proofview.tactic
163 val convert_concl : check:bool -> EConstr.t -> unit Proofview.tactic
164
165 val red_safe :
166 Reductionops.reduction_function ->
167 env -> evar_map -> EConstr.t -> EConstr.t
168
169 val red_product_skip_id :
170 env -> evar_map -> EConstr.t -> EConstr.t
171
172 val ssrautoprop_tac :
173 unit Proofview.tactic ref
174
175 val mkProt :
176 Environ.env ->
177 Evd.evar_map ->
178 EConstr.t ->
179 EConstr.t ->
180 Evd.evar_map * EConstr.t
181
182 val mkEtaApp : EConstr.t -> int -> int -> EConstr.t
183
184 val mkRefl :
185 Environ.env ->
186 Evd.evar_map ->
187 EConstr.t ->
188 EConstr.t ->
189 Evd.evar_map * EConstr.t
190
191 val discharge_hyp :
192 Id.t * (Id.t * string) -> unit Proofview.tactic
193
194 val view_error : string -> ssrterm -> 'a Proofview.tactic
195
196
197 val top_id : Id.t
198
199 val abs_ssrterm :
200 ?resolve_typeclasses:bool ->
201 ist ->
202 Environ.env -> Evd.evar_map ->
203 ssrterm ->
204 Evd.evar_map * EConstr.t * int
205
206 val pf_interp_ty :
207 ?resolve_typeclasses:bool ->
208 Environ.env ->
209 Evd.evar_map ->
210 Tacinterp.interp_sign ->
211 Ssrast.ssrtermkind *
212 (Glob_term.glob_constr * Constrexpr.constr_expr option) ->
213 Evd.evar_map * int * EConstr.t * EConstr.t
214
215 val ssr_n_tac : string -> int -> unit Proofview.tactic
216 val donetac : int -> unit Proofview.tactic
217
218 exception NotEnoughProducts
219 val saturate :
220 ?beta:bool ->
221 ?bi_types:bool ->
222 env ->
223 evar_map ->
224 EConstr.constr ->
225 ?ty:EConstr.types ->
226 int ->
227 EConstr.constr * EConstr.types * (int * EConstr.constr * EConstr.types) list * evar_map
228 val refine_with :
229 ?first_goes_last:bool ->
230 ?beta:bool ->
231 ?with_evars:bool ->
232 evar_map * EConstr.t -> unit Proofview.tactic
233
234 val resolve_typeclasses :
235 Environ.env -> Evd.evar_map ->
236 where:EConstr.t ->
237 fail:bool -> Evd.evar_map
238
239 (*********************** Wrapped Rocq tactics *****************************)
240
241 val rewritetac : ?under:bool -> ssrdir -> EConstr.t -> unit Proofview.tactic
242
243 type name_hint = (int * EConstr.types array) option ref
244
245 val gentac :
246 Ssrast.ssrdocc * Ssrmatching.cpattern -> unit Proofview.tactic
247
248 val genstac :
249 ((Ssrast.ssrhyp list option * Ssrmatching.occ) *
250 Ssrmatching.cpattern)
251 list * Ssrast.ssrhyp list ->
252 unit Proofview.tactic
253
254 val interp_gen :
255 Environ.env ->
256 Evd.evar_map ->
257 concl:EConstr.t ->
258 bool ->
259 (Ssrast.ssrhyp list option * Ssrmatching.occ) *
260 Ssrmatching.cpattern ->
261 Evd.evar_map * (EConstr.t * EConstr.t * Ssrast.ssrhyp list)
262
263 (** Basic tactics *)
264
265 val introid : ?orig:Name.t ref -> Id.t -> unit Proofview.tactic
266 val intro_anon : unit Proofview.tactic
267
268 val interp_clr :
269 evar_map -> ssrhyps option * (ssrtermkind * EConstr.t) -> ssrhyps
270
271 val genclrtac :
272 EConstr.constr ->
273 EConstr.constr list -> Ssrast.ssrhyp list -> unit Proofview.tactic
274 val cleartac : ssrhyps -> unit Proofview.tactic
275
276 val tclMULT : int * ssrmmod -> unit Proofview.tactic -> unit Proofview.tactic
277
278 val unprotecttac : unit Proofview.tactic
279 val is_protect : EConstr.t -> Environ.env -> Evd.evar_map -> bool
280
281 val abs_wgen :
282 Environ.env ->
283 Evd.evar_map ->
284 bool ->
285 (Id.t -> Id.t) ->
286 'a *
287 ((Ssrast.ssrhyp_or_id * string) *
288 Ssrmatching.cpattern option)
289 option ->
290 EConstr.t list * EConstr.t ->
291 Evd.evar_map * EConstr.t list * EConstr.t
292
293 val clr_of_wgen :
294 ssrhyps * ((ssrhyp_or_id * 'a) * 'b option) option ->
295 unit Proofview.tactic list -> unit Proofview.tactic list
296
297
298 val unfold : EConstr.t list -> unit Proofview.tactic
299
300 (* New code ****************************************************************)
301
302 val tclINTERP_AST_CLOSURE_TERM_AS_CONSTR :
303 ast_closure_term -> EConstr.t list Proofview.tactic
304
305 val tacTYPEOF : EConstr.t -> EConstr.types Proofview.tactic
306
307 val tclINTRO_ID : Id.t -> unit Proofview.tactic
308 val tclINTRO_ANON : ?seed:string -> unit -> unit Proofview.tactic
309
310 (* Lower level API, calls conclusion with the name taken from the prod *)
311 type intro_id =
312 | Anon
313 | Id of Id.t
314 | Seed of string
315
316 val tclINTRO :
317 id:intro_id ->
318 conclusion:(orig_name:Name.t -> new_name:Id.t -> unit Proofview.tactic) ->
319 unit Proofview.tactic
320
321 val tclRENAME_HD_PROD : Name.t -> unit Proofview.tactic
322
323 (* calls the tactic only if there are more than 0 goals *)
324 val tcl0G : default:'a -> 'a Proofview.tactic -> 'a Proofview.tactic
325
326 (* like tclFIRST but with 'a tactic *)
327 val tclFIRSTa : 'a Proofview.tactic list -> 'a Proofview.tactic
328 val tclFIRSTi : (int -> 'a Proofview.tactic) -> int -> 'a Proofview.tactic
329
330 val tacCONSTR_NAME : ?name:Name.t -> EConstr.t -> Name.t Proofview.tactic
331
332 (* [tacMKPROD t name ctx] (where ctx is a term possibly containing an unbound
333 * Rel 1) builds [forall name : ty_t, ctx] *)
334 val tacMKPROD :
335 EConstr.t -> ?name:Name.t -> EConstr.types -> EConstr.types Proofview.tactic
336
337 val tacINTERP_CPATTERN : Ssrmatching.cpattern -> Ssrmatching.pattern Proofview.tactic
338 val tacUNIFY : EConstr.t -> EConstr.t -> unit Proofview.tactic
339
340 (* if [(t : eq _ _ _)] then we can inject it *)
341 val tacIS_INJECTION_CASE : ?ty:EConstr.types -> EConstr.t -> bool Proofview.tactic
342
343 (** 1 shot, hands-on the top of the stack, eg for [=> ->] *)
344 val tclWITHTOP : (EConstr.t -> unit Proofview.tactic) -> unit Proofview.tactic
345
346 val tacMK_SSR_CONST : string -> EConstr.t Proofview.tactic
347
348 module type StateType = sig
349 type state
350 val init : state
351 val name : string
352 end
353
354 module MakeState(S : StateType) : sig
355
356 val tclGET : (S.state -> unit Proofview.tactic) -> unit Proofview.tactic
357 val tclGET1 : (S.state -> 'a Proofview.tactic) -> 'a Proofview.tactic
358 val tclSET : S.state -> unit Proofview.tactic
359 val tacUPDATE : (S.state -> S.state Proofview.tactic) -> unit Proofview.tactic
360
361 val get : Proofview.Goal.t -> S.state
362
363 end
364
365 val is_ind_ref : Environ.env -> Evd.evar_map -> EConstr.t -> Names.GlobRef.t -> bool
366 val is_construct_ref : Environ.env -> Evd.evar_map -> EConstr.t -> Names.GlobRef.t -> bool
367 val is_const_ref : Environ.env -> Evd.evar_map -> EConstr.t -> Names.GlobRef.t -> bool