| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
type 'v kind = |
| 24 |
| Any |
| 25 |
| Fail of string |
| 26 |
| Tuple of string * 'v array |
| 27 |
| Sum of string * int * 'v array array |
| 28 |
| Array of 'v |
| 29 |
| List of 'v |
| 30 |
| Opt of 'v |
| 31 |
| Int |
| 32 |
| String |
| 33 |
| Annot of string * 'v |
| 34 |
| Int64 |
| 35 |
| Float64 |
| 36 |
|
| 37 |
module Vector = struct |
| 38 |
|
| 39 |
type ('a,_) t = |
| 40 |
| [] : ('a, [`O]) t |
| 41 |
| (::) : 'a * ('a, 's) t -> ('a, [`S of 's]) t |
| 42 |
|
| 43 |
type 'n size = (unit,'n) t |
| 44 |
|
| 45 |
let rec vmap : 'n 'a 'b. ('a -> 'b) -> ('a,'n) t -> ('b, 'n) t = |
| 46 |
fun (type n) f (v:(_,n) t) : (_,n) t -> |
| 47 |
match v with |
| 48 |
| [] -> [] |
| 49 |
| x :: tl -> |
| 50 |
let x = f x in |
| 51 |
x :: vmap f tl |
| 52 |
|
| 53 |
let rec viter2 : 'n 'a 'b. ('a -> 'b -> unit) -> ('a,'n) t -> ('b,'n) t -> unit = |
| 54 |
fun (type n) f (v1:(_,n) t) (v2:(_,n) t) -> |
| 55 |
match v1, v2 with |
| 56 |
| [], []-> () |
| 57 |
| x1 :: tl1, x2 :: tl2 -> |
| 58 |
let () = f x1 x2 in |
| 59 |
viter2 f tl1 tl2 |
| 60 |
end |
| 61 |
|
| 62 |
module Internal : sig |
| 63 |
type value |
| 64 |
|
| 65 |
val equal : value -> value -> bool |
| 66 |
|
| 67 |
val kind : value -> value kind |
| 68 |
|
| 69 |
val of_kind : value kind -> value |
| 70 |
|
| 71 |
val mfix : 'n Vector.size -> ((value,'n) Vector.t -> (value,'n) Vector.t) -> (value,'n) Vector.t |
| 72 |
end = struct |
| 73 |
type value = |
| 74 |
| V of value kind |
| 75 |
| Proxy of value kind ref |
| 76 |
|
| 77 |
let kind = function |
| 78 |
| V v -> v |
| 79 |
| Proxy v -> !v |
| 80 |
|
| 81 |
|
| 82 |
let equal a b = kind a == kind b |
| 83 |
|
| 84 |
let of_kind v = V v |
| 85 |
|
| 86 |
let check_productive = function |
| 87 |
| Proxy _ -> assert false |
| 88 |
| V v -> v |
| 89 |
|
| 90 |
let mfix (type n) (n:n Vector.size) (f : (value,n) Vector.t -> (value,n) Vector.t) : (value,n) Vector.t = |
| 91 |
let open Vector in |
| 92 |
let self = vmap (fun () -> Proxy (ref Any)) n in |
| 93 |
let ans = f self in |
| 94 |
let () = viter2 (fun self ans -> |
| 95 |
let ans = check_productive ans in |
| 96 |
match self with |
| 97 |
| Proxy self -> self := ans |
| 98 |
| _ -> assert false) |
| 99 |
self ans |
| 100 |
in |
| 101 |
ans |
| 102 |
|
| 103 |
end |
| 104 |
|
| 105 |
type nonrec value = Internal.value |
| 106 |
|
| 107 |
let equal = Internal.equal |
| 108 |
|
| 109 |
let kind = Internal.kind |
| 110 |
|
| 111 |
let of_kind = Internal.of_kind |
| 112 |
|
| 113 |
let mfix = Internal.mfix |
| 114 |
|
| 115 |
let fix f = |
| 116 |
let [v] : _ Vector.t = mfix [()] (fun [v] -> [f v]) in |
| 117 |
v |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
let v_tuple name v = of_kind @@ Tuple(name,v) |
| 122 |
let v_sum name cc vv = of_kind @@ Sum(name,cc,vv) |
| 123 |
let v_enum name n = of_kind @@ Sum(name,n,[||]) |
| 124 |
let v_annot a v = of_kind @@ Annot (a, v) |
| 125 |
let v_fail f = of_kind @@ Fail f |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
let v_tuple_c (name,v) = v_tuple name v |
| 130 |
let v_sum_c (name,cc,vv) = v_sum name cc vv |
| 131 |
let v_annot_c (a, v) = v_annot a v |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
let v_any = of_kind Any |
| 136 |
let v_int = of_kind Int |
| 137 |
let v_int64 = of_kind Int64 |
| 138 |
let v_float64 = of_kind Float64 |
| 139 |
let v_string = of_kind String |
| 140 |
let v_opt v = of_kind @@ Opt v |
| 141 |
let v_list v = of_kind @@ List v |
| 142 |
let v_array v = of_kind @@ Array v |
| 143 |
let v_pair v1 v2 = v_tuple "*" [|v1; v2|] |
| 144 |
let v_bool = v_enum "bool" 2 |
| 145 |
let v_unit = v_enum "unit" 1 |
| 146 |
|
| 147 |
let v_set v = |
| 148 |
fix (fun s -> |
| 149 |
v_sum_c ("Set.t",1, |
| 150 |
[|[|s; v_annot_c ("elem", v); s; v_annot_c ("bal", v_int)|]|])) |
| 151 |
|
| 152 |
let v_map vk vd = |
| 153 |
fix (fun m -> |
| 154 |
v_sum_c ("Map.t",1, |
| 155 |
[|[|m; v_annot_c("key",vk); v_annot_c("data",vd); m; v_annot_c("bal",v_int)|]|])) |
| 156 |
|
| 157 |
let v_hset v = v_map v_int (v_set v) |
| 158 |
let v_hmap vk vd = v_map v_int (v_map vk vd) |
| 159 |
|
| 160 |
let v_pred v = v_pair v_bool (v_set v) |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
let v_id = v_string |
| 165 |
let v_dp = v_annot_c ("dirpath", v_list v_id) |
| 166 |
let v_name = v_sum "name" 1 [|[|v_id|]|] |
| 167 |
let v_uid = v_tuple "uniq_ident" [|v_int;v_string;v_dp|] |
| 168 |
let v_mp = |
| 169 |
fix (fun v_mp -> |
| 170 |
v_sum_c("module_path",0, |
| 171 |
[|[|v_dp|]; |
| 172 |
[|v_uid|]; |
| 173 |
[|v_mp;v_id|]|])) |
| 174 |
let v_kn = v_tuple "kernel_name" [|v_mp;v_id;v_int|] |
| 175 |
let v_cst = v_sum "cst|mind" 0 [|[|v_kn|];[|v_kn;v_kn|]|] |
| 176 |
let v_ind = v_tuple "inductive" [|v_cst;v_int|] |
| 177 |
let v_cons = v_tuple "constructor" [|v_ind;v_int|] |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
let v_level_global = v_tuple "Level.Global.t" [|v_dp;v_string;v_int|] |
| 182 |
let v_raw_level = v_sum "raw_level" 1 |
| 183 |
[|[|v_level_global|]; [|v_int|]|] |
| 184 |
let v_level = v_tuple "level" [|v_int;v_raw_level|] |
| 185 |
let v_expr = v_tuple "levelexpr" [|v_level;v_int|] |
| 186 |
let v_univ = v_list v_expr |
| 187 |
|
| 188 |
let v_qglobal = v_pair v_dp v_id |
| 189 |
|
| 190 |
|
| 191 |
let v_qvar = v_sum "qvar" 0 [|[|v_int|];[|v_string;v_int|];[|v_qglobal|]|] |
| 192 |
|
| 193 |
let v_constant_quality = v_enum "constant_quality" 3 |
| 194 |
|
| 195 |
let v_quality = v_sum "quality" 0 [|[|v_qvar|];[|v_constant_quality|]|] |
| 196 |
|
| 197 |
let v_elim_cstrs = |
| 198 |
v_annot_c |
| 199 |
("Quality.ElimConstraints.t", |
| 200 |
v_set |
| 201 |
(v_tuple "Quality.ElimConstraint.t" |
| 202 |
[|v_quality;v_enum "elim_request" 2;v_quality|])) |
| 203 |
|
| 204 |
|
| 205 |
let v_univ_cstrs = |
| 206 |
v_annot_c |
| 207 |
("Univ.UnivConstraints.t", |
| 208 |
v_set |
| 209 |
(v_tuple "Univ.UnivConstraint.t" |
| 210 |
[|v_level;v_enum "order_request" 3;v_level|])) |
| 211 |
|
| 212 |
let v_cstrs = |
| 213 |
v_tuple |
| 214 |
"PConstraints.t" |
| 215 |
[|v_elim_cstrs;v_univ_cstrs|] |
| 216 |
|
| 217 |
let v_variance = v_enum "variance" 3 |
| 218 |
|
| 219 |
let v_instance = v_annot_c ("instance", v_pair (v_array v_quality) (v_array v_level)) |
| 220 |
let v_abs_context = v_tuple "abstract_universe_context" [|v_pair (v_array v_name) (v_array v_name); v_cstrs|] |
| 221 |
let v_univ_context_set = v_tuple "universe_context_set" [|v_hset v_level;v_univ_cstrs|] |
| 222 |
let v_sort_context_set = v_tuple "sort_context_set" [|v_set v_qvar; v_elim_cstrs|] |
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
let v_sort = v_sum "sort" 3 [|[|v_univ|];[|v_qvar;v_univ|]|] |
| 227 |
|
| 228 |
let v_relevance = v_sum "relevance" 2 [|[|v_qvar|]|] |
| 229 |
let v_binder_annot x = v_tuple "binder_annot" [|x;v_relevance|] |
| 230 |
|
| 231 |
let v_puniverses v = v_tuple "punivs" [|v;v_instance|] |
| 232 |
|
| 233 |
let v_caseinfo = |
| 234 |
let v_cstyle = v_enum "case_style" 5 in |
| 235 |
let v_cprint = v_tuple "case_printing" [|v_cstyle|] in |
| 236 |
v_tuple "case_info" [|v_ind;v_int;v_array v_int;v_array v_int;v_cprint|] |
| 237 |
|
| 238 |
let v_cast = v_enum "cast_kind" 3 |
| 239 |
|
| 240 |
let v_proj_repr = v_tuple "projection_repr" [|v_ind;v_int;v_int;v_cst|] |
| 241 |
let v_proj = v_tuple "projection" [|v_proj_repr; v_bool|] |
| 242 |
|
| 243 |
let v_uint63 = |
| 244 |
if Sys.word_size == 64 then v_int else v_int64 |
| 245 |
|
| 246 |
let v_constr = |
| 247 |
fix (fun v_constr -> |
| 248 |
let v_prec = |
| 249 |
v_tuple_c ("prec_declaration", |
| 250 |
[|v_array (v_binder_annot v_name); v_array v_constr; v_array v_constr|]) |
| 251 |
in |
| 252 |
let v_fix = v_tuple_c ("pfixpoint", [|v_tuple_c ("fix2",[|v_array v_int;v_int|]);v_prec|]) in |
| 253 |
let v_cofix = v_tuple_c ("pcofixpoint",[|v_int;v_prec|]) in |
| 254 |
let v_case_invert = v_sum_c ("case_inversion", 1, [|[|v_array v_constr|]|]) in |
| 255 |
let v_case_branch = v_tuple_c ("case_branch", [|v_array (v_binder_annot v_name); v_constr|]) in |
| 256 |
let v_case_return = v_tuple_c ("case_return", [|v_tuple_c ("case_return'", [|v_array (v_binder_annot v_name); v_constr|]); v_relevance|]) in |
| 257 |
v_sum_c ("constr",0,[| |
| 258 |
[|v_int|]; |
| 259 |
[|v_id|]; |
| 260 |
[|v_fail "Meta"|]; |
| 261 |
[|v_fail "Evar"|]; |
| 262 |
[|v_sort|]; |
| 263 |
[|v_constr;v_cast;v_constr|]; |
| 264 |
[|v_binder_annot v_name;v_constr;v_constr|]; |
| 265 |
[|v_binder_annot v_name;v_constr;v_constr|]; |
| 266 |
[|v_binder_annot v_name;v_constr;v_constr;v_constr|]; |
| 267 |
[|v_constr;v_array v_constr|]; |
| 268 |
[|v_puniverses v_cst|]; |
| 269 |
[|v_puniverses v_ind|]; |
| 270 |
[|v_puniverses v_cons|]; |
| 271 |
[|v_caseinfo;v_instance; v_array v_constr; v_case_return; v_case_invert; v_constr; v_array v_case_branch|]; |
| 272 |
[|v_fix|]; |
| 273 |
[|v_cofix|]; |
| 274 |
[|v_proj;v_relevance;v_constr|]; |
| 275 |
[|v_uint63|]; |
| 276 |
[|v_float64|]; |
| 277 |
[|v_string|]; |
| 278 |
[|v_instance;v_array v_constr;v_constr;v_constr|] |
| 279 |
|])) |
| 280 |
|
| 281 |
let v_rdecl = v_sum "rel_declaration" 0 |
| 282 |
[| [|v_binder_annot v_name; v_constr|]; |
| 283 |
[|v_binder_annot v_name; v_constr; v_constr|] |] |
| 284 |
let v_rctxt = v_list v_rdecl |
| 285 |
|
| 286 |
let v_ndecl = v_sum "named_declaration" 0 |
| 287 |
[| [|v_binder_annot v_id; v_constr|]; |
| 288 |
[|v_binder_annot v_id; v_constr; v_constr|] |] |
| 289 |
let v_nctxt = v_list v_ndecl |
| 290 |
|
| 291 |
let v_section_ctxt = v_enum "emptylist" 1 |
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
let v_univ_abstracted v = v_tuple "univ_abstracted" [|v;v_abs_context|] |
| 297 |
|
| 298 |
let v_delta_hint = |
| 299 |
v_sum "delta_hint" 0 [|[|v_int; v_opt (v_univ_abstracted v_constr)|];[|v_kn|]|] |
| 300 |
|
| 301 |
let v_resolver = |
| 302 |
v_tuple "delta_resolver" |
| 303 |
[|v_mp; v_map v_mp v_mp; |
| 304 |
v_hmap v_kn v_delta_hint|] |
| 305 |
|
| 306 |
let v_subst = |
| 307 |
v_annot_c ("substitution", v_map v_mp v_resolver) |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
let v_abstr_info = |
| 312 |
v_tuple_c ("abstr_info", [|v_nctxt; v_abs_context; v_instance|]) |
| 313 |
|
| 314 |
let v_abstr_inst_info = |
| 315 |
v_tuple_c ("abstr_inst_info", [|v_list v_id; v_instance|]) |
| 316 |
|
| 317 |
let v_expand_info = |
| 318 |
v_tuple_c ("expand_info", [|v_hmap v_cst v_abstr_inst_info; v_hmap v_cst v_abstr_inst_info|]) |
| 319 |
|
| 320 |
let v_cooking_info = |
| 321 |
v_tuple_c ("cooking_info", [|v_expand_info; v_abstr_info|]) |
| 322 |
|
| 323 |
let v_opaque = |
| 324 |
v_sum "opaque" 0 [|[|v_list v_subst; v_list v_cooking_info; v_dp; v_int|]|] |
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
let v_conv_level = |
| 329 |
v_sum "conv_level" 2 [|[|v_int|]|] |
| 330 |
|
| 331 |
let v_oracle = |
| 332 |
v_tuple "oracle" [| |
| 333 |
v_map v_id v_conv_level; |
| 334 |
v_hmap v_cst v_conv_level; |
| 335 |
v_hmap v_proj_repr v_conv_level; |
| 336 |
v_pred v_id; |
| 337 |
v_pred v_cst; |
| 338 |
v_pred v_proj_repr; |
| 339 |
|] |
| 340 |
|
| 341 |
let v_template_universes = |
| 342 |
v_tuple "template_universes" [| |
| 343 |
v_list (v_opt v_sort); |
| 344 |
v_sort; |
| 345 |
v_abs_context; |
| 346 |
v_instance; |
| 347 |
|] |
| 348 |
|
| 349 |
let v_primitive = |
| 350 |
v_enum "primitive" 63 |
| 351 |
|
| 352 |
let v_cst_def = |
| 353 |
v_sum "constant_def" 0 |
| 354 |
[|[|v_opt v_int|]; [|v_constr|]; [|v_opaque|]; [|v_primitive|]; [|v_bool|]|] |
| 355 |
|
| 356 |
let v_typing_flags = |
| 357 |
v_tuple "typing_flags" |
| 358 |
[|v_bool; v_bool; v_bool; |
| 359 |
v_oracle; v_bool; v_bool; |
| 360 |
v_bool; v_bool; v_bool; v_bool; v_bool|] |
| 361 |
|
| 362 |
let v_univs = v_sum "universes" 1 [|[|v_abs_context|]|] |
| 363 |
|
| 364 |
let v_vm_reloc_table = v_array (v_pair v_int v_int) |
| 365 |
|
| 366 |
let v_vm_annot_switch = v_tuple "vm_annot_switch" [|v_vm_reloc_table; v_bool; v_int|] |
| 367 |
|
| 368 |
let v_vm_caml_prim = v_enum "vm_caml_prim" 6 |
| 369 |
|
| 370 |
let v_non_subst_reloc = v_sum "vm_non_subst_reloc" 0 [| |
| 371 |
[|v_sort|]; |
| 372 |
[|v_fail "Evar"|]; |
| 373 |
[|v_int|]; |
| 374 |
[|v_instance|]; |
| 375 |
[|v_any|]; |
| 376 |
[|v_uint63|]; |
| 377 |
[|v_float64|]; |
| 378 |
[|v_string|]; |
| 379 |
[|v_vm_annot_switch|]; |
| 380 |
[|v_vm_caml_prim|]; |
| 381 |
|] |
| 382 |
|
| 383 |
let v_reloc = v_sum "vm_reloc" 0 [| |
| 384 |
[|v_ind|]; |
| 385 |
[|v_cst|]; |
| 386 |
[|v_int|]; |
| 387 |
|] |
| 388 |
|
| 389 |
let v_vm_patches = v_tuple "vm_patches" [|v_array v_reloc|] |
| 390 |
|
| 391 |
let v_vm_pbody_code index = |
| 392 |
v_sum "pbody_code" 1 [| |
| 393 |
[|v_array v_bool; index; v_vm_patches|]; |
| 394 |
[|v_cst|]; |
| 395 |
|] |
| 396 |
|
| 397 |
let v_vm_index = v_pair v_dp v_int |
| 398 |
|
| 399 |
let v_vm_indirect_code = v_vm_pbody_code v_vm_index |
| 400 |
|
| 401 |
let v_vm_emitcodes = v_string |
| 402 |
|
| 403 |
let v_vm_fv_elem = v_sum "vm_fv_elem" 0 [| |
| 404 |
[|v_id|]; |
| 405 |
[|v_int|] |
| 406 |
|] |
| 407 |
|
| 408 |
let v_vm_fv = v_array v_vm_fv_elem |
| 409 |
|
| 410 |
let v_vm_positions = v_string |
| 411 |
|
| 412 |
let v_vm_to_patch = v_tuple "vm_to_patch" [|v_vm_emitcodes; v_vm_fv; v_vm_positions; v_array v_non_subst_reloc|] |
| 413 |
|
| 414 |
let v_cb = v_tuple "constant_body" |
| 415 |
[|v_section_ctxt; |
| 416 |
v_instance; |
| 417 |
v_cst_def; |
| 418 |
v_constr; |
| 419 |
v_relevance; |
| 420 |
v_opt v_vm_indirect_code; |
| 421 |
v_univs; |
| 422 |
v_bool; |
| 423 |
v_typing_flags|] |
| 424 |
|
| 425 |
let v_recarg_type = v_sum "recarg_type" 0 |
| 426 |
[|[|v_ind|] ;[|v_cst|] |] |
| 427 |
|
| 428 |
let v_recarg = v_sum "recarg" 1 |
| 429 |
[|[|v_recarg_type|] |] |
| 430 |
|
| 431 |
let v_wfp = |
| 432 |
fix (fun v_wfp -> |
| 433 |
v_sum_c ("wf_paths",0, |
| 434 |
[|[|v_int;v_int|]; |
| 435 |
[|v_recarg;v_array (v_array v_wfp)|]; |
| 436 |
[|v_int;v_array v_wfp|] |
| 437 |
|])) |
| 438 |
|
| 439 |
let v_squash_info = v_sum "squash_info" 1 [|[|v_set v_quality|]|] |
| 440 |
|
| 441 |
let v_has_eta = v_enum "has_eta" 2 |
| 442 |
let v_record_info = |
| 443 |
v_sum "record_info" 2 |
| 444 |
[| [| v_id; v_array v_id; v_array v_relevance; v_array v_constr; v_has_eta |] |] |
| 445 |
|
| 446 |
let v_one_ind = v_tuple "one_inductive_body" |
| 447 |
[|v_id; |
| 448 |
v_rctxt; |
| 449 |
v_sort; |
| 450 |
v_constr; |
| 451 |
v_record_info; |
| 452 |
v_array v_id; |
| 453 |
v_array v_constr; |
| 454 |
v_int; |
| 455 |
v_int; |
| 456 |
v_opt v_squash_info; |
| 457 |
v_array (v_pair v_rctxt v_constr); |
| 458 |
v_array v_int; |
| 459 |
v_array v_int; |
| 460 |
v_wfp; |
| 461 |
v_relevance; |
| 462 |
v_int; |
| 463 |
v_int; |
| 464 |
v_vm_reloc_table|] |
| 465 |
|
| 466 |
let v_finite = v_enum "recursivity_kind" 3 |
| 467 |
|
| 468 |
let v_ind_pack = v_tuple "mutual_inductive_body" |
| 469 |
[|v_array v_one_ind; |
| 470 |
v_finite; |
| 471 |
v_section_ctxt; |
| 472 |
v_instance; |
| 473 |
v_int; |
| 474 |
v_int; |
| 475 |
v_rctxt; |
| 476 |
v_univs; |
| 477 |
v_opt v_template_universes; |
| 478 |
v_opt (v_array v_variance); |
| 479 |
v_opt (v_array v_variance); |
| 480 |
v_opt v_bool; |
| 481 |
v_typing_flags|] |
| 482 |
|
| 483 |
let v_prim_ind = v_enum "prim_ind" 6 |
| 484 |
|
| 485 |
|
| 486 |
let v_prim_type = v_enum "prim_type" 4 |
| 487 |
|
| 488 |
|
| 489 |
let v_retro_action = |
| 490 |
v_sum "retro_action" 0 [| |
| 491 |
[|v_prim_ind; v_ind|]; |
| 492 |
[|v_prim_type; v_cst|]; |
| 493 |
|] |
| 494 |
|
| 495 |
let v_retroknowledge = |
| 496 |
v_sum "module_retroknowledge" 0 [|[|v_list v_retro_action|]|] |
| 497 |
|
| 498 |
let v_puniv = v_opt v_int |
| 499 |
|
| 500 |
let v_pqvar = v_opt v_int |
| 501 |
let v_quality_pattern = v_sum "quality_pattern" 0 [|[|v_pqvar|];[|v_constant_quality|]|] |
| 502 |
|
| 503 |
let v_instance_mask = v_pair (v_array v_quality_pattern) (v_array v_puniv) |
| 504 |
|
| 505 |
let v_sort_pattern = v_sum_c ("sort_pattern", 3, |
| 506 |
[|[|v_puniv|]; |
| 507 |
[|v_pqvar; v_puniv|] |
| 508 |
|]) |
| 509 |
|
| 510 |
let [_v_hpattern;v_elimination;_v_head_elim;_v_patarg] : _ Vector.t = |
| 511 |
mfix [();();();()] (fun [v_hpattern;v_elimination;v_head_elim;v_patarg] -> |
| 512 |
let v_hpattern = |
| 513 |
v_sum_c ("head_pattern", 0, |
| 514 |
[|[|v_int|]; |
| 515 |
[|v_sort_pattern|]; |
| 516 |
[|v_cst; v_instance_mask|]; |
| 517 |
[|v_ind; v_instance_mask|]; |
| 518 |
[|v_cons; v_instance_mask|]; |
| 519 |
[|v_uint63|]; |
| 520 |
[|v_float64|]; |
| 521 |
[|v_string|]; |
| 522 |
[|v_array v_patarg; v_head_elim|]; |
| 523 |
[|v_array v_patarg; v_patarg|]; |
| 524 |
|]) |
| 525 |
|
| 526 |
and v_elimination = |
| 527 |
v_sum_c ("pattern_elimination", 0, |
| 528 |
[|[|v_array v_patarg|]; |
| 529 |
[|v_ind; v_patarg; v_array v_patarg|]; |
| 530 |
[|v_proj_repr|]; |
| 531 |
|]) |
| 532 |
|
| 533 |
and v_head_elim = v_tuple_c ("head*elims", [|v_hpattern; v_list v_elimination|]) |
| 534 |
|
| 535 |
and v_patarg = |
| 536 |
v_sum_c ("pattern_argument", 1, |
| 537 |
[|[|v_int|]; |
| 538 |
[|v_head_elim|]; |
| 539 |
|]) |
| 540 |
in |
| 541 |
[v_hpattern;v_elimination;v_head_elim;v_patarg]) |
| 542 |
|
| 543 |
let v_rewrule = v_tuple "rewrite_rule" |
| 544 |
[| v_tuple "nvars" [| v_int; v_int; v_int |]; v_pair v_instance_mask (v_list v_elimination); v_constr |] |
| 545 |
let v_rrb = v_tuple "rewrite_rules_body" |
| 546 |
[| v_list (v_pair v_cst v_rewrule) |] |
| 547 |
|
| 548 |
let v_module_with_decl = v_sum "with_declaration" 0 [| |
| 549 |
[|v_list v_id; v_mp|]; |
| 550 |
[|v_list v_id; v_pair v_constr (v_opt v_abs_context)|]; |
| 551 |
|] |
| 552 |
|
| 553 |
let v_mae = |
| 554 |
fix (fun v_mae -> |
| 555 |
v_sum_c ("module_alg_expr",0, |
| 556 |
[|[|v_mp|]; |
| 557 |
[|v_mae;v_mp|]; |
| 558 |
[|v_mae; v_module_with_decl|] |
| 559 |
|])) |
| 560 |
|
| 561 |
let [_v_sfb;_v_struc;_v_sign;_v_mexpr;_v_impl;v_module;_v_modtype] : _ Vector.t = |
| 562 |
mfix [();();();();();();()] (fun [v_sfb;v_struc;v_sign;v_mexpr;v_impl;v_module;v_modtype] -> |
| 563 |
let v_noimpl = v_unit in |
| 564 |
let v_sfb = |
| 565 |
v_sum_c ("struct_field_body",0, |
| 566 |
[|[|v_cb|]; |
| 567 |
[|v_ind_pack|]; |
| 568 |
[|v_rrb|]; |
| 569 |
[|v_module|]; |
| 570 |
[|v_modtype|] |
| 571 |
|]) |
| 572 |
and v_struc = v_list (v_tuple_c ("label*sfb",[|v_id;v_sfb|])) |
| 573 |
and v_sign = |
| 574 |
v_sum_c ("module_sign",0, |
| 575 |
[|[|v_struc|]; |
| 576 |
[|v_uid;v_modtype;v_sign|]|]) |
| 577 |
and v_mexpr = |
| 578 |
v_sum_c ("module_expr",0, |
| 579 |
[|[|v_mae|]; |
| 580 |
[|v_mexpr|]|]) |
| 581 |
and v_impl = |
| 582 |
v_sum_c ("module_impl",2, |
| 583 |
[|[|v_mexpr|]; |
| 584 |
[|v_resolver; v_struc|]|]) |
| 585 |
and v_module = |
| 586 |
v_tuple_c ("module_body", |
| 587 |
[|v_sum_c ("when_mod_body", 0, [|[|v_impl|]|]);v_sign;v_opt v_mexpr;v_resolver;v_retroknowledge|]) |
| 588 |
and v_modtype = |
| 589 |
v_tuple_c ("module_type_body", |
| 590 |
[|v_noimpl;v_sign;v_opt v_mexpr;v_resolver;v_unit|]) |
| 591 |
in |
| 592 |
[v_sfb;v_struc;v_sign;v_mexpr;v_impl;v_module;v_modtype]) |
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
let v_vodigest = v_sum_c ("module_impl",0, [| [|v_string|]; [|v_string;v_string|] |]) |
| 597 |
let v_deps = v_array (v_tuple "dep" [|v_dp;v_vodigest|]) |
| 598 |
let v_flags = v_tuple "flags" [|v_bool|] |
| 599 |
let v_compiled_lib = |
| 600 |
v_tuple "compiled" [|v_dp; v_module; v_univ_context_set; v_sort_context_set; v_deps; v_flags|] |
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
let v_libsum = |
| 605 |
v_tuple_c ("summary", [|v_dp;v_deps;v_string;v_any|]) |
| 606 |
|
| 607 |
let v_lib = |
| 608 |
v_tuple_c ("library",[|v_compiled_lib;v_any;v_any|]) |
| 609 |
|
| 610 |
let v_delayed_universes = |
| 611 |
v_sum_c ("delayed_universes", 0, [| [| v_unit |]; [| v_univ_context_set |] |]) |
| 612 |
|
| 613 |
let v_opaquetable = v_array (v_opt (v_pair v_constr v_delayed_universes)) |
| 614 |
|
| 615 |
let v_vmlib = v_tuple "vmlibrary" [|v_dp; v_array v_vm_to_patch|] |