Module UState
This file defines universe unification states which are part of evarmaps. Most of the API below is reexported in Evd. Consider using higher-level primitives when needed.
type universes_entry=|Monomorphic_entry of Univ.ContextSet.t|Polymorphic_entry of UVars.UContext.t
type tType of universe unification states. They allow the incremental building of universe constraints during an interactive proof.
Constructors
val empty : tval make : lbound:UGraph.Bound.t -> UGraph.t -> tval make_with_initial_binders : lbound:UGraph.Bound.t -> UGraph.t -> Names.lident list -> tval from_env : ?binders:Names.lident list -> Environ.env -> tMain entry point at the beginning of a declaration declaring the binding names as rigid universes.
val of_names : (UnivNames.universe_binders * UnivNames.rev_binders) -> tMain entry point when only names matter, e.g. for printing.
val of_context_set : UnivGen.sort_context_set -> tMain entry point when starting from the instance of a global reference, e.g. when building a scheme.
Projections and other destructors
val context_set : t -> Univ.ContextSet.tThe local context of the state, i.e. a set of bound variables together with their associated constraints.
val sort_context_set : t -> UnivGen.sort_context_set
type universe_opt_subst= UnivFlex.t
val subst : t -> UnivFlex.tThe local universes that are unification variables
val is_algebraic : Univ.Level.t -> t -> boolCan this universe be instantiated with an algebraic universe (ie it appears in inferred types only).
val constraints : t -> Univ.Constraints.tShorthand for
context_setcomposed withContextSet.constraints.
val context : t -> UVars.UContext.tShorthand for
context_setwithContext_set.to_context.
type named_universes_entry= universes_entry * UnivNames.universe_binders
val univ_entry : poly:bool -> t -> named_universes_entryPick from
contextorcontext_setbased onpoly.
val universe_binders : t -> UnivNames.universe_bindersReturn local names of universes.
val nf_qvar : t -> Sorts.QVar.t -> Sorts.Quality.tReturns the normal form of the sort variable.
val nf_quality : t -> Sorts.Quality.t -> Sorts.Quality.tval nf_instance : t -> UVars.Instance.t -> UVars.Instance.tval nf_level : t -> Univ.Level.t -> Univ.Level.tMust not be allowed to be algebraic
val nf_universe : t -> Univ.Universe.t -> Univ.Universe.tval nf_sort : t -> Sorts.t -> Sorts.tReturns the normal form of the sort.
val nf_relevance : t -> Sorts.relevance -> Sorts.relevanceReturns the normal form of the relevance.
Constraints handling
val add_constraints : t -> Univ.Constraints.t -> t- raises UniversesDiffer
when universes differ
val add_universe_constraints : t -> UnivProblem.Set.t -> t- raises UniversesDiffer
when universes differ
val check_qconstraints : t -> Sorts.QConstraints.t -> boolval check_universe_constraints : t -> UnivProblem.Set.t -> boolval add_quconstraints : t -> Sorts.QUConstraints.t -> t
Names
val quality_of_name : t -> Names.Id.t -> Sorts.QVar.tval universe_of_name : t -> Names.Id.t -> Univ.Level.tRetrieve the universe associated to the name.
val name_level : Univ.Level.t -> Names.Id.t -> t -> tGives a name to the level (making it a binder). Asserts the name is not already used by a level
Unification
val restrict_universe_context : lbound:UGraph.Bound.t -> Univ.ContextSet.t -> Univ.Level.Set.t -> Univ.ContextSet.trestrict_universe_context lbound (univs,csts) keeprestrictsunivsto the universes inkeep. The constraintscstsare adjusted so that transitive constraints between remaining universes (those inkeepand those not inunivs) are preserved.
val restrict : t -> Univ.Level.Set.t -> trestrict uctx ctxrestricts the local universes ofuctxtoctxextended by local named universes and side effect universes (fromdemote_seff_univs). Transitive constraints between retained universes are preserved.
val restrict_even_binders : t -> Univ.Level.Set.t -> trestrict_even_binders uctx ctxrestricts the local universes ofuctxtoctxextended by side effect universes (fromdemote_seff_univs). Transitive constraints between retained universes are preserved.
val univ_rigid : rigidval univ_flexible : rigidval univ_flexible_alg : rigidval merge : ?loc:Loc.t -> sideff:bool -> rigid -> t -> Univ.ContextSet.t -> tval merge_sort_variables : ?loc:Loc.t -> sideff:bool -> t -> Sorts.QVar.Set.t -> tval merge_sort_context : ?loc:Loc.t -> sideff:bool -> rigid -> t -> UnivGen.sort_context_set -> tval emit_side_effects : Safe_typing.private_constants -> t -> tval demote_global_univs : Environ.env -> t -> tRemoves from the uctx_local part of the UState the universes and constraints that are present in the universe graph in the input env (supposedly the global ones)
val demote_seff_univs : Univ.Level.Set.t -> t -> tMark the universes as not local any more, because they have been globally declared by some side effect. You should be using emit_side_effects instead.
val new_sort_variable : ?loc:Loc.t -> ?name:Names.Id.t -> t -> t * Sorts.QVar.tDeclare a new local sort.
val new_univ_variable : ?loc:Loc.t -> rigid -> Names.Id.t option -> t -> t * Univ.Level.tDeclare a new local universe; use rigid if a global or bound universe; use flexible for a universe existential variable; use univ_flexible_alg for a universe existential variable allowed to be instantiated with an algebraic universe
val add_global_univ : t -> Univ.Level.t -> tval make_nonalgebraic_variable : t -> Univ.Level.t -> tcf UnivFlex
val normalize_variables : t -> tval constrain_variables : Univ.Level.Set.t -> t -> tval fix_undefined_variables : t -> tcf UnivFlex
type ('a, 'b, 'c) gen_universe_decl={univdecl_qualities : 'a;univdecl_instance : 'b;univdecl_extensible_instance : bool;univdecl_constraints : 'c;univdecl_extensible_constraints : bool;}type universe_decl= (Sorts.QVar.t list, Univ.Level.t list, Univ.Constraints.t) gen_universe_decl
val default_univ_decl : universe_declval check_univ_decl : poly:bool -> t -> universe_decl -> named_universes_entrycheck_univ_decl ctx declIf non extensible in
decl, check that the local universes (resp. universe constraints) inctxare implied bydecl.Return a
universes_entrycontaining the local universes ofctxand their constraints.When polymorphic, the universes corresponding to
decl.univdecl_instancecome first in the order defined by that list.
val check_mono_univ_decl : t -> universe_decl -> Univ.ContextSet.t
TODO: Document me
Pretty-printing
val pr_uctx_level : t -> Univ.Level.t -> Pp.tval pr_uctx_qvar : t -> Sorts.QVar.t -> Pp.tval qualid_of_level : t -> Univ.Level.t -> Libnames.qualid optionval id_of_level : t -> Univ.Level.t -> Names.Id.t optionOnly looks in the local names, not in the nametab.
val id_of_qvar : t -> Sorts.QVar.t -> Names.Id.t optionval pr_weak : (Univ.Level.t -> Pp.t) -> t -> Pp.tval pr_sort_opt_subst : t -> Pp.t
module Internal : sig ... end