Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge PR #17788: Correctly handle opaque primitive projections in Eva…
…rconv Reviewed-by: SkySkimmer Ack-by: ppedrot Co-authored-by: SkySkimmer <SkySkimmer@users.noreply.github.com>
- Loading branch information
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- **Fixed:** | ||
ensure that opaque primitive projections are correctly handled by "Evarconv" | ||
unification | ||
(`#17788 <https://github.com/coq/coq/pull/17788>`_, | ||
fixes `#17774 <https://github.com/coq/coq/issues/17774>`_, | ||
by Rodolphe Lepigre). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Require Import Ltac2.Ltac2. | ||
|
||
#[projections(primitive)] | ||
Record r (n : nat) := { w : Prop -> Prop -> Prop }. | ||
|
||
Class C (P : Prop) := {}. | ||
|
||
Import Printf. | ||
Set Printing Primitive Projection Parameters. | ||
|
||
Goal forall (v : r 0) (Q P : Prop), C (v.(w _) P Q). | ||
Proof. | ||
intros. | ||
|
||
(* Succeeds before and after #17788. *) | ||
Succeed lazy_match! goal with | ||
| [ |- ?g ] => | ||
let t := open_constr:(C (v.(w _) _ _)) in | ||
Unification.unify (TransparentState.current ()) g t | ||
end. | ||
|
||
#[local] Opaque w. | ||
|
||
(* Succeeds only after #17788. *) | ||
Succeed lazy_match! goal with | ||
| [ |- ?g ] => | ||
let t := open_constr:(C (v.(w _) _ _)) in | ||
Unification.unify (TransparentState.current ()) g t | ||
end. | ||
|
||
(* Succeeds only after #17788. *) | ||
Succeed lazy_match! goal with | ||
| [ |- ?g ] => | ||
let t := open_constr:(w _) in | ||
let t := open_constr:(C ($t v _ _)) in | ||
(*printf "Term: %t" t;*) | ||
Unification.unify (TransparentState.current ()) g t | ||
end. | ||
|
||
(* Succeeds only after #17788. *) | ||
Succeed lazy_match! goal with | ||
| [ |- ?g ] => | ||
let t := open_constr:(w _) in | ||
let t := open_constr:(C ($t v _ _)) in | ||
(*printf "Term: %t" t;*) | ||
Unification.unify (TransparentState.current ()) g t | ||
end. | ||
Abort. |