| 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 Util |
| 12 | open Names |
| 13 | |
| 14 | (** Indirection between logical names and global references. |
| 15 | |
| 16 | This module provides a mechanism to bind “names” to constants and to look up |
| 17 | these constants using their names. |
| 18 | |
| 19 | The two main functions are [register_ref n r] which binds the name [n] to |
| 20 | the reference [r] and [lib_ref n] which returns the previously registered |
| 21 | reference under name [n]. |
| 22 | |
| 23 | The first function is meant to be available through the vernacular command |
| 24 | [Register r as n], so that plug-ins can refer to a constant without knowing |
| 25 | its user-facing name, the precise module path in which it is defined, etc. |
| 26 | |
| 27 | For instance, [lib_ref "core.eq.type"] returns the proper [GlobRef.t] for |
| 28 | the type of the core equality type. |
| 29 | *) |
| 30 | |
| 31 | (** Registers a global reference under the given name. *) |
| 32 | val register_ref : Libobject.locality -> string -> GlobRef.t -> unit |
| 33 | |
| 34 | exception NotFoundRef of string |
| 35 | |
| 36 | (** Retrieves the reference bound to the given name (by a previous call to {!register_ref}). |
| 37 | Raises [NotFoundRef] if no reference is bound to this name. *) |
| 38 | val lib_ref : string -> GlobRef.t |
| 39 | |
| 40 | (** As [lib_ref] but returns [None] instead of raising. *) |
| 41 | val lib_ref_opt : string -> GlobRef.t option |
| 42 | |
| 43 | (** Checks whether a name refers to a registered constant. |
| 44 | For any name [n], if [has_ref n] returns [true], [lib_ref n] will succeed. *) |
| 45 | val has_ref : string -> bool |
| 46 | |
| 47 | (** Checks whether a name is bound to a known reference. *) |
| 48 | val check_ref : string -> GlobRef.t -> bool |
| 49 | |
| 50 | (** Checks whether a name is bound to a known inductive. *) |
| 51 | val check_ind_ref : string -> inductive -> bool |
| 52 | |
| 53 | (** List of all currently bound names. *) |
| 54 | val get_lib_refs : unit -> (string * GlobRef.t) list |
| 55 | |
| 56 | (* Exceptions to deprecation *) |
| 57 | |
| 58 | (** {2 For Equality tactics} *) |
| 59 | |
| 60 | type rocq_sigma_data = { |
| 61 | proj1 : GlobRef.t; |
| 62 | proj2 : GlobRef.t; |
| 63 | elim : GlobRef.t; |
| 64 | intro : GlobRef.t; |
| 65 | typ : GlobRef.t } |
| 66 | |
| 67 | val build_sigma_type : rocq_sigma_data delayed |
| 68 | val build_sigma : rocq_sigma_data delayed |
| 69 | val build_prod : rocq_sigma_data delayed |
| 70 | |
| 71 | type rocq_eq_data = { |
| 72 | eq : GlobRef.t; |
| 73 | ind : GlobRef.t; |
| 74 | refl : GlobRef.t; |
| 75 | sym : GlobRef.t; |
| 76 | trans: GlobRef.t; |
| 77 | congr: GlobRef.t } |
| 78 | |
| 79 | val build_rocq_eq_data : rocq_eq_data delayed |
| 80 | val build_rocq_identity_data : rocq_eq_data delayed |
| 81 | val build_rocq_jmeq_data : rocq_eq_data delayed |
| 82 | |
| 83 | (* XXX: Some tactics special case JMeq, they should instead check for |
| 84 | the constant, not the module *) |
| 85 | (** For tactics/commands requiring vernacular libraries *) |
| 86 | val check_required_library : string list -> unit |
| 87 | |
| 88 | (* Used by obligations *) |
| 89 | val datatypes_module_name : string list |
| 90 | |
| 91 | (* Used by ind_schemes *) |
| 92 | val logic_module_name : string list |
| 93 | |
| 94 | (* Used by tactics *) |
| 95 | val jmeq_module_name : string list |