Debian Codegraph @

engine/eConstr.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 open CSig
12 open Names
13 open Constr
14 open Environ
15
16 type t = Evd.econstr
17 (** Type of incomplete terms. Essentially a wrapper around {!Constr.t} ensuring
18 that {!Constr.kind} does not observe defined evars. *)
19
20 (** {5 Universe variables} *)
21
22 module ERelevance :
23 sig
24 type t = Evd.erelevance
25 (** Type of relevance marks up-to quality variable unification. *)
26
27 val make : Sorts.relevance -> t
28
29 val kind : Evd.evar_map -> t -> Sorts.relevance
30
31 val equal : Evd.evar_map -> t -> t -> bool
32
33 val relevant : t
34 val irrelevant : t
35
36 val is_irrelevant : Evd.evar_map -> t -> bool
37 end
38
39 module ESorts :
40 sig
41 type t = Evd.esorts
42 (** Type of sorts up-to universe unification. Essentially a wrapper around
43 Sorts.t so that normalization is ensured statically. *)
44
45 val make : Sorts.t -> t
46 (** Turn a sort into an up-to sort. *)
47
48 val kind : Evd.evar_map -> t -> Sorts.t
49 (** Returns the view into the current sort. Note that the kind of a variable
50 may change if the unification state of the evar map changes. *)
51
52 val equal : Evd.evar_map -> t -> t -> bool
53
54 val is_small : Evd.evar_map -> t -> bool
55 val is_prop : Evd.evar_map -> t -> bool
56 val is_sprop : Evd.evar_map -> t -> bool
57 val is_set : Evd.evar_map -> t -> bool
58
59 val prop : t
60 val sprop : t
61 val set : t
62 val type1 : t
63
64 val super : Evd.evar_map -> t -> t
65
66 val relevance_of_sort : t -> ERelevance.t
67
68 val quality : Evd.evar_map -> t -> Sorts.Quality.t
69 val quality_or_set : Evd.evar_map -> t -> UnivGen.QualityOrSet.t
70 end
71
72 module EInstance :
73 sig
74 type t = Evd.einstance
75 (** Type of universe instances up-to universe unification. Similar to
76 [ESorts.t] for [UVars.Instance.t]. *)
77
78 val make : UVars.Instance.t -> t
79 val kind : Evd.evar_map -> t -> UVars.Instance.t
80 val empty : t
81 val is_empty : t -> bool
82 val length : t -> int * int
83 end
84
85 type types = t
86 type constr = t
87 type existential = t pexistential
88 type case_return = (t,ERelevance.t) pcase_return
89 type case_branch = (t,ERelevance.t) pcase_branch
90 type rec_declaration = (t, t, ERelevance.t) prec_declaration
91 type fixpoint = (t, t, ERelevance.t) pfixpoint
92 type cofixpoint = (t, t, ERelevance.t) pcofixpoint
93 type unsafe_judgment = (constr, types) Environ.punsafe_judgment
94 type unsafe_type_judgment = (types, Evd.esorts) Environ.punsafe_type_judgment
95 type named_declaration = (constr, types, ERelevance.t) Context.Named.Declaration.pt
96 type rel_declaration = (constr, types, ERelevance.t) Context.Rel.Declaration.pt
97 type compacted_declaration = (constr, types, ERelevance.t) Context.Compacted.Declaration.pt
98 type named_context = (constr, types, ERelevance.t) Context.Named.pt
99 type compacted_context = compacted_declaration list
100 type rel_context = (constr, types, ERelevance.t) Context.Rel.pt
101 type 'a binder_annot = ('a,ERelevance.t) Context.pbinder_annot
102
103 val annotR : 'a -> 'a binder_annot
104 val nameR : Id.t -> Name.t binder_annot
105 val anonR : Name.t binder_annot
106
107 type case_invert = t pcase_invert
108 type case = (t, t, EInstance.t, ERelevance.t) pcase
109
110 type 'a puniverses = 'a * EInstance.t
111
112 (** {5 Destructors} *)
113
114 val kind : Evd.evar_map -> t -> (t, t, ESorts.t, EInstance.t, ERelevance.t) Constr.kind_of_term
115 (** Same as {!Constr.kind} except that it expands evars and normalizes
116 universes on the fly. *)
117
118 val kind_upto : Evd.evar_map -> Constr.t ->
119 (Constr.t, Constr.t, Sorts.t, UVars.Instance.t, Sorts.relevance) Constr.kind_of_term
120
121 val to_constr : ?abort_on_undefined_evars:bool -> Evd.evar_map -> t -> Constr.t
122 (** Returns the evar-normal form of the argument. Note that this
123 function is supposed to be called when the original term has not
124 more free-evars anymore. If you need compatibility with the old
125 semantics, set [abort_on_undefined_evars] to [false].
126
127 For getting the evar-normal form of a term with evars see
128 {!Evarutil.nf_evar}. *)
129
130 val to_constr_opt : Evd.evar_map -> t -> Constr.t option
131 (** Same as [to_constr], but returns [None] if some unresolved evars remain *)
132
133 type kind_of_type =
134 | SortType of ESorts.t
135 | CastType of types * t
136 | ProdType of Name.t binder_annot * t * t
137 | LetInType of Name.t binder_annot * t * t * t
138 | AtomicType of t * t array
139
140 val kind_of_type : Evd.evar_map -> t -> kind_of_type
141
142 (** {5 Constructors} *)
143
144 val of_kind : (t, t, ESorts.t, EInstance.t, ERelevance.t) Constr.kind_of_term -> t
145 (** Construct a term from a view. *)
146
147 val of_constr : Constr.t -> t
148 (** Translate a kernel term into an incomplete term in O(1). *)
149
150 (** {5 Insensitive primitives}
151
152 Evar-insensitive versions of the corresponding functions. See the {!Constr}
153 module for more information.
154
155 *)
156
157 (** {6 Constructors} *)
158
159 val mkRel : int -> t
160 val mkVar : Id.t -> t
161 val mkMeta : metavariable -> t
162 val mkEvar : t pexistential -> t
163 val mkSort : ESorts.t -> t
164 val mkSProp : t
165 val mkProp : t
166 val mkSet : t
167 val mkType : Univ.Universe.t -> t
168 val mkCast : t * cast_kind * t -> t
169 val mkProd : Name.t binder_annot * t * t -> t
170 val mkLambda : Name.t binder_annot * t * t -> t
171 val mkLetIn : Name.t binder_annot * t * t * t -> t
172 val mkApp : t * t array -> t
173 val mkConstU : Constant.t * EInstance.t -> t
174 val mkProj : (Projection.t * ERelevance.t * t) -> t
175 val mkIndU : inductive * EInstance.t -> t
176 val mkConstructU : constructor * EInstance.t -> t
177 val mkConstructUi : (inductive * EInstance.t) * int -> t
178 val mkCase : case -> t
179 val mkFix : (t, t, ERelevance.t) pfixpoint -> t
180 val mkCoFix : (t, t, ERelevance.t) pcofixpoint -> t
181 val mkArrow : t -> ERelevance.t -> t -> t
182 val mkArrowR : t -> t -> t
183 val mkInt : Uint63.t -> t
184 val mkFloat : Float64.t -> t
185 val mkString : Pstring.t -> t
186 val mkArray : EInstance.t * t array * t * t -> t
187
188 module UnsafeMonomorphic : sig
189 val mkConst : Constant.t -> t
190 val mkInd : inductive -> t
191 val mkConstruct : constructor -> t
192 end
193
194 val mkRef : GlobRef.t * EInstance.t -> t
195
196 val type1 : t
197
198 val applist : t * t list -> t
199 val applistc : t -> t list -> t
200
201 (** { Abstracting/generalizing over binders } *)
202
203 (** it = iterated
204 or_LetIn = turn a local definition into a LetIn
205 wo_LetIn = inlines local definitions (i.e. substitute them in the body)
206 Named = binding is by name and the combinators turn it into a
207 binding by index (complexity is nb(binders) * size(term)) *)
208
209 val it_mkProd : t -> (Name.t binder_annot * t) list -> t
210 val it_mkLambda : t -> (Name.t binder_annot * t) list -> t
211
212 val mkProd_or_LetIn : rel_declaration -> t -> t
213 val mkLambda_or_LetIn : rel_declaration -> t -> t
214 val it_mkProd_or_LetIn : t -> rel_context -> t
215 val it_mkLambda_or_LetIn : t -> rel_context -> t
216
217 val mkProd_wo_LetIn : rel_declaration -> t -> t
218 val mkLambda_wo_LetIn : rel_declaration -> t -> t
219 val it_mkProd_wo_LetIn : t -> rel_context -> t
220 val it_mkLambda_wo_LetIn : t -> rel_context -> t
221
222 val mkNamedProd : Evd.evar_map -> Id.t binder_annot -> types -> types -> types
223 val mkNamedLambda : Evd.evar_map -> Id.t binder_annot -> types -> constr -> constr
224 val mkNamedLetIn : Evd.evar_map -> Id.t binder_annot -> constr -> types -> constr -> constr
225
226 val mkNamedProd_or_LetIn : Evd.evar_map -> named_declaration -> types -> types
227 val mkNamedLambda_or_LetIn : Evd.evar_map -> named_declaration -> types -> types
228 val it_mkNamedProd_or_LetIn : Evd.evar_map -> t -> named_context -> t
229 val it_mkNamedLambda_or_LetIn : Evd.evar_map -> t -> named_context -> t
230
231 val mkNamedProd_wo_LetIn : Evd.evar_map -> named_declaration -> t -> t
232 val it_mkNamedProd_wo_LetIn : Evd.evar_map -> t -> named_context -> t
233
234 val mkLEvar : Evd.evar_map -> Evar.t * t list -> t
235 (** Variant of {!mkEvar} that removes identity variable instances from its argument. *)
236
237 (** {6 Simple case analysis} *)
238
239 val isRel : Evd.evar_map -> t -> bool
240 val isVar : Evd.evar_map -> t -> bool
241 val isInd : Evd.evar_map -> t -> bool
242 val isRef : Evd.evar_map -> t -> bool
243 val isEvar : Evd.evar_map -> t -> bool
244 val isMeta : Evd.evar_map -> t -> bool
245 val isSort : Evd.evar_map -> t -> bool
246 val isCast : Evd.evar_map -> t -> bool
247 val isApp : Evd.evar_map -> t -> bool
248 val isLambda : Evd.evar_map -> t -> bool
249 val isLetIn : Evd.evar_map -> t -> bool
250 val isProd : Evd.evar_map -> t -> bool
251 val isConst : Evd.evar_map -> t -> bool
252 val isConstruct : Evd.evar_map -> t -> bool
253 val isFix : Evd.evar_map -> t -> bool
254 val isCoFix : Evd.evar_map -> t -> bool
255 val isCase : Evd.evar_map -> t -> bool
256 val isProj : Evd.evar_map -> t -> bool
257
258 val isType : Evd.evar_map -> constr -> bool
259
260 type arity = rel_context * ESorts.t
261 val mkArity : arity -> types
262 val destArity : Evd.evar_map -> types -> arity
263 val isArity : Evd.evar_map -> t -> bool
264
265 val isVarId : Evd.evar_map -> Id.t -> t -> bool
266 val isRelN : Evd.evar_map -> int -> t -> bool
267 val isRefX : Environ.env -> Evd.evar_map -> GlobRef.t -> t -> bool
268
269 (** The string is interpreted by [Rocqlib.lib_ref]. If it is not registered, return [false]. *)
270 val is_lib_ref : Environ.env -> Evd.evar_map -> string -> t -> bool
271
272 val destRel : Evd.evar_map -> t -> int
273 val destMeta : Evd.evar_map -> t -> metavariable
274 val destVar : Evd.evar_map -> t -> Id.t
275 val destSort : Evd.evar_map -> t -> ESorts.t
276 val destCast : Evd.evar_map -> t -> t * cast_kind * t
277 val destProd : Evd.evar_map -> t -> Name.t binder_annot * types * types
278 val destLambda : Evd.evar_map -> t -> Name.t binder_annot * types * t
279 val destLetIn : Evd.evar_map -> t -> Name.t binder_annot * t * types * t
280 val destApp : Evd.evar_map -> t -> t * t array
281 val destConst : Evd.evar_map -> t -> Constant.t * EInstance.t
282 val destEvar : Evd.evar_map -> t -> t pexistential
283 val destInd : Evd.evar_map -> t -> inductive * EInstance.t
284 val destConstruct : Evd.evar_map -> t -> constructor * EInstance.t
285 val destCase : Evd.evar_map -> t -> case
286 val destProj : Evd.evar_map -> t -> Projection.t * ERelevance.t * t
287 val destFix : Evd.evar_map -> t -> (t, t, ERelevance.t) pfixpoint
288 val destCoFix : Evd.evar_map -> t -> (t, t, ERelevance.t) pcofixpoint
289
290 val destRef : Evd.evar_map -> t -> GlobRef.t * EInstance.t
291
292 val decompose_app : Evd.evar_map -> t -> t * t array
293 val decompose_app_list : Evd.evar_map -> t -> t * t list
294
295 (** Pops lambda abstractions until there are no more, skipping casts. *)
296 val decompose_lambda : Evd.evar_map -> t -> (Name.t binder_annot * t) list * t
297
298 (** Pops lambda abstractions and letins until there are no more, skipping casts. *)
299 val decompose_lambda_decls : Evd.evar_map -> t -> rel_context * t
300
301 (** Pops [n] lambda abstractions, skipping casts.
302
303 @raise UserError if the term doesn't have enough lambdas. *)
304 val decompose_lambda_n : Evd.evar_map -> int -> t -> (Name.t binder_annot * t) list * t
305
306 (** Pops [n] lambda abstractions, and pop letins only if needed to
307 expose enough lambdas, skipping casts.
308
309 @raise UserError if the term doesn't have enough lambdas. *)
310 val decompose_lambda_n_assum : Evd.evar_map -> int -> t -> rel_context * t
311
312 (** Pops [n] lambda abstractions and letins, skipping casts.
313
314 @raise UserError if the term doesn't have enough lambdas/letins. *)
315 val decompose_lambda_n_decls : Evd.evar_map -> int -> t -> rel_context * t
316
317 val prod_decls : Evd.evar_map -> t -> rel_context
318
319 val to_lambda : Evd.evar_map -> int -> t -> t
320
321 val decompose_prod : Evd.evar_map -> t -> (Name.t binder_annot * t) list * t
322 val decompose_prod_n : Evd.evar_map -> int -> t -> (Name.t binder_annot * t) list * t
323 val decompose_prod_decls : Evd.evar_map -> t -> rel_context * t
324 val decompose_prod_n_decls : Evd.evar_map -> int -> t -> rel_context * t
325
326 val existential_type : Evd.evar_map -> existential -> types
327 val whd_evar : Evd.evar_map -> constr -> constr
328
329 (** {6 Equality} *)
330
331 val eq_constr : Evd.evar_map -> t -> t -> bool
332 val eq_constr_nounivs : Evd.evar_map -> t -> t -> bool
333 val eq_constr_universes : Environ.env -> Evd.evar_map -> ?nargs:int -> t -> t -> UnivProblem.Set.t option
334 (** Does not produce QLeq nor QElimTo constraints *)
335
336 val leq_constr_universes : Environ.env -> Evd.evar_map -> ?nargs:int -> t -> t -> UnivProblem.Set.t option
337 val eq_existential : Evd.evar_map -> (t -> t -> bool) -> existential -> existential -> bool
338
339 (** [eq_constr_universes_proj] can equate projections and their eta-expanded constant form. *)
340 val eq_constr_universes_proj : Environ.env -> Evd.evar_map -> t -> t -> UnivProblem.Set.t option
341
342 val compare_constr : Evd.evar_map -> (t -> t -> bool) -> t -> t -> bool
343
344 (** {6 Iterators} *)
345
346 val map : Evd.evar_map -> (t -> t) -> t -> t
347 val map_with_binders : Evd.evar_map -> ('a -> 'a) -> ('a -> t -> t) -> 'a -> t -> t
348 val map_branches : (t -> t) -> case_branch array -> case_branch array
349 val map_return_predicate : (t -> t) -> case_return -> case_return
350 val map_existential : Evd.evar_map -> (t -> t) -> existential -> existential
351 val iter : Evd.evar_map -> (t -> unit) -> t -> unit
352 val iter_with_binders : Evd.evar_map -> ('a -> 'a) -> ('a -> t -> unit) -> 'a -> t -> unit
353 val iter_with_full_binders : Environ.env -> Evd.evar_map -> (rel_declaration -> 'a -> 'a) -> ('a -> t -> unit) -> 'a -> t -> unit
354 val fold : Evd.evar_map -> ('a -> t -> 'a) -> 'a -> t -> 'a
355 val fold_with_binders : Evd.evar_map -> ('a -> 'a) -> ('a -> 'b -> t -> 'b) -> 'a -> 'b -> t -> 'b
356
357 (** Gather the universes transitively used in the term, including in the
358 type of evars appearing in it. *)
359 val universes_of_constr : ?init:Sorts.QVar.Set.t * Univ.Level.Set.t -> Evd.evar_map -> t -> Sorts.QVar.Set.t * Univ.Level.Set.t
360
361 (** {6 Substitutions} *)
362
363 module Vars :
364 sig
365
366 (** See vars.mli for the documentation of the functions below *)
367
368 type instance = t array
369 type instance_list = t list
370 type substl = t list
371
372 val exliftn : Esubst.lift -> t -> t
373 val lift : int -> t -> t
374 val liftn : int -> int -> t -> t
375 val substnl : substl -> int -> t -> t
376 val substl : substl -> t -> t
377 val subst1 : t -> t -> t
378
379 val substnl_decl : substl -> int -> rel_declaration -> rel_declaration
380 val substl_decl : substl -> rel_declaration -> rel_declaration
381 val subst1_decl : t -> rel_declaration -> rel_declaration
382
383 val replace_vars : Evd.evar_map -> (Id.t * t) list -> t -> t
384 val substn_vars : Evd.evar_map -> int -> Id.t list -> t -> t
385 val subst_vars : Evd.evar_map -> Id.t list -> t -> t
386 val subst_var : Evd.evar_map -> Id.t -> t -> t
387
388 val noccurn : Evd.evar_map -> int -> t -> bool
389 val noccur_between : Evd.evar_map -> int -> int -> t -> bool
390
391 val closedn : Evd.evar_map -> int -> t -> bool
392 val closed0 : Evd.evar_map -> t -> bool
393
394 val subst_univs_level_constr : UVars.sort_level_subst -> t -> t
395 val subst_instance_context : EInstance.t -> rel_context -> rel_context
396 val subst_instance_constr : EInstance.t -> t -> t
397 val subst_instance_relevance : EInstance.t -> ERelevance.t -> ERelevance.t
398
399 val subst_of_rel_context_instance : rel_context -> instance -> substl
400 val subst_of_rel_context_instance_list : rel_context -> instance_list -> substl
401
402 val liftn_rel_context : int -> int -> rel_context -> rel_context
403 val lift_rel_context : int -> rel_context -> rel_context
404 val substnl_rel_context : substl -> int -> rel_context -> rel_context
405 val substl_rel_context : substl -> rel_context -> rel_context
406 val smash_rel_context : rel_context -> rel_context
407
408 val esubst : (int -> 'a -> t) -> 'a Esubst.subs -> t -> t
409
410 type substituend
411 val make_substituend : t -> substituend
412 val lift_substituend : int -> substituend -> t
413
414 end
415
416 (** {5 Environment handling} *)
417
418 val push_rel : rel_declaration -> env -> env
419 val push_rel_context : rel_context -> env -> env
420 val push_rec_types : rec_declaration -> env -> env
421
422 val push_named : named_declaration -> env -> env
423 val push_named_context : named_context -> env -> env
424 val push_named_context_val : named_declaration -> named_context_val -> named_context_val
425
426 val rel_context : env -> rel_context
427 val named_context : env -> named_context
428
429 val val_of_named_context : named_context -> named_context_val
430 val named_context_of_val : named_context_val -> named_context
431
432 val lookup_rel : int -> env -> rel_declaration
433 val lookup_named : variable -> env -> named_declaration
434 val lookup_named_val : variable -> named_context_val -> named_declaration
435
436 val lookup_constant : env -> Evd.evar_map -> Constant.t -> Declarations.constant_body
437 val constant_value_in : env -> Evd.evar_map -> Constant.t * EInstance.t -> constr
438
439 val map_rel_context_in_env :
440 (env -> constr -> constr) -> env -> rel_context -> rel_context
441
442 val match_named_context_val :
443 named_context_val -> (named_declaration * named_context_val) option
444
445 val identity_subst_val : named_context_val -> t SList.t
446
447 (* XXX Missing Sigma proxy *)
448 val fresh_global :
449 ?loc:Loc.t -> ?rigid:Evd.rigid -> ?names:EInstance.t -> Environ.env ->
450 Evd.evar_map -> GlobRef.t -> Evd.evar_map * t
451
452 val expand_case : Environ.env -> Evd.evar_map ->
453 case -> (t,t,ERelevance.t) Inductive.pexpanded_case
454
455 val annotate_case : Environ.env -> Evd.evar_map -> case ->
456 case_info * EInstance.t * t array * ((rel_context * t) * ERelevance.t) * case_invert * t * (rel_context * t) array
457 (** Same as above, but doesn't turn contexts into binders *)
458
459 val expand_branch : Environ.env -> Evd.evar_map ->
460 EInstance.t -> t array -> constructor -> case_branch -> rel_context
461 (** Given a universe instance and parameters for the inductive type,
462 constructs the typed context in which the branch lives. *)
463
464 val contract_case : Environ.env -> Evd.evar_map ->
465 (t,t,ERelevance.t) Inductive.pexpanded_case -> case
466
467 (** {5 Extra} *)
468
469 val of_existential : Constr.existential -> existential
470 val of_named_decl : Constr.named_declaration -> named_declaration
471 val of_rel_decl : Constr.rel_declaration -> rel_declaration
472
473 val to_rel_decl : Evd.evar_map -> rel_declaration -> Constr.rel_declaration
474 val to_named_decl : Evd.evar_map -> named_declaration -> Constr.named_declaration
475
476 val of_named_context : Constr.named_context -> named_context
477 val of_rel_context : Constr.rel_context -> rel_context
478
479 val to_named_context : Evd.evar_map -> named_context -> Constr.named_context
480 val to_rel_context : Evd.evar_map -> rel_context -> Constr.rel_context
481
482 val of_case_invert : Constr.case_invert -> case_invert
483
484 val of_constr_array : Constr.t array -> t array
485
486 val of_binder_annot : 'a Constr.binder_annot -> 'a binder_annot
487
488 val to_binder_annot : Evd.evar_map -> 'a binder_annot -> 'a Constr.binder_annot
489
490 (** {5 Unsafe operations} *)
491
492 module Unsafe :
493 sig
494 val to_constr : t -> Constr.t
495 (** Physical identity. Does not care for defined evars. *)
496
497 val to_constr_array : t array -> Constr.t array
498 (** Physical identity. Does not care for defined evars. *)
499
500 val to_binder_annot : 'a binder_annot -> 'a Constr.binder_annot
501
502 val to_rel_decl : (t, types, ERelevance.t) Context.Rel.Declaration.pt ->
503 (Constr.t, Constr.types, Sorts.relevance) Context.Rel.Declaration.pt
504 (** Physical identity. Does not care for defined evars. *)
505
506 val to_named_decl : (t, types, ERelevance.t) Context.Named.Declaration.pt ->
507 (Constr.t, Constr.types, Sorts.relevance) Context.Named.Declaration.pt
508 (** Physical identity. Does not care for defined evars. *)
509
510 val to_named_context : (t, types, ERelevance.t) Context.Named.pt -> Constr.named_context
511
512 val to_rel_context : (t, types, ERelevance.t) Context.Rel.pt -> Constr.rel_context
513
514 val to_relevance : ERelevance.t -> Sorts.relevance
515
516 val to_sorts : ESorts.t -> Sorts.t
517 (** Physical identity. Does not care for normalization. *)
518
519 val to_instance : EInstance.t -> UVars.Instance.t
520 (** Physical identity. Does not care for normalization. *)
521
522 val to_case_invert : case_invert -> Constr.case_invert
523
524 val eq : (t, Constr.t) eq
525 (** Use for transparent cast between types. *)
526
527 val relevance_eq : (ERelevance.t, Sorts.relevance) eq
528 end
529
530 (** {5 Delayed evar expansion} *)
531
532 module Expand :
533 sig
534
535 type t
536 (** A variant of [EConstr.t] where evar substitution is performed on the fly.
537 The [handle] type below is a kind of substitution that is needed to make
538 sense of the delayed term. Such representation is more efficient than
539 [EConstr.t] when iterating over a whole term.
540
541 Caveat: the [kind] function below only returns the expanded head of the
542 term. This means that when it returns [Evar (evk, inst)], [evk] is
543 guaranteed to be undefined in the evar map but [inst] is, in general,
544 not the same as you would get after expansion. You must call
545 [expand_instance] before performing any operation on it. *)
546
547 type kind = (t, t, ESorts.t, EInstance.t, ERelevance.t) Constr.kind_of_term
548
549 type handle
550
551 val make : Evd.econstr -> handle * t
552 val repr : Evd.evar_map -> handle -> t -> Evd.econstr
553 val liftn_handle : int -> handle -> handle
554 val kind : Evd.evar_map -> handle -> t -> handle * kind
555 val expand_instance : skip:bool -> Evd.undefined Evd.evar_info -> handle -> t SList.t -> t SList.t
556 val iter : Evd.evar_map -> (handle -> t -> unit) -> handle -> kind -> unit
557 val iter_with_binders : Evd.evar_map ->
558 ('a -> 'a) -> ('a -> handle -> t -> unit) -> 'a -> handle -> kind -> unit
559
560 end