@@ -1178,7 +1178,8 @@ if a section is open and @local! is used). Omitting the body and the type is
1178
1178
an error. Note: using this API for declaring an axiom or a section variable is
1179
1179
deprecated, use coq.env.add-axiom or coq.env.add-section-variable instead.
1180
1180
Supported attributes:
1181
- - @local! (default: false)|} )))))),
1181
+ - @local! (default: false)
1182
+ - @using! (default: section variables actually used)|} )))))),
1182
1183
(fun id body types opaque _ ~depth {options} _ -> on_global_state "coq.env.add-const" (fun state ->
1183
1184
let local = options .local = Some true in
1184
1185
let sigma = get_sigma state in
@@ -1207,7 +1208,12 @@ Supported attributes:
1207
1208
let scope = if local
1208
1209
then Locality. Discharge
1209
1210
else Locality. (Global ImportDefaultBehavior) in
1210
- let cinfo = Declare.CInfo. make ~name :(Id. of_string id ) ~typ :types ~impargs :[] () in
1211
+ let using = Option. map Proof_using. (fun s ->
1212
+ let types = Option.List. cons types [] in
1213
+ let expr = using_from_string s in
1214
+ let names = process_expr (get_global_env state ) sigma expr types in
1215
+ List. fold_right Names.Id.Set. add names Names.Id.Set. empty ) options .using in
1216
+ let cinfo = Declare.CInfo. make ?using ~name :(Id. of_string id ) ~typ :types ~impargs :[] () in
1211
1217
let info = Declare.Info. make ~scope ~kind ~poly :false ~udecl () in
1212
1218
let gr = Declare. declare_definition ~cinfo ~info ~opaque :(opaque = Given true ) ~body sigma in
1213
1219
state , !: (global_constant_of_globref gr ), [] ))),
0 commit comments