Debian Codegraph @

test-suite/success/rewrite_strat.v

raw
1 Require Import Setoid.
2
3 Parameter X : Set.
4
5 Parameter f : X -> X.
6 Parameter g : X -> X -> X.
7 Parameter h : nat -> X -> X.
8
9 Parameter lem0 : forall x, f (f x) = f x.
10 Parameter lem1 : forall x, g x x = f x.
11 Parameter lem2 : forall n x, h (S n) x = g (h n x) (h n x).
12 Parameter lem3 : forall x, h 0 x = x.
13
14 #[export] Hint Rewrite lem0 lem1 lem2 lem3 : rew.
15
16 Goal forall x, h 10 x = f x.
17 Proof.
18 intros.
19 Time autorewrite with rew. (* 0.586 *)
20 reflexivity.
21 Time Qed. (* 0.53 *)
22
23 Goal forall x, h 6 x = f x.
24 intros.
25 Time rewrite_strat topdown lem2.
26 Time rewrite_strat topdown lem1.
27 Time rewrite_strat topdown lem0.
28 Time rewrite_strat topdown lem3.
29 reflexivity.
30 Undo 5.
31 Time rewrite_strat topdown (choice lem2 lem1).
32 Time rewrite_strat topdown (choice lem0 lem3).
33 reflexivity.
34 Undo 3.
35 Time rewrite_strat (topdown (choice lem2 lem1); topdown (choice lem0 lem3)).
36 reflexivity.
37 Undo 2.
38 Time rewrite_strat (topdown (choice (choice lem2 lem1) (choice lem0 lem3))).
39 reflexivity.
40 Undo 2.
41 Time rewrite_strat (topdown (choice lem2 (choice lem1 (choice lem0 lem3)))).
42 reflexivity.
43 Undo 2.
44 Time rewrite_strat (topdown (choice lem2 lem1 lem0 lem3)).
45 reflexivity.
46 Undo 2.
47 Time rewrite_strat fix f := (choice lem2 lem1 lem0 lem3 (progress subterms f) ; try f).
48 reflexivity.
49 Qed.
50
51 Goal forall x, h 10 x = f x.
52 Proof.
53 intros.
54 Time rewrite_strat topdown (hints rew). (* 0.38 *)
55 reflexivity.
56 Time Qed. (* 0.06 s *)
57
58 Set Printing All.
59 Set Printing Depth 100000.
60
61 Tactic Notation "my_rewrite_strat" constr(x) := rewrite_strat topdown x.
62 Tactic Notation "my_rewrite_strat2" uconstr(x) := rewrite_strat topdown x.
63 Goal (forall x, S x = 0) -> 1=0.
64 intro H.
65 my_rewrite_strat H.
66 Undo.
67 my_rewrite_strat2 H.
68 Abort.