forked from LPCIC/coq-elpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_rewrite.v
37 lines (32 loc) · 1002 Bytes
/
test_rewrite.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From elpi.apps Require Import eltac.rewrite.
Goal (forall x : nat, 1 + x = x + 1) ->
forall y, 2 * ((y+y) + 1) = ((y + y)+1) * 2.
Proof.
intro H.
intro x.
eltac.rewrite H.
eltac.rewrite PeanoNat.Nat.mul_comm.
exact eq_refl.
Defined.
Section Example_rewrite.
Variable A : Type.
Variable B : A -> Type.
Variable C : forall (a : A) (b : B a), Type.
Variable add : forall {a : A} {b : B a}, C a b -> C a b -> C a b.
Variable sym : forall {a : A} {b : B a} (c c' : C a b), add c c' = add c' c.
Goal forall (a : A) (b : B a) (x y : C a b),
add x y = add y x /\ add x y = add y x.
Proof.
intros a b x y.
eltac.rewrite @sym. (* @sym is a gref *)
(** [add y x = add y x /\ add y x = add y x] *)
easy.
Defined.
Goal forall (a : A) (b : B a) (x y : C a b),
add x y = add y x /\ add x y = add y x.
Proof.
intros a b x y.
eltac.rewrite sym. (* because of implicit arguments, this is sym _ _, which is a term *)
easy.
Defined.
End Example_rewrite.