Skip to content

Commit fc6a92a

Browse files
Merge PR #21420: Inline code in abstract internals
Reviewed-by: SkySkimmer Co-authored-by: SkySkimmer <[email protected]>
2 parents 9e15d2c + c1386c8 commit fc6a92a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

vernac/declare.ml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -930,10 +930,6 @@ let process_proof ~info:Info.({ udecl; poly }) ?(is_telescope=false) = function
930930
((body, uctx), eff)) in
931931
(delayed_definition_entry ?using ~univs ~types:initial_typ ~feedback_id body, initial_euctx))
932932

933-
let ustate_of_proof = function
934-
| DefaultProof { proof } -> proof.output_ustate
935-
| DeferredOpaqueProof { initial_euctx } -> initial_euctx
936-
937933
let declare_definition_scheme ~univs ~role ~name ~effs c =
938934
let entry = pure_definition_entry ~univs c in
939935
declare_private_constant ~role ~name ~opaque:false entry effs
@@ -2218,15 +2214,18 @@ let build_constant_by_tactic ~name ?warn_incomplete ~sigma ~env ~sign ~poly (typ
22182214
let pinfo = Proof_info.make ~cinfo ~info () in
22192215
let pf = start_proof_core ~name ~pinfo sigma [Some sign, typ] in
22202216
let pf, status = map_fold ~f:(Proof.solve env (Goal_select.select_nth 1) None tac) pf in
2221-
let proof = close_proof ?warn_incomplete ~keep_body_ucst_separate:false ~opaque:Vernacexpr.Transparent pf in
2222-
let _eff, entries = process_proof ~info proof.proof_object in (* FIXME: return the locally introduced effects *)
2217+
let proof = prepare_proof ?warn_incomplete pf in
2218+
let (body, types) = match proof.output_entries with [p] -> p | _ -> assert false in
2219+
let univs =
2220+
let _, used_univs = universes_of_body_type ~used_univs:Univ.Level.Set.empty body types in
2221+
let uctx = UState.restrict proof.output_ustate used_univs in
2222+
UState.check_univ_decl ~poly uctx UState.default_univ_decl
2223+
in
2224+
let entry = definition_entry_core ~univs ?types body in
2225+
(* FIXME: return the locally introduced effects *)
22232226
let { Proof.sigma } = Proof.data pf.proof in
2224-
let sigma = Evd.set_universe_context sigma (ustate_of_proof proof.proof_object) in
2225-
match entries with
2226-
| [ { proof_entry_body = Default { body; opaque = Transparent } } as entry, _] ->
2227-
{ entry with proof_entry_body = body }, status, sigma
2228-
| _ ->
2229-
CErrors.anomaly Pp.(str "[build_constant_by_tactic] close_proof returned more than one proof term, or a non transparent one.")
2227+
let sigma = Evd.set_universe_context sigma proof.output_ustate in
2228+
entry, status, sigma
22302229

22312230
let build_by_tactic env ~uctx ~poly ~typ tac =
22322231
let name = Id.of_string ("temporary_proof"^string_of_int (next())) in

0 commit comments

Comments
 (0)