Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #17897: lost of canonical name of auxiliary constants of mutual fix/cofix at refolding time in "cbn" #18616

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- **Fixed:**
:tacn:`cbn` was leaving behind unnamable constants when refolding
mutual fixpoints/cofixpoints from aliased modules
(`#18616 <https://github.com/coq/coq/pull/18616>`_,
fixes `#17897 <https://github.com/coq/coq/issues/17897>`_,
by Hugo Herbelin).
4 changes: 2 additions & 2 deletions kernel/names.mli
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ sig
(** Special case of [make] where the user name is canonical. *)

val make2 : ModPath.t -> Label.t -> t
(** Shortcut for [(make1 (KerName.make2 ...))] *)
(** Shortcut for [(make1 (KerName.make ...))] *)

(** Projections *)

Expand Down Expand Up @@ -453,7 +453,7 @@ sig
(** Special case of [make] where the user name is canonical. *)

val make2 : ModPath.t -> Label.t -> t
(** Shortcut for [(make1 (KerName.make2 ...))] *)
(** Shortcut for [(make1 (KerName.make ...))] *)

(** Projections *)

Expand Down
3 changes: 1 addition & 2 deletions tactics/cbn.ml
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,7 @@ let magically_constant_of_fixbody env sigma reference bd = function
| Name.Anonymous -> bd
| Name.Name id ->
let open UnivProblem in
let cst_mod = KerName.modpath (Constant.user reference) in
let cst = Constant.make2 cst_mod (Label.of_id id) in
let cst = Constant.change_label reference (Label.of_id id) in
if not (Environ.mem_constant cst env) then bd
else
let (cst, u), ctx = UnivGen.fresh_constant_instance env cst in
Expand Down
6 changes: 6 additions & 0 deletions test-suite/bugs/bug_17897.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
From Coq Require Import PArith.
Local Open Scope positive_scope.
Goal Pos.add 3 3 = 1.
cbn [Pos.add Pos.add_carry Pos.succ]. (* There was a problem with canonical names *)
match goal with [ |- 6 = 1 ] => idtac end.
Abort.