UStateThis 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 Univ.UContext.t |
Type of universe unification states. They allow the incremental building of universe constraints during an interactive proof.
Different ways to create a new universe state
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 * Names.Id.t Univ.Level.Map.t) -> tMain entry point when only names matter, e.g. for printing.
val of_context_set : Univ.ContextSet.t -> tMain entry point when starting from the instance of a global reference, e.g. when building a scheme.
Misc
val is_empty : t -> boolval context_set : t -> Univ.ContextSet.tThe local context of the state, i.e. a set of bound variables together with their associated constraints.
type universe_opt_subst = UnivSubst.universe_opt_substval subst : t -> UnivSubst.universe_opt_substThe local universes that are unification variables
val algebraics : t -> Univ.Level.Set.tThe subset of unification variables that can be instantiated with algebraic universes as they appear in inferred types only.
val constraints : t -> Univ.Constraints.tShorthand for context_set composed with ContextSet.constraints.
val context : t -> Univ.UContext.tShorthand for context_set with Context_set.to_context.
type named_universes_entry = universes_entry * UnivNames.universe_bindersval univ_entry : poly:bool -> t -> named_universes_entryPick from context or context_set based on poly.
val universe_binders : t -> UnivNames.universe_bindersReturn local names of universes.
val add_constraints : t -> Univ.Constraints.t -> tval add_universe_constraints : t -> UnivProblem.Set.t -> 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
val restrict_universe_context : lbound:UGraph.Bound.t -> Univ.ContextSet.t -> Univ.Level.Set.t -> Univ.ContextSet.trestrict_universe_context lbound (univs,csts) keep restricts univs to the universes in keep. The constraints csts are adjusted so that transitive constraints between remaining universes (those in keep and those not in univs) are preserved.
val restrict : t -> Univ.Level.Set.t -> trestrict uctx ctx restricts the local universes of uctx to ctx extended by local named universes and side effect universes (from demote_seff_univs). Transitive constraints between retained universes are preserved.
val restrict_even_binders : t -> Univ.Level.Set.t -> trestrict_even_binders uctx ctx restricts the local universes of uctx to ctx extended by side effect universes (from demote_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_subst : t -> UnivSubst.universe_opt_subst -> 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_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_flexible_variable : t -> algebraic:bool -> Univ.Level.t -> tmake_flexible_variable g algebraic l
Turn the variable l flexible, and algebraic if algebraic is true and l can be. That is if there are no strict upper constraints on l and and it does not appear in the instance of any non-algebraic universe. Otherwise the variable is just made flexible.
If l is already algebraic it will remain so even with algebraic:false.
val make_nonalgebraic_variable : t -> Univ.Level.t -> tMake the level non algebraic. Undefined behaviour on already-defined algebraics.
Turn all undefined flexible algebraic variables into simply flexible ones. Can be used in case the variables might appear in universe instances (typically for polymorphic program obligations).
val is_sort_variable : t -> Sorts.t -> Univ.Level.t optionval constrain_variables : Univ.Level.Set.t -> t -> ttype universe_decl = (Univ.Level.t list, Univ.Constraints.t) gen_universe_declval default_univ_decl : universe_declval check_univ_decl : poly:bool -> t -> universe_decl -> named_universes_entrycheck_univ_decl ctx decl
If non extensible in decl, check that the local universes (resp. universe constraints) in ctx are implied by decl.
Return a universes_entry containing the local universes of ctx and their constraints.
When polymorphic, the universes corresponding to decl.univdecl_instance come first in the order defined by that list.
val check_mono_univ_decl : t -> universe_decl -> Univ.ContextSet.tval pr_uctx_level : t -> Univ.Level.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 pr_weak : (Univ.Level.t -> Pp.t) -> t -> Pp.tval pr_universe_opt_subst : universe_opt_subst -> Pp.t