-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a vm_compute hack fromhttps://arxiv.org/pdf/1305.6543.pdf section 5.5: pattern terms over what to keep opaque, then reduce the lambda using vm_compute.
- Loading branch information
1 parent
2bda7f1
commit 60c9043
Showing
4 changed files
with
99 additions
and
46 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
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,32 @@ | ||
(* Code by Jason Gross for COQBUG 4637: vm_compute in _ makes Defined slow *) | ||
|
||
(** First, work around COQBUG 4494, https://coq.inria.fr/bugs/show_bug.cgi?id=4494 (replace is slow and broken under binders *) | ||
Ltac replace_with_at_by x y set_tac tac := | ||
let H := fresh in | ||
let x' := fresh in | ||
set_tac x' x; | ||
assert (H : y = x') by (subst x'; tac); | ||
clearbody x'; induction H. | ||
|
||
Ltac replace_with_at x y set_tac := | ||
let H := fresh in | ||
let x' := fresh in | ||
set_tac x' x; | ||
cut (y = x'); | ||
[ intro H; induction H | ||
| subst x' ]. | ||
|
||
Ltac replace_with_vm_compute c := | ||
let c' := (eval vm_compute in c) in | ||
(* we'd like to just do: *) | ||
(* replace c with c' by (clear; abstract (vm_compute; reflexivity)) *) | ||
(* but [set] is too slow in 8.4, so we write our own version (see COQBUG https://coq.inria.fr/bugs/show_bug.cgi?id=3280#c13 *) | ||
let set_tac := (fun x' x | ||
=> pose x as x'; | ||
change x with x') in | ||
replace_with_at_by c c' set_tac ltac:(clear; vm_cast_no_check (eq_refl c')). | ||
|
||
Ltac replace_with_vm_compute_in c H := | ||
let c' := (eval vm_compute in c) in | ||
(* By constrast [set ... in ...] seems faster than [change .. with ... in ...] in 8.4?! *) | ||
replace_with_at_by c c' ltac:(fun x' x => set (x' := x) in H ) ltac:(clear; vm_cast_no_check (eq_refl c')). |