| 1 |
Require Corelib.Setoids.Setoid. |
| 2 |
Export Corelib.Classes.Morphisms. |
| 3 |
Export Corelib.Setoids.Setoid. |
| 4 |
|
| 5 |
Axiom A : Type. |
| 6 |
Axiom equiv : relation A. |
| 7 |
Axiom sg_op : A -> A -> A. |
| 8 |
Axiom mon_unit : A. |
| 9 |
Axiom negate : A -> A. |
| 10 |
|
| 11 |
#[export] Declare Instance sg_setoid : Equivalence equiv. |
| 12 |
#[export] Declare Instance sg_op_proper : Proper (equiv ==> equiv ==> equiv) sg_op. |
| 13 |
Axiom right_identity : forall x, equiv (sg_op x mon_unit) x. |
| 14 |
Axiom left_inverse : forall x, equiv (sg_op (negate x) x) mon_unit. |
| 15 |
|
| 16 |
#[global] Hint Rewrite @right_identity @left_inverse using apply _: group_cancellation. |
| 17 |
|
| 18 |
(* Check that the rewrite hints are considered in the right order. *) |
| 19 |
|
| 20 |
Goal equiv mon_unit (sg_op (negate mon_unit) mon_unit). |
| 21 |
Proof. |
| 22 |
rewrite_strat (try bottomup (hints group_cancellation)). (* should select left_inverse rather than right_identity *) |
| 23 |
reflexivity. |
| 24 |
Qed. |