Debian Codegraph @

src/rocq_elpi_arg_HOAS.mli

raw symbols SCIP
1 (* rocq-elpi: Coq terms as the object language of elpi *)
2 (* license: GNU Lesser General Public License Version 2.1 or later *)
3 (* ------------------------------------------------------------------------- *)
4
5 open Elpi.API.RawData
6 open Rocq_elpi_utils
7 open Ltac_plugin.Tacinterp
8
9 type phase = Interp | Synterp | Both
10 type proof =
11 | Begin of string option (* None = always, Some x only if #[x] present*)
12 | End
13
14 module Cmd : sig
15
16 type raw_term = Constrexpr.constr_expr
17 type glob_term = Genintern.glob_constr_and_expr
18 type top_term = Ltac_plugin.Tacinterp.interp_sign * Genintern.glob_constr_and_expr
19
20 type raw_record_decl = Vernacentries.Preprocessed_Mind_decl.record
21 type glob_record_decl = Genintern.glob_sign * raw_record_decl
22 type top_record_decl = interp_sign * glob_record_decl
23
24 type raw_indt_decl = Vernacentries.Preprocessed_Mind_decl.inductive
25 type glob_indt_decl = Genintern.glob_sign * raw_indt_decl
26 type top_indt_decl = interp_sign * glob_indt_decl
27
28 [%%if coq = "9.0" || coq = "9.1"]
29 type raw_red_expr = Genredexpr.raw_red_expr
30 [%%else]
31 type raw_red_expr = Redexpr.raw_red_expr
32 [%%endif]
33
34 type raw_constant_decl = {
35 name : qualified_name;
36 atts : Attributes.vernac_flags;
37 udecl : Constrexpr.universe_decl_expr option;
38 typ : Constrexpr.local_binder_expr list * Constrexpr.constr_expr option;
39 body : Constrexpr.constr_expr option;
40 red : raw_red_expr option;
41 }
42
43 val pr_raw_constant_decl : Environ.env -> Evd.evar_map -> raw_constant_decl -> Pp.t
44 type glob_constant_decl = Genintern.glob_sign * raw_constant_decl
45 type top_constant_decl = interp_sign * glob_constant_decl
46
47 type raw_context_decl = Constrexpr.local_binder_expr list
48 type glob_context_decl = Genintern.glob_sign * raw_context_decl
49 type top_context_decl = interp_sign * glob_context_decl
50
51 type ('a,'b,'c,'d,'e) t =
52 | Int : int -> ('a,'b,'c,'d,'e) t
53 | String : string -> ('a,'b,'c,'d,'e) t
54 | Term : 'a -> ('a,'b,'c,'d,'e) t
55 | RecordDecl : 'b -> ('a,'b,'c,'d,'e) t
56 | IndtDecl : 'c -> ('a,'b,'c,'d,'e) t
57 | ConstantDecl : 'd -> ('a,'b,'c,'d,'e) t
58 | Context : 'e -> ('a,'b,'c,'d,'e) t
59
60 type raw = (raw_term, raw_record_decl, raw_indt_decl, raw_constant_decl, raw_context_decl) t
61 type glob = (glob_term, glob_record_decl, glob_indt_decl, glob_constant_decl, glob_context_decl) t
62 type top = (top_term, top_record_decl, top_indt_decl, top_constant_decl, top_context_decl) t
63
64 val pp_raw : Environ.env -> Evd.evar_map -> raw -> Pp.t
65 val pp_glob : Environ.env -> Evd.evar_map -> glob -> Pp.t
66 val pp_top : Environ.env -> Evd.evar_map -> top -> Pp.t
67
68 val glob : Genintern.glob_sign -> raw -> glob
69 val interp : interp_sign -> Environ.env -> Evd.evar_map -> glob -> top
70 val subst : Mod_subst.substitution -> glob -> glob
71
72 end
73
74 module Tac : sig
75
76 type raw_term = Constrexpr.constr_expr
77 type glob_term = Genintern.glob_constr_and_expr
78 type top_term = interp_sign * Genintern.glob_constr_and_expr
79
80 type raw_ltac_term = Constrexpr.constr_expr
81 type glob_ltac_term = Glob_term.glob_constr
82 type top_ltac_term = interp_sign * Names.Id.t
83
84 type raw_ltac_tactic = Ltac_plugin.Tacexpr.raw_tactic_expr
85 type glob_ltac_tactic = Ltac_plugin.Tacexpr.glob_tactic_expr
86 [%%if coq = "9.0" || coq = "9.1" || coq = "9.2"]
87 type top_ltac_tactic = Ltac_plugin.Tacinterp.value
88 [%%else]
89 type top_ltac_tactic = Ltac_plugin.Tacarg.tacvalue
90 [%%endif]
91
92 type ltac_ty = Int | String | Term | OpenTerm | List of ltac_ty
93
94 type ('a,'f,'t) t =
95 | Int : int -> ('a,'f,'t) t
96 | String : string -> ('a,'f,'t) t
97 | Term : 'a -> ('a,'f,'t) t
98 | OpenTerm : 'a -> ('a,'f,'t) t
99 | LTac : ltac_ty * 'f -> ('a,'f,'t) t
100 | LTacTactic : 't -> ('a,'f,'t) t
101
102 type raw = (raw_term, raw_ltac_term, raw_ltac_tactic) t
103 type glob = (glob_term, glob_ltac_term, glob_ltac_tactic) t
104 type top = (top_term, top_ltac_term, top_ltac_tactic) t
105
106 val subst : Mod_subst.substitution -> glob -> glob
107 val wit : (raw, glob, top) Genarg.genarg_type
108
109 end
110
111 val tac : Tac.top_ltac_tactic Elpi.API.Conversion.t
112 val is_ltac_tactic : Elpi.API.RawOpaqueData.t -> bool
113 val to_ltac_tactic : Elpi.API.RawOpaqueData.t -> Tac.top_ltac_tactic
114
115 (* for tactics *)
116 val in_elpi_tac :
117 loc:Loc.t ->
118 base: Elpi.API.Compile.program ->
119 depth:int ->
120 ?calldepth:int ->
121 Rocq_elpi_HOAS.full Rocq_elpi_HOAS.conv_context ->
122 hyps ->
123 Evd.evar_map ->
124 Elpi.API.State.t ->
125 Tac.top ->
126 Elpi.API.State.t * term list * Elpi.API.Conversion.extra_goals
127
128 (* for coercions *)
129 val in_elpi_tac_econstr :
130 base:unit ->
131 depth:int -> ?calldepth:int ->
132 Rocq_elpi_HOAS.full Rocq_elpi_HOAS.conv_context ->
133 hyps ->
134 Evd.evar_map ->
135 Elpi.API.State.t ->
136 EConstr.t ->
137 Elpi.API.State.t * term list * Elpi.API.Conversion.extra_goals
138
139 (* for commands *)
140 val in_elpi_cmd :
141 loc:Loc.t ->
142 depth:int ->
143 base:Elpi.API.Compile.program ->
144 ?calldepth:int ->
145 Rocq_elpi_HOAS.empty Rocq_elpi_HOAS.conv_context ->
146 Elpi.API.State.t ->
147 raw:bool ->
148 Cmd.top ->
149 Elpi.API.State.t * term * Elpi.API.Conversion.extra_goals
150 val in_elpi_cmd_synterp :
151 depth:int -> ?calldepth:int ->
152 Elpi.API.State.t ->
153 Cmd.raw ->
154 Elpi.API.State.t * term * Elpi.API.Conversion.extra_goals
155
156 type coq_arg = Cint of int | Cstr of string | Ctrm of EConstr.t | CLtac1 of Tac.top_ltac_tactic
157
158 val in_coq_arg :
159 depth:int ->
160 Rocq_elpi_HOAS.full Rocq_elpi_HOAS.conv_context ->
161 Elpi.API.Data.constraints ->
162 Elpi.API.State.t ->
163 term ->
164 Elpi.API.State.t * coq_arg * Elpi.API.Conversion.extra_goals
165
166 val ltac1_of_arg : coq_arg -> Ltac_plugin.Tacinterp.value