Something went wrong. Try again.
forked from coq/coq
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125(************************************************************************)(* * The Rocq Prover / The Rocq Development Team *)(* v * Copyright INRIA, CNRS and contributors *)(* <O___,, * (see version control and CREDITS file for authors & dates) *)(* \VV/ **************************************************************)(* // * This file is distributed under the terms of the *)(* * GNU Lesser General Public License Version 2.1 *)(* * (see LICENSE file for the text of the license) *)(************************************************************************)
open Univopen UVars
(** {6 Graphs of universes. } *)type t
val set_type_in_type : bool -> t -> t
(** When [type_in_type], functions adding level constraints do not fail and may instead ignore inconsistent constraints.
Checking functions such as [check_leq] always return [true].*)val type_in_type : t -> bool
type 'a check_function = t -> 'a -> 'a -> bool
val check_leq : Universe.t check_functionval check_eq : Universe.t check_functionval check_eq_level : Level.t check_function
(** The initial graph of universes: Prop < Set *)val initial_universes : t
(** Initial universes, but keeping options such as type in type from the argument. *)val initial_universes_with : t -> t
(** Check equality of instances w.r.t. a universe graph *)val check_eq_instances : (Sorts.Quality.t -> Sorts.Quality.t -> bool) -> t -> Instance.t -> Instance.t -> bool
(** {6 ... } *)(** Merge of constraints in a universes graph. The function [merge_constraints] merges a set of constraints in a given universes graph. It raises the exception [UniverseInconsistency] if the constraints are not satisfiable. *)
type path_explanation
type explanation = | Path of path_explanation | Other of Pp.t
type univ_inconsistency = Sorts.printer option * (UnivConstraint.kind * Sorts.t * Sorts.t * explanation option)
exception UniverseInconsistency of univ_inconsistency
val enforce_constraint : UnivConstraint.t -> t -> t
val merge_constraints : UnivConstraints.t -> t -> t
val check_constraint : t -> UnivConstraint.t -> boolval check_constraints : UnivConstraints.t -> t -> bool
val check_eq_sort : (Sorts.Quality.t -> Sorts.Quality.t -> bool) -> t -> Sorts.t -> Sorts.t -> bool(** Checks whether (i) the first quality is equal to the second and (ii) that the universe of the first one is equal to the universe of the second one. *)
val check_leq_sort : (Sorts.Quality.t -> Sorts.Quality.t -> bool) -> t -> Sorts.t -> Sorts.t -> bool(** Checks whether (i) the second quality eliminates into the first and (ii) that the universe of the first one is below the universe of the second one. *)
val enforce_leq_alg : Univ.Universe.t -> Univ.Universe.t -> t -> Univ.UnivConstraints.t * t
(** Adds a universe to the graph, ensuring it is >= or > Set. @raise AlreadyDeclared if the level is already declared in the graph. *)
exception AlreadyDeclared
val add_universe : Level.t -> strict:bool -> t -> t
(** Check that the universe levels are declared. *)val check_declared_universes : t -> Univ.Level.Set.t -> (unit, Univ.Level.Set.t) result
(** The empty graph of universes *)val empty_universes : t
(** [constraints_of_universes g] returns [csts] and [partition] where [csts] are the non-Eq constraints and [partition] is the partition of the universes into equivalence classes. *)val constraints_of_universes : t -> UnivConstraints.t * Level.Set.t list
(** [constraints_for ~kept g] returns the constraints about the universes [kept] in [g] up to transitivity.
eg if [g] is [a <= b <= c] then [constraints_for ~kept:{a, c} g] is [a <= c]. *)val constraints_for : kept:Level.Set.t -> t -> UnivConstraints.t
val domain : t -> Level.Set.t(** Known universes *)
(** {6 Dumping} *)
type node =| Alias of Level.t| Node of bool Level.Map.t (** Nodes v s.t. u < v (true) or u <= v (false) *)
val repr : t -> node Level.Map.t
(** {6 Pretty-printing of universes. } *)
val pr_universes : (Level.t -> Pp.t) -> node Level.Map.t -> Pp.t
val explain_universe_inconsistency : Sorts.printer -> univ_inconsistency -> Pp.t
(** {6 Debugging} *)val check_universes_invariants : t -> unit
module Internal : sig (** Makes the qvars treated as above prop. Do not use outside kernel inductive typechecking. *) val add_template_qvars : Sorts.QVar.Set.t -> t -> t
val is_above_prop : t -> Sorts.QVar.t -> boolend