Debian Codegraph @

plugins/extraction/table.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 Libnames
13 open Miniml
14 open Declarations
15
16 module Refset' : CSig.USetS with type elt = global
17 module Refmap' : CSig.UMapS with type key = global
18
19 type t
20
21 val safe_basename_of_global : t -> global -> Id.t
22
23 val make_table : unit -> t
24
25 (*s Warning and Error messages. *)
26
27 val warning_axioms : t -> unit
28 val warning_opaques : t -> bool -> unit
29 val warning_ambiguous_name : ?loc:Loc.t -> qualid * ModPath.t * GlobRef.t -> unit
30 val warning_id : string -> unit
31 val error_axiom_scheme : ?loc:Loc.t -> global -> int -> 'a
32 val error_constant : ?loc:Loc.t -> global -> 'a
33 val error_inductive : ?loc:Loc.t -> global -> 'a
34 val error_nb_cons : unit -> 'a
35 val error_module_clash : ModPath.t -> ModPath.t -> 'a
36 val error_no_module_expr : ModPath.t -> 'a
37 val error_singleton_become_prop : inductive -> 'a
38 val error_unknown_module : ?loc:Loc.t -> qualid -> 'a
39 val error_scheme : unit -> 'a
40 val error_not_visible : global -> 'a
41 val error_MPfile_as_mod : ModPath.t -> bool -> 'a
42 val check_inside_section : unit -> unit
43 val check_loaded_modfile : ModPath.t -> unit
44 val msg_of_implicit : kill_reason -> string
45 val err_or_warn_remaining_implicit : kill_reason -> unit
46
47 val info_file : string -> unit
48
49 (*s utilities about [module_path] and [kernel_names] and [GlobRef.t] *)
50
51 val occur_kn_in_ref : MutInd.t -> global -> bool
52 val repr_of_r : global -> KerName.t
53 val modpath_of_r : global -> ModPath.t
54 val label_of_r : global -> Id.t
55 val base_mp : ModPath.t -> ModPath.t
56 val is_modfile : ModPath.t -> bool
57 val string_of_modfile : t -> DirPath.t -> string
58 val file_of_modfile : t -> DirPath.t -> string
59 val is_toplevel : ModPath.t -> bool
60 val at_toplevel : ModPath.t -> bool
61 val mp_length : ModPath.t -> int
62 val prefixes_mp : ModPath.t -> ModPath.Set.t
63 val common_prefix_from_list :
64 ModPath.t -> ModPath.t list -> ModPath.t option
65 val get_nth_label_mp : int -> ModPath.t -> Id.t
66 val labels_of_ref : global -> ModPath.t * Id.t list
67
68 (*s Some table-related operations *)
69
70 (* For avoiding repeated extraction of the same constant or inductive,
71 we use cache functions below. Indexing by constant name isn't enough,
72 due to modules we could have a same constant name but different
73 content. So we check that the [constant_body] hasn't changed from
74 recording time to retrieving time. Same for inductive : we store
75 [mutual_inductive_body] as checksum. In both case, we should ideally
76 also check the env *)
77
78 val add_typedef : t -> Constant.t -> InfvInst.t -> constant_body -> ml_type -> unit
79 val lookup_typedef : t -> Constant.t -> InfvInst.t -> constant_body -> ml_type option
80
81 val add_cst_type : t -> Constant.t -> InfvInst.t -> constant_body -> ml_schema -> unit
82 val lookup_cst_type : t -> Constant.t -> InfvInst.t -> constant_body -> ml_schema option
83
84 val add_ind : t -> MutInd.t -> InfvInst.t -> mutual_inductive_body -> ml_ind -> unit
85 val lookup_ind : t -> MutInd.t -> InfvInst.t -> mutual_inductive_body -> ml_ind option
86
87 val add_inductive_kind : t -> MutInd.t -> InfvInst.t -> inductive_kind -> unit
88 val is_coinductive : t -> global -> bool
89 val is_coinductive_type : t -> ml_type -> bool
90 (* What are the fields of a record (empty for a non-record) *)
91 val get_record_fields :
92 t -> global -> global option list
93 val record_fields_of_type : t -> ml_type -> global option list
94
95 val add_recursors : t -> Environ.env -> MutInd.t -> unit
96 val is_recursor : t -> global -> bool
97
98 val add_projection : t -> int -> Constant.t -> inductive -> unit
99 val is_projection : t -> global -> bool
100
101 val add_info_axiom : t -> global -> unit
102 val remove_info_axiom : t -> global -> unit
103 val add_log_axiom : t -> global-> unit
104 val add_symbol : t -> global -> unit
105 val add_symbol_rule : t -> global -> Id.t -> unit
106
107 val add_opaque : t -> global -> unit
108 val remove_opaque : t -> global -> unit
109
110 (*s Output Directory parameter *)
111
112 val output_directory : unit -> string
113
114 (*s AccessOpaque parameter *)
115
116 val access_opaque : unit -> bool
117
118 (*s AutoInline parameter *)
119
120 val auto_inline : unit -> bool
121
122 (*s TypeExpand parameter *)
123
124 val type_expand : unit -> bool
125
126 (*s KeepSingleton parameter *)
127
128 val keep_singleton : unit -> bool
129
130 (*s Optimize parameter *)
131
132 type opt_flag =
133 { opt_kill_dum : bool; (* 1 *)
134 opt_fix_fun : bool; (* 2 *)
135 opt_case_iot : bool; (* 4 *)
136 opt_case_idr : bool; (* 8 *)
137 opt_case_idg : bool; (* 16 *)
138 opt_case_cst : bool; (* 32 *)
139 opt_case_fun : bool; (* 64 *)
140 opt_case_app : bool; (* 128 *)
141 opt_let_app : bool; (* 256 *)
142 opt_lin_let : bool; (* 512 *)
143 opt_lin_beta : bool } (* 1024 *)
144
145 val optims : unit -> opt_flag
146
147 (*s Controls whether dummy lambda are removed *)
148
149 val conservative_types : unit -> bool
150
151 (*s A comment to print at the beginning of the files *)
152
153 val file_comment : unit -> string
154
155 (*s Target language. *)
156
157 type lang = Ocaml | Haskell | Scheme | JSON
158 val lang : unit -> lang
159
160 (*s Table for custom inlining *)
161
162 val to_inline : global -> bool
163 val to_keep : global -> bool
164
165 (*s Table for implicits arguments *)
166
167 val implicits_of_global : global -> Int.Set.t
168
169 (*s Table for user-given custom ML extractions. *)
170
171 (* UGLY HACK: registration of a function defined in [extraction.ml] *)
172 val type_scheme_nb_args_hook : (Environ.env -> Constr.t -> int) Hook.t
173
174 val is_custom : global -> bool
175 val is_inline_custom : global -> bool
176 val is_foreign_custom : global -> bool
177 val find_callback : global -> string option
178 val find_custom : global -> string
179 val find_type_custom : global -> string list * string
180
181 val is_custom_match : ml_branch array -> bool
182 val find_custom_match : ml_branch array -> string
183
184 (*s Extraction commands. *)
185
186 val extraction_language : lang -> unit
187 val extraction_inline : bool -> qualid list -> unit
188 val print_extraction_inline : unit -> Pp.t
189 val print_extraction_foreign : unit -> Pp.t
190 val print_extraction_callback : unit -> Pp.t
191 val reset_extraction_inline : unit -> unit
192 val reset_extraction_foreign : unit -> unit
193 val reset_extraction_callback : unit -> unit
194 val extract_callback : string option -> qualid -> unit
195 val extract_constant_inline :
196 bool -> qualid -> string list -> string -> unit
197 val extract_constant_foreign :
198 qualid -> string -> unit
199 val extract_inductive :
200 qualid -> string -> string list -> string option -> unit
201
202
203 type int_or_id = ArgInt of int | ArgId of Id.t
204 val extraction_implicit : qualid -> int_or_id list -> unit
205
206 (*s Table of blacklisted filenames *)
207
208 val extraction_blacklist : string list -> unit
209 val reset_extraction_blacklist : unit -> unit
210 val print_extraction_blacklist : unit -> Pp.t
211
212
213