Skip to content

Commit a47bd32

Browse files
committed
[api] Move universe syntax to Glob_term
We move syntax for universes from `Misctypes` to `Glob_term`. There is basically no reason that this type is there instead of the proper file, as witnessed by the diff. Unfortunately the change is not compatible due to moving a type to a higher level in the hierarchy, but we expect few problems. This change plus the related PR (rocq-prover#6515) moving universe declaration to their proper place make `Misctypes` into basically an empty file save for introduction patterns.
1 parent 6c8b00e commit a47bd32

21 files changed

+56
-52
lines changed

dev/doc/changes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
### ML API
44

5+
Misctypes
6+
7+
Syntax for universe sorts and kinds has been moved from `Misctypes`
8+
to `Glob_term`, as these are turned into kernel terms by
9+
`Pretyping`.
10+
511
Proof engine
612

713
- More functions have been changed to use `EConstr`, notably the

interp/constrextern.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ open Pattern
1818
open Constrexpr
1919
open Notation_term
2020
open Notation
21-
open Misctypes
2221
open Ltac_pretype
2322

2423
(** Translation of pattern, cases pattern, glob_constr and term into syntax

interp/constrintern.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -980,17 +980,17 @@ let intern_reference ref =
980980
in
981981
Smartlocate.global_of_extended_global r
982982

983-
let sort_info_of_level_info (info: Misctypes.level_info) : (Libnames.reference * int) option =
983+
let sort_info_of_level_info (info: level_info) : (Libnames.reference * int) option =
984984
match info with
985-
| Misctypes.UAnonymous -> None
986-
| Misctypes.UUnknown -> None
987-
| Misctypes.UNamed id -> Some (id, 0)
985+
| UAnonymous -> None
986+
| UUnknown -> None
987+
| UNamed id -> Some (id, 0)
988988

989-
let glob_sort_of_level (level: Misctypes.glob_level) : Misctypes.glob_sort =
989+
let glob_sort_of_level (level: glob_level) : glob_sort =
990990
match level with
991-
| Misctypes.GProp -> Misctypes.GProp
992-
| Misctypes.GSet -> Misctypes.GSet
993-
| Misctypes.GType info -> Misctypes.GType [sort_info_of_level_info info]
991+
| GProp -> GProp
992+
| GSet -> GSet
993+
| GType info -> GType [sort_info_of_level_info info]
994994

995995
(* Is it a global reference or a syntactic definition? *)
996996
let intern_qualid qid intern env ntnvars us args =
@@ -1024,7 +1024,7 @@ let intern_qualid qid intern env ntnvars us args =
10241024
DAst.make ?loc @@ GApp (DAst.make ?loc:loc' @@ GRef (ref, us), arg)
10251025
| _ -> err ()
10261026
end
1027-
| Some [s], GSort (Misctypes.GType []) -> DAst.make ?loc @@ GSort (glob_sort_of_level s)
1027+
| Some [s], GSort (GType []) -> DAst.make ?loc @@ GSort (glob_sort_of_level s)
10281028
| Some [_old_level], GSort _new_sort ->
10291029
(* TODO: add old_level and new_sort to the error message *)
10301030
user_err ?loc (str "Cannot change universe level of notation " ++ pr_qualid qid.v)

interp/declare.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,5 @@ val declare_univ_binders : GlobRef.t -> Universes.universe_binders -> unit
8888
val declare_universe_context : polymorphic -> Univ.ContextSet.t -> unit
8989

9090
val do_universe : polymorphic -> Misctypes.lident list -> unit
91-
val do_constraint : polymorphic -> (Misctypes.glob_level * Univ.constraint_type * Misctypes.glob_level) list ->
91+
val do_constraint : polymorphic -> (Glob_term.glob_level * Univ.constraint_type * Glob_term.glob_level) list ->
9292
unit

library/misctypes.ml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,6 @@ type 'id move_location =
5050
| MoveFirst
5151
| MoveLast (** can be seen as "no move" when doing intro *)
5252

53-
(** Sorts *)
54-
55-
type 'a glob_sort_gen =
56-
| GProp (** representation of [Prop] literal *)
57-
| GSet (** representation of [Set] literal *)
58-
| GType of 'a (** representation of [Type] literal *)
59-
60-
type 'a universe_kind =
61-
| UAnonymous
62-
| UUnknown
63-
| UNamed of 'a
64-
65-
type level_info = Libnames.reference universe_kind
66-
type glob_level = level_info glob_sort_gen
67-
type glob_constraint = glob_level * Univ.constraint_type * glob_level
68-
69-
type sort_info = (Libnames.reference * int) option list
70-
type glob_sort = sort_info glob_sort_gen
71-
7253
(** A synonym of [Evar.t], also defined in Term *)
7354

7455
type existential_key = Evar.t

parsing/g_constr.ml4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
open Names
1212
open Libnames
13+
open Glob_term
1314
open Constrexpr
1415
open Constrexpr_ops
1516
open Util

parsing/pcoq.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ module Constr :
227227
val operconstr : constr_expr Gram.entry
228228
val ident : Id.t Gram.entry
229229
val global : reference Gram.entry
230-
val universe_level : glob_level Gram.entry
231-
val sort : glob_sort Gram.entry
230+
val universe_level : Glob_term.glob_level Gram.entry
231+
val sort : Glob_term.glob_sort Gram.entry
232232
val sort_family : Sorts.family Gram.entry
233233
val pattern : cases_pattern_expr Gram.entry
234234
val constr_pattern : constr_expr Gram.entry

pretyping/constr_matching.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ open EConstr
2020
open Vars
2121
open Pattern
2222
open Patternops
23-
open Misctypes
2423
open Context.Rel.Declaration
2524
open Ltac_pretype
2625
(*i*)
@@ -277,6 +276,7 @@ let matches_core env sigma allow_bound_rels
277276

278277
| PSort ps, Sort s ->
279278

279+
let open Glob_term in
280280
begin match ps, ESorts.kind sigma s with
281281
| GProp, Prop Null -> subst
282282
| GSet, Prop Pos -> subst

pretyping/constrexpr.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ open Decl_kinds
1717

1818
(** [constr_expr] is the abstract syntax tree produced by the parser *)
1919

20-
type universe_decl_expr = (lident list, glob_constraint list) gen_universe_decl
20+
type universe_decl_expr = (lident list, Glob_term.glob_constraint list) gen_universe_decl
2121

2222
type ident_decl = lident * universe_decl_expr option
2323
type name_decl = lname * universe_decl_expr option
@@ -50,7 +50,7 @@ type prim_token =
5050
| Numeral of raw_natural_number * sign
5151
| String of string
5252

53-
type instance_expr = Misctypes.glob_level list
53+
type instance_expr = Glob_term.glob_level list
5454

5555
type cases_pattern_expr_r =
5656
| CPatAlias of cases_pattern_expr * lname
@@ -98,7 +98,7 @@ and constr_expr_r =
9898
| CHole of Evar_kinds.t option * intro_pattern_naming_expr * Genarg.raw_generic_argument option
9999
| CPatVar of patvar
100100
| CEvar of Glob_term.existential_name * (Id.t * constr_expr) list
101-
| CSort of glob_sort
101+
| CSort of Glob_term.glob_sort
102102
| CCast of constr_expr * constr_expr cast_type
103103
| CNotation of notation * constr_notation_substitution
104104
| CGeneralization of binding_kind * abstraction_kind option * constr_expr

pretyping/detyping.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ open EConstr
1414
open Glob_term
1515
open Termops
1616
open Mod_subst
17-
open Misctypes
1817
open Evd
1918
open Ltac_pretype
2019

0 commit comments

Comments
 (0)