aboutsummaryrefslogtreecommitdiff
path: root/vernac/comAssumption.ml
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2020-05-01 10:44:44 +0200
committerEmilio Jesus Gallego Arias2020-05-07 18:13:56 +0200
commit6675e7c54ae552df31a281098ba7f7d199372aec (patch)
tree294a830870202c75d1bb44ab4e9c8630961a4576 /vernac/comAssumption.ml
parentad84e6948a86db491a00bb92ec3e00a9a743b1f9 (diff)
[declare] Merge DeclareDef into Declare
The API in `DeclareDef` should become the recommended API in `Declare`. This greatly reduces the exposure of internals; we still have a large offender in `Lemmas` but that will be taken care of in the next commit; effectively removing quite some chunks from `declare.mli`. This PR originally introduced a dependency cycle due to: - `Declare`: uses `Vernacexpr.decl_notation list` - `Vernacexpr`: uses `ComHint.hint_expr` - `ComHint`: uses `Declare.declare_constant` This is a real cycle in the sense that `ComHint` would have also move to `DeclareDef` in the medium term. There were quite a few ways to solve it, we have chosen to move the hints ast to `Vernacexpr` as it is not very invasive and seems consistent with the current style. Alternatives, which could be considered at a later stage are for example moving the notations AST to `Metasyntax`, having `Declare` not to depend on `Vernacexpr` [which seems actually a good thing to do in the medium term], reworking notation support more deeply...
Diffstat (limited to 'vernac/comAssumption.ml')
-rw-r--r--vernac/comAssumption.ml11
1 files changed, 5 insertions, 6 deletions
diff --git a/vernac/comAssumption.ml b/vernac/comAssumption.ml
index 776ffd6b9f..023d76ce3b 100644
--- a/vernac/comAssumption.ml
+++ b/vernac/comAssumption.ml
@@ -87,8 +87,7 @@ let context_set_of_entry = function
| Monomorphic_entry uctx -> uctx
let declare_assumptions ~poly ~scope ~kind univs nl l =
- let open DeclareDef in
- let () = match scope with
+ let () = let open Declare in match scope with
| Discharge ->
(* declare universes separately for variables *)
DeclareUctx.declare_universe_context ~poly (context_set_of_entry (fst univs))
@@ -100,10 +99,10 @@ let declare_assumptions ~poly ~scope ~kind univs nl l =
let univs,subst' =
List.fold_left_map (fun univs id ->
let refu = match scope with
- | Discharge ->
+ | Declare.Discharge ->
declare_variable is_coe ~kind typ imps Glob_term.Explicit id;
GlobRef.VarRef id.CAst.v, Univ.Instance.empty
- | Global local ->
+ | Declare.Global local ->
declare_axiom is_coe ~local ~poly ~kind typ univs imps nl id
in
next_univs univs, (id.CAst.v, Constr.mkRef refu))
@@ -130,7 +129,7 @@ let process_assumptions_udecls ~scope l =
udecl, id
| (_, ([], _))::_ | [] -> assert false
in
- let open DeclareDef in
+ let open Declare in
let () = match scope, udecl with
| Discharge, Some _ ->
let loc = first_id.CAst.loc in
@@ -208,7 +207,7 @@ let context_insection sigma ~poly ctx =
let uctx = Evd.evar_universe_context sigma in
let kind = Decls.(IsDefinition Definition) in
let _ : GlobRef.t =
- DeclareDef.declare_entry ~name ~scope:DeclareDef.Discharge
+ Declare.declare_entry ~name ~scope:Declare.Discharge
~kind ~impargs:[] ~uctx entry
in
()