Debian Codegraph @

engine/univNames.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 Univ
13 open Sorts
14
15 type universe_binders = QVar.t Id.Map.t * Level.t Id.Map.t
16
17 type rev_binders = Id.t QVar.Map.t * Id.t Level.Map.t
18
19 let empty_binders = Id.Map.empty, Id.Map.empty
20
21 let empty_rev_binders = QVar.Map.empty, Level.Map.empty
22
23 type univ_name_list = Names.lname list
24
25 type full_name_list = lname list * lname list
26
27 let qualid_of_level (_,ctx) l =
28 match Level.name l with
29 | Some qid ->
30 (try Some (Nametab.shortest_qualid_of_universe ctx qid)
31 with Not_found -> None)
32 | None -> None
33
34 let pr_level_with_global_universes ?(binders=empty_binders) l =
35 match qualid_of_level binders l with
36 | Some qid -> Libnames.pr_qualid qid
37 | None -> Level.raw_pr l
38
39 let qualid_of_quality (ctx,_) q =
40 match Sorts.QVar.repr q with
41 | Global qid ->
42 (try Some (Nametab.Quality.shortest_qualid_gen (fun id -> Id.Map.mem id ctx) qid)
43 with Not_found -> None)
44 | _ -> None
45
46 let pr_quality_with_global_universes ?(binders=empty_binders) q =
47 match qualid_of_quality binders q with
48 | Some qid -> Libnames.pr_qualid qid
49 | None -> Sorts.QVar.raw_pr q