1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
9
(*i $Id: safe_typing.mli 10664 2008-03-14 11:27:37Z soubiran $ i*)
18
(*s Safe environments. Since we are now able to type terms, we can
19
define an abstract type of safe environments, where objects are
20
typed before being added.
22
We also add [open_structure] and [close_section], [close_module] to
23
provide functionnality for sections and interactive modules
28
val env_of_safe_env : safe_environment -> Environ.env
30
val empty_environment : safe_environment
31
val is_empty : safe_environment -> bool
33
(* Adding and removing local declarations (Local or Variables) *)
34
val push_named_assum :
35
identifier * types -> safe_environment ->
36
Univ.constraints * safe_environment
38
identifier * constr * types option -> safe_environment ->
39
Univ.constraints * safe_environment
41
(* Adding global axioms or definitions *)
42
type global_declaration =
43
| ConstantEntry of constant_entry
44
| GlobalRecipe of Cooking.recipe
47
dir_path -> label -> global_declaration -> safe_environment ->
48
constant * safe_environment
50
(* Adding an inductive type *)
52
dir_path -> label -> mutual_inductive_entry -> safe_environment ->
53
mutual_inductive * safe_environment
57
label -> module_entry -> safe_environment
58
-> module_path * safe_environment
60
(* Adding a module alias*)
62
label -> module_path -> safe_environment
63
-> module_path * safe_environment
64
(* Adding a module type *)
66
label -> module_struct_entry -> safe_environment
67
-> module_path * safe_environment
69
(* Adding universe constraints *)
71
Univ.constraints -> safe_environment -> safe_environment
73
(* Settin the strongly constructive or classical logical engagement *)
74
val set_engagement : engagement -> safe_environment -> safe_environment
77
(*s Interactive module functions *)
79
label -> safe_environment -> module_path * safe_environment
81
label -> module_struct_entry option
82
-> safe_environment -> module_path * safe_environment
84
val add_module_parameter :
85
mod_bound_id -> module_struct_entry -> safe_environment -> safe_environment
88
label -> safe_environment -> module_path * safe_environment
91
label -> safe_environment -> module_path * safe_environment
94
module_struct_entry -> safe_environment -> safe_environment
96
val current_modpath : safe_environment -> module_path
97
val current_msid : safe_environment -> mod_self_id
100
(* Loading and saving compilation units *)
102
(* exporting and importing modules *)
103
type compiled_library
105
val start_library : dir_path -> safe_environment
106
-> module_path * safe_environment
108
val export : safe_environment -> dir_path
109
-> mod_self_id * compiled_library
111
val import : compiled_library -> Digest.t -> safe_environment
112
-> module_path * safe_environment
114
(* Remove the body of opaque constants *)
116
val lighten_library : compiled_library -> compiled_library
118
(*s Typing judgments *)
122
val j_val : judgment -> constr
123
val j_type : judgment -> constr
125
(* Safe typing of a term returning a typing judgment and universe
126
constraints to be added to the environment for the judgment to
127
hold. It is guaranteed that the constraints are satisfiable
129
val safe_infer : safe_environment -> constr -> judgment * Univ.constraints
131
val typing : safe_environment -> constr -> judgment
135
(*spiwack: safe retroknowledge functionalities *)
139
val retroknowledge : (retroknowledge-> 'a) -> safe_environment -> 'a
141
val register : safe_environment -> field -> Retroknowledge.entry -> constr