Debian Codegraph @

pretyping/ltac_pretype.mli

raw symbols SCIP
1 open Names
2 open Glob_term
3
4 (** {5 Maps of pattern variables} *)
5
6 (** Type [constr_under_binders] is for representing the term resulting
7 of a matching. Matching can return terms defined in a some context
8 of named binders; in the context, variable names are ordered by
9 (<) and referred to by index in the term Thanks to the canonical
10 ordering, a matching problem like
11
12 [match ... with [(fun x y => ?p,fun y x => ?p)] => [forall x y => p]]
13
14 will be accepted. Thanks to the reference by index, a matching
15 problem like
16
17 [match ... with [(fun x => ?p)] => [forall x => p]]
18
19 will work even if [x] is also the name of an existing goal
20 variable.
21
22 Note: we do not keep types in the signature. Besides simplicity,
23 the main reason is that it would force to close the signature over
24 binders that occur only in the types of effective binders but not
25 in the term itself (e.g. for a term [f x] with [f:A -> True] and
26 [x:A]).
27
28 On the opposite side, by not keeping the types, we loose
29 opportunity to propagate type informations which otherwise would
30 not be inferable, as e.g. when matching [forall x, x = 0] with
31 pattern [forall x, ?h = 0] and using the solution "x|-h:=x" in
32 expression [forall x, h = x] where nothing tells how the type of x
33 could be inferred. We also loose the ability of typing ltac
34 variables before calling the right-hand-side of ltac matching clauses. *)
35
36 type constr_under_binders = Id.t list * EConstr.constr
37
38 (** Types of substitutions with or w/o bound variables *)
39
40 type patvar_map = EConstr.constr Id.Map.t
41 type extended_patvar_map = constr_under_binders Id.Map.t
42
43 (** A globalised term together with a closure representing the value
44 of its free variables. Intended for use when these variables are taken
45 from the Ltac environment. *)
46 type closure = {
47 idents:Id.t Id.Map.t;
48 typed: constr_under_binders Id.Map.t ;
49 untyped:closed_glob_constr Id.Map.t;
50 genargs : Geninterp.Val.t Id.Map.t; }
51 and closed_glob_constr = {
52 closure: closure;
53 term: glob_constr }
54
55 (** Ltac variable maps *)
56 type var_map = constr_under_binders Id.Map.t
57 type uconstr_var_map = closed_glob_constr Id.Map.t
58 type unbound_ltac_var_map = Geninterp.Val.t Id.Map.t
59
60 type ltac_var_map = {
61 ltac_constrs : var_map;
62 (** Ltac variables bound to constrs *)
63 ltac_uconstrs : uconstr_var_map;
64 (** Ltac variables bound to untyped constrs *)
65 ltac_idents: Id.t Id.Map.t;
66 (** Ltac variables bound to identifiers *)
67 ltac_genargs : unbound_ltac_var_map;
68 (** All Ltac variables (to pass on ltac subterms, and for error reporting) *)
69 }