forked from coq/coq
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ltac2: use preterm in exact / eexact
Fix coq#12827 The implementation uses a generalization of Constr.pretype which takes flags (an opaque type) and a typing constraint. Changing `refine` is left to the future as the notation takes a tactic thunk at constr type so would be backwards incompatible.
- Loading branch information
1 parent
1433bd3
commit f5e20e0
Showing
10 changed files
with
97 additions
and
27 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
doc/changelog/06-Ltac2-language/18157-ltac2-exact-preterm.rst
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 @@ | ||
- **Changed:** | ||
Ltac2 `exact` and `eexact` elaborate their argument using the type of the goal as expected type, | ||
instead of elaborating with no expected type then unifying the resulting type with the goal | ||
(`#18157 <https://github.com/coq/coq/pull/18157>`_, | ||
fixes `#12827 <https://github.com/coq/coq/issues/12827>`_, | ||
by Gaëtan Gilbert). |
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
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,17 @@ | ||
Existing Class True. | ||
Existing Instance I. | ||
|
||
(* ltac1 exact works *) | ||
Goal True. | ||
exact _. | ||
Qed. | ||
|
||
Require Import Ltac2.Ltac2. | ||
Require Import Ltac2.Notations. | ||
|
||
Goal True. | ||
exact _. | ||
(* was: Error: Cannot infer this placeholder of type "True" (no type class instance | ||
found). | ||
*) | ||
Qed. |
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 |
---|---|---|
@@ -1,15 +1,20 @@ | ||
Require Import Ltac2.Ltac2. | ||
|
||
(* exact0 at the time of the bug, with eexact part removed for simplicity *) | ||
Ltac2 exact0 c := | ||
Control.enter (fun _ => | ||
Control.with_holes c (fun c => Control.refine (fun _ => c))). | ||
|
||
Ltac2 Eval | ||
let x := constr:(0) in | ||
Constr.pretype preterm:($x). | ||
(* (* uncaught Not_found *) *) | ||
|
||
Ltac2 Eval | ||
let x := constr:(0) in | ||
Constr.pretype preterm:(ltac2:(let y () := x in exact0 false y)). | ||
Constr.pretype preterm:(ltac2:(let y () := x in exact0 y)). | ||
(* (* anomaly unbound variable x *) *) | ||
|
||
Notation "[ x ]" := ltac2:(exact0 false (fun () => Constr.pretype x)). | ||
Notation "[ x ]" := ltac2:(exact0 (fun () => Constr.pretype x)). | ||
|
||
Check ltac2:(let y := constr:(0) in exact0 false (fun () => open_constr:([ $y ]))). | ||
Check ltac2:(let y := constr:(0) in exact0 (fun () => open_constr:([ $y ]))). |
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
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