Debian Codegraph @

plugins/ltac/tacinterp.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 Names
12 open Tactic_debug
13 open EConstr
14 open Tacexpr
15 open Genarg
16 open Redexpr
17 open Tactypes
18
19 val ltac_trace_info : ltac_stack Exninfo.t
20
21 module Value :
22 sig
23 type t = Geninterp.Val.t
24 val of_constr : constr -> t
25 val to_constr : t -> constr option
26 val of_int : int -> t
27 val to_int : t -> int option
28 val to_list : t -> t list option
29 val of_closure : Geninterp.interp_sign -> glob_tactic_expr -> t
30 val cast : 'a typed_abstract_argument_type -> Geninterp.Val.t -> 'a
31 val apply : t -> t list -> unit Proofview.tactic
32 val apply_val : t -> t list -> t Ftactic.t
33 end
34
35 (** Values for interpretation *)
36 type value = Value.t
37
38 module TacStore : Store.S with
39 type t = Geninterp.TacStore.t
40 and type 'a field = 'a Geninterp.TacStore.field
41
42 (** Signature for interpretation: val\_interp and interpretation functions *)
43 type interp_sign = Geninterp.interp_sign =
44 { lfun : value Id.Map.t
45 ; poly : PolyFlags.t
46 ; extra : TacStore.t }
47
48 open Genintern
49
50 val f_avoid_ids : Id.Set.t TacStore.field
51 val f_debug : debug_info TacStore.field
52
53 val extract_ltac_constr_values : interp_sign -> Environ.env ->
54 Ltac_pretype.constr_under_binders Id.Map.t
55 (** Given an interpretation signature, extract all values which are coercible to
56 a [constr]. *)
57
58 (** Sets the debugger mode *)
59 val set_debug : debug_info -> unit
60
61 (** Gives the state of debug *)
62 val get_debug : unit -> debug_info
63
64 val type_uconstr :
65 ?flags:Pretyping.inference_flags ->
66 ?expected_type:Pretyping.typing_constraint ->
67 Geninterp.interp_sign -> Ltac_pretype.closed_glob_constr -> constr Tactypes.delayed_open
68
69 (** Adds an interpretation function for extra generic arguments *)
70
71 val interp_genarg : interp_sign -> glob_generic_argument -> Value.t Ftactic.t
72
73 (** Interprets any expression *)
74 val val_interp : interp_sign -> glob_tactic_expr -> (value -> unit Proofview.tactic) -> unit Proofview.tactic
75
76 (** Interprets an expression that evaluates to a constr *)
77 val interp_ltac_constr : interp_sign -> glob_tactic_expr -> (constr -> unit Proofview.tactic) -> unit Proofview.tactic
78
79 (** Interprets redexp arguments *)
80 val interp_red_expr : interp_sign -> Environ.env -> Evd.evar_map -> Redexpr.glob_red_expr -> Evd.evar_map * red_expr
81
82 val interp_strategy : interp_sign -> Environ.env -> Evd.evar_map -> glob_strategy -> Rewrite.strategy
83
84 (** Interprets tactic expressions *)
85
86 val interp_hyp : interp_sign -> Environ.env -> Evd.evar_map ->
87 lident -> Id.t
88
89 val interp_glob_closure : interp_sign -> Environ.env -> Evd.evar_map ->
90 ?kind:Pretyping.typing_constraint -> ?pattern_mode:bool -> glob_constr_and_expr ->
91 Ltac_pretype.closed_glob_constr
92
93 val interp_uconstr : interp_sign -> Environ.env -> Evd.evar_map ->
94 glob_constr_and_expr -> Ltac_pretype.closed_glob_constr
95
96 val interp_constr_gen : Pretyping.typing_constraint -> interp_sign ->
97 Environ.env -> Evd.evar_map -> glob_constr_and_expr -> Evd.evar_map * constr
98
99 val interp_bindings : interp_sign -> Environ.env -> Evd.evar_map ->
100 glob_constr_and_expr bindings -> Evd.evar_map * constr bindings
101
102 val interp_open_constr : ?expected_type:Pretyping.typing_constraint ->
103 ?flags:Pretyping.inference_flags ->
104 interp_sign -> Environ.env -> Evd.evar_map ->
105 glob_constr_and_expr -> Evd.evar_map * EConstr.constr
106
107 val interp_open_constr_with_classes : ?expected_type:Pretyping.typing_constraint ->
108 interp_sign -> Environ.env -> Evd.evar_map ->
109 glob_constr_and_expr -> Evd.evar_map * EConstr.constr
110
111 val interp_open_constr_with_bindings : interp_sign -> Environ.env -> Evd.evar_map ->
112 glob_constr_and_expr with_bindings -> Evd.evar_map * EConstr.constr with_bindings
113
114 (** Initial call for interpretation *)
115
116 val eval_tactic : glob_tactic_expr -> unit Proofview.tactic
117
118 val eval_tactic_ist : interp_sign -> glob_tactic_expr -> unit Proofview.tactic
119 (** Same as [eval_tactic], but with the provided [interp_sign]. *)
120
121 val tactic_of_value : interp_sign -> Value.t -> unit Proofview.tactic
122
123 (** Globalization + interpretation *)
124
125 val interp_tac_gen : value Id.Map.t -> Id.Set.t ->
126 debug_info -> raw_tactic_expr -> unit Proofview.tactic
127
128 val interp : raw_tactic_expr -> unit Proofview.tactic
129
130 (** Hides interpretation for pretty-print *)
131 type ltac_expr = {
132 global: bool;
133 ast: Tacexpr.raw_tactic_expr;
134 }
135
136 val hide_interp : ltac_expr -> ComTactic.interpretable
137
138 (** Internals that can be useful for syntax extensions. *)
139
140 val interp_ltac_var : (value -> 'a) -> interp_sign ->
141 (Environ.env * Evd.evar_map) option -> lident -> 'a
142
143 val interp_int : interp_sign -> lident -> int
144
145 val interp_int_or_var : interp_sign -> int Locus.or_var -> int
146
147 val interp_ident : interp_sign -> Environ.env -> Evd.evar_map -> Id.t -> Id.t
148
149 val interp_intro_pattern : interp_sign -> Environ.env -> Evd.evar_map ->
150 glob_constr_and_expr intro_pattern_expr CAst.t -> intro_pattern
151
152 val default_ist : unit -> Geninterp.interp_sign
153 (** Empty ist with debug set on the current value. *)