Skip to content

Commit

Permalink
Merge PR coq#19573: Admitted does not emit univ constraints from th…
Browse files Browse the repository at this point in the history
…e proof

Reviewed-by: ejgallego
Reviewed-by: herbelin
Ack-by: ppedrot
Co-authored-by: ejgallego <[email protected]>
  • Loading branch information
coqbot-app[bot] and ejgallego authored Sep 25, 2024
2 parents 45f5da9 + b4d93b8 commit b680523
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion test-suite/bugs/bug_18951.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ Proof.
Fail Admitted. (* Has still evars *)
Unshelve.
3:exact nat.
Admitted.
Fail Admitted.
Abort.
7 changes: 7 additions & 0 deletions test-suite/bugs/bug_19566.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

Universes u v.
Lemma foo : Type@{v}.
exact Type@{u}.
Admitted.

Check Type@{v} : Type@{u}.
13 changes: 4 additions & 9 deletions vernac/declare.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,7 @@ let check_type_evars_solved env sigma typ =
let evars = Evar.Set.elements (Evarutil.undefined_evars_of_term sigma typ) in
match evars with
| [] -> ()
| evk::_ -> CErrors.user_err (str "Cannot admit: the statement has still unresolved existential variables.")
| evk::_ -> CErrors.user_err (str "Cannot admit: the statement has unresolved existential variables.")

let finish_admitted ~pm ~pinfo ~uctx ~sec_vars typs =
(* If the constant was an obligation we need to update the program map *)
Expand All @@ -2261,17 +2261,12 @@ let finish_admitted ~pm ~pinfo ~uctx ~sec_vars typs =
pm

let save_admitted ~pm ~proof =
let Proof.{ entry; sigma } = Proof.data (get proof) in
let typs = List.map pi3 (Proofview.initial_goals entry) in
List.iter (check_type_evars_solved (Global.env()) sigma) typs;
let iproof = get proof in
let Proof.{ entry } = Proof.data iproof in
let typs = List.map pi3 (Proofview.initial_goals entry) in
let sigma = Evd.from_ctx proof.initial_euctx in
List.iter (check_type_evars_solved (Global.env()) sigma) typs;
let sec_vars = compute_proof_using_for_admitted proof.pinfo proof typs iproof in
(* We have the choice of taking CInfo.typ and initial_euctx or or
the typs and uctx from the type. By uniformity we would like to
do the same as in save_lemma_admitted_delayed, but we would need
for that that fixpoints are represented with multi-statements; so
we take the initial types *)
let sigma = Evd.minimize_universes sigma in
let typs = List.map (EConstr.to_constr sigma) typs in
let uctx = Evd.ustate sigma in
Expand Down

0 comments on commit b680523

Please sign in to comment.