NametabThis module contains the tables for globalization.
These globalization tables associate internal object references to qualified names (qualid). There are three classes of names:
kernel_name, constant, inductive, module_path, DirPath.tglobal_reference, abbreviation, extended_global_reference, global_dir_reference, ...full_pathreference and qualidMost functions in this module fall into one of the following categories:
push : visibility -> full_user_name -> object_reference -> unit
Registers the object_reference to be referred to by the full_user_name (and its suffixes according to visibility). full_user_name can either be a full_path or a DirPath.t.
exists : full_user_name -> bool
Is the full_user_name already attributed as an absolute user name of some object?
locate : qualid -> object_reference
Finds the object referred to by qualid or raises Not_found
full_name : qualid -> full_user_name
Finds the full user name referred to by qualid or raises Not_found
shortest_qualid_of : object_reference -> user_name
The user_name can be for example the shortest non ambiguous qualid or the full_user_name or Id.t. Such a function can also have a local context argument.
module GlobDirRef : sig ... endto this type are mapped DirPath.t's in the nametab
exception GlobalizationError of Libnames.qualidval error_global_not_found : info:Exninfo.info -> Libnames.qualid -> 'aRaises a globalization error
The visibility can be registered either
val map_visibility : (int -> int) -> visibility -> visibilitymodule type NAMETAB = sig ... endCommon APIs on name tables.
module type WarnedTab = sig ... endNAMETAB extended with warnings associated to some of the elements.
module XRefs : WarnedTab with type elt = Globnames.extended_global_reference and type warning_data := Globnames.extended_global_reference UserWarn.with_qfNAMETAB extended with warnings associated to some of the elements.
module Univs : NAMETAB with type elt = Univ.UGlobal.tCommon APIs on name tables.
module Quality : NAMETAB with type elt = Sorts.QGlobal.tCommon APIs on name tables.
module ModTypes : NAMETAB with type elt = Names.ModPath.tModule types, modules and open modules/modtypes/sections form three separate name spaces (maybe this will change someday)
module Modules : NAMETAB with type elt = Names.ModPath.tCommon APIs on name tables.
module OpenMods : NAMETAB with type elt = GlobDirRef.tCommon APIs on name tables.
module CustomEntries : NAMETAB with type elt = Globnames.CustomName.tDo not directly use locate with this, instead use the compat layer Metasyntax.intern_custom_name.
These functions operate on XRefs but are about a subset of extended_global_reference for convenience.
val push : ?user_warns:Globnames.extended_global_reference UserWarn.with_qf -> visibility -> Libnames.full_path -> Names.GlobRef.t -> unitval push_abbreviation : ?user_warns:Globnames.extended_global_reference UserWarn.with_qf -> visibility -> Libnames.full_path -> Globnames.abbreviation -> unitval locate : Libnames.qualid -> Names.GlobRef.tval locate_all : Libnames.qualid -> Names.GlobRef.t listval locate_constant : Libnames.qualid -> Names.Constant.tval locate_abbreviation : Libnames.qualid -> Globnames.abbreviationval remove_abbreviation : Libnames.full_path -> Globnames.abbreviation -> unitval global_of_path : Libnames.full_path -> Names.GlobRef.tval path_of_global : Names.GlobRef.t -> Libnames.full_pathval path_of_abbreviation : Globnames.abbreviation -> Libnames.full_pathval shortest_qualid_of_global : ?loc:Loc.t -> ?force_short:bool -> Names.Id.Set.t -> Names.GlobRef.t -> Libnames.qualidReturns a qualid for the given global reference. If ~force_short:true is passed, always returns the shortest qualid. Otherwise (default), respects the "Printing Fully Qualified" flag: when the flag is set, returns the fully qualified name; when unset, returns the shortest qualid.
val shortest_qualid_of_abbreviation : ?loc:Loc.t -> ?force_short:bool -> Names.Id.Set.t -> Globnames.abbreviation -> Libnames.qualidval pr_global_env : Names.Id.Set.t -> Names.GlobRef.t -> Pp.tPrinting of global references using names as short as possible.
Fully qualified printing control. When enabled, pr_global_env uses fully qualified names instead of shortest names. The flag is controlled by the "Printing Fully Qualified" option declared in printer.ml.
Returns in particular the dirpath or the basename of the full path associated to global reference
val dirpath_of_global : Names.GlobRef.t -> Names.DirPath.tval basename_of_global : Names.GlobRef.t -> Names.Id.tThese functions globalize user-level references into global references, like locate and co, but raise GlobalizationError for unbound qualid and UserError for type mismatches (eg global_inductive when the qualid is bound to a constructor)
val global : Libnames.qualid -> Names.GlobRef.tval global_inductive : Libnames.qualid -> Names.inductiveval set_cci_src_loc : Globnames.extended_global_reference -> Loc.t -> unitval cci_src_loc : Globnames.extended_global_reference -> Loc.t optionmodule type ValueType = sig ... endmodule type StateInfo = sig ... endNecessary data to declare the imperative state for a nametab.
module EasyNoWarn (M : sig ... end) () : NAMETAB with type elt = M.tGenerate a nametab, without warning support.
module type WarnInfo = sig ... endmodule MakeWarned (M : NAMETAB) (W : WarnInfo with type elt = M.elt) () : WarnedTab with type elt = M.elt and type warning_data := W.dataAdd warning support to an existing nametab.
module type SimpleWarnS = sig ... endmodule Easy (M : sig ... end) () : WarnedTab with type elt = M.t and type warning_data := M.t UserWarn.with_qfGenerate a nametab with simple warning support (UserWarn.create_depr_and_user_warnings_qf).
val push_modtype : visibility -> Libnames.full_path -> Names.ModPath.t -> unitval push_module : visibility -> Libnames.full_path -> Names.ModPath.t -> unitval push_dir : visibility -> Libnames.full_path -> GlobDirRef.t -> unitval push_universe : visibility -> Libnames.full_path -> Univ.UGlobal.t -> unitDeprecation and user warn info
val is_warned_xref : Globnames.extended_global_reference -> Globnames.extended_global_reference UserWarn.with_qf optionval warn_user_warn_xref : ?loc:Loc.t -> Globnames.extended_global_reference UserWarn.with_qf -> Globnames.extended_global_reference -> unitThese functions globalize a (partially) qualified name or fail with Not_found
val locate_extended : Libnames.qualid -> Globnames.extended_global_referenceval locate_modtype : Libnames.qualid -> Names.ModPath.tval locate_dir : Libnames.qualid -> GlobDirRef.tval locate_module : Libnames.qualid -> Names.ModPath.tval locate_section : Libnames.qualid -> Libnames.full_pathval locate_universe : Libnames.qualid -> Univ.UGlobal.tval locate_extended_nowarn : Libnames.qualid -> Globnames.extended_global_referenceThese functions locate all global references with a given suffix; if qualid is valid as such, it comes first in the list
val locate_extended_all : Libnames.qualid -> Globnames.extended_global_reference listval locate_extended_all_dir : Libnames.qualid -> GlobDirRef.t listval locate_extended_all_modtype : Libnames.qualid -> Names.ModPath.t listval locate_extended_all_module : Libnames.qualid -> Names.ModPath.t listval completion_canditates : Libnames.qualid -> Globnames.extended_global_reference listExperimental completion support, API is _unstable_
completion_canditates qualid will return the list of global references that have qualid as a prefix. UI usually will want to compose this with shortest_qualid_of_global
Mapping a full path to a global reference
val extended_global_of_path : Libnames.full_path -> Globnames.extended_global_referenceval exists_cci : Libnames.full_path -> boolval exists_modtype : Libnames.full_path -> boolval exists_module : Libnames.full_path -> boolval exists_dir : Libnames.full_path -> boolval exists_universe : Libnames.full_path -> boolval full_name_modtype : Libnames.qualid -> Libnames.full_pathval full_name_module : Libnames.qualid -> Libnames.full_pathval full_name_open_mod : Libnames.qualid -> Libnames.full_pathFinding user names corresponding to the given internal name
Returns the full path bound to a global reference or syntactic definition, and the (full) dirpath associated to a module path
val path_of_module : Names.ModPath.t -> Libnames.full_pathval path_of_modtype : Names.ModPath.t -> Libnames.full_pathval path_of_universe : Univ.UGlobal.t -> Libnames.full_pathA universe_id might not be registered with a corresponding user name.
The shortest_qualid functions given an object with user_name Mylib.A.B.x, try to find the shortest among x, B.x, A.B.x and Mylib.A.B.x that denotes the same object.
val shortest_qualid_of_modtype : ?loc:Loc.t -> ?force_short:bool -> Names.ModPath.t -> Libnames.qualidval shortest_qualid_of_module : ?loc:Loc.t -> ?force_short:bool -> Names.ModPath.t -> Libnames.qualidval shortest_qualid_of_dir : ?loc:Loc.t -> ?force_short:bool -> GlobDirRef.t -> Libnames.qualidval shortest_qualid_of_universe : ?loc:Loc.t -> ?force_short:bool -> 'u Names.Id.Map.t -> Univ.UGlobal.t -> Libnames.qualidIn general we have a UnivNames.universe_binders around rather than a Id.Set.t