Debian Codegraph @

kernel/opaqueproof.ml

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 Mod_subst
13 open Cooking
14
15 type 'a delayed_universes =
16 | PrivateMonomorphic of 'a
17 | PrivatePolymorphic of Univ.ContextSet.t
18
19 type opaque_proofterm = Constr.t * unit delayed_universes
20
21 type opaque =
22 | Indirect of substitution list * cooking_info list * DirPath.t * int (* subst, discharge, lib, index *)
23
24 type opaquetab = {
25 opaque_len : int;
26 (** Size of the above map *)
27 opaque_dir : DirPath.t;
28 }
29 let empty_opaquetab = {
30 opaque_len = 0;
31 opaque_dir = DirPath.dummy;
32 }
33
34 let repr (Indirect (s, ci, dp, i)) = (s, ci, dp, i)
35
36 let create dp tab =
37 let id = tab.opaque_len in
38 let opaque_dir =
39 if DirPath.equal dp tab.opaque_dir then tab.opaque_dir
40 else if DirPath.equal tab.opaque_dir DirPath.dummy then dp
41 else CErrors.anomaly
42 (Pp.str "Using the same opaque table for multiple dirpaths.") in
43 let ntab = { opaque_dir; opaque_len = id + 1 } in
44 Indirect ([], [], dp, id), ntab
45
46 let subst_opaque sub = function
47 | Indirect (s, ci, dp, i) -> Indirect (sub :: s, ci, dp, i)
48
49 let discharge_opaque info = function
50 | Indirect (s, ci, dp, i) ->
51 assert (CList.is_empty s);
52 Indirect ([], info :: ci, dp, i)
53
54 module HandleMap = Int.Map
55
56 type opaque_handle = int
57
58 let repr_handle i = i
59
60 let mem_handle i { opaque_len = n; _ } = i < n