| 1 |
Require Import Setoid CMorphisms. |
| 2 |
|
| 3 |
Parameter A : Type. |
| 4 |
Parameter R : A -> A -> Type. |
| 5 |
|
| 6 |
Definition B := Type. |
| 7 |
|
| 8 |
Definition Ri := fun x y => x -> y. |
| 9 |
Definition Ra := arrow. |
| 10 |
Definition Rb := Basics.arrow. |
| 11 |
Definition RBi : B -> B -> Type := fun x y => x -> y. |
| 12 |
Definition RBa : B -> B -> Type := arrow. |
| 13 |
Definition RBb : B -> B -> Type := Basics.arrow. |
| 14 |
Definition RTi : Type -> Type -> Type := fun x y => x -> y. |
| 15 |
Definition RTa : Type -> Type -> Type := arrow. |
| 16 |
Definition RTb : Type -> Type -> Type := Basics.arrow. |
| 17 |
Definition RRBi : crelation B := fun x y => x -> y. |
| 18 |
Definition RRBa : crelation B := arrow. |
| 19 |
Definition RRBb : crelation B := Basics.arrow. |
| 20 |
Definition RRTi : crelation Type := fun x y => x -> y. |
| 21 |
Definition RRTa : crelation Type := arrow. |
| 22 |
Definition RRTb : crelation Type := Basics.arrow. |
| 23 |
|
| 24 |
Parameter f: A -> B. |
| 25 |
#[local] Instance f_Ri: Proper (R ==> Ri) f. Admitted. |
| 26 |
#[local] Instance f_Ra: Proper (R ==> Ra) f. Admitted. |
| 27 |
#[local] Instance f_Rb: Proper (R ==> Rb) f. Admitted. |
| 28 |
#[local] Instance f_RBi: Proper (R ==> RBi) f. Admitted. |
| 29 |
#[local] Instance f_RBa: Proper (R ==> RBa) f. Admitted. |
| 30 |
#[local] Instance f_RBb: Proper (R ==> RBb) f. Admitted. |
| 31 |
#[local] Instance f_RTi: Proper (R ==> RTi) f. Admitted. |
| 32 |
#[local] Instance f_RTa: Proper (R ==> RTa) f. Admitted. |
| 33 |
#[local] Instance f_RTb: Proper (R ==> RTb) f. Admitted. |
| 34 |
#[local] Instance f_RRBi: Proper (R ==> RRBi) f. Admitted. |
| 35 |
#[local] Instance f_RRBa: Proper (R ==> RRBa) f. Admitted. |
| 36 |
#[local] Instance f_RRBb: Proper (R ==> RRBb) f. Admitted. |
| 37 |
#[local] Instance f_RRTi: Proper (R ==> RRTi) f. Admitted. |
| 38 |
#[local] Instance f_RRTa: Proper (R ==> RRTa) f. Admitted. |
| 39 |
#[local] Instance f_RRTb: Proper (R ==> RRTb) f. Admitted. |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
Ltac asserts b t := |
| 44 |
match b with |
| 45 |
| true => assert_succeeds t |
| 46 |
| false => assert_fails t |
| 47 |
end. |
| 48 |
|
| 49 |
Ltac test S b1 b2 b3 b4 := |
| 50 |
let Ht := fresh in |
| 51 |
assert (forall a b, R a b -> S (f a) (f b)) as Ht; |
| 52 |
[ intros a b HR; |
| 53 |
asserts b1 ltac:(rewrite HR); |
| 54 |
asserts b2 ltac:(rewrite <- HR); |
| 55 |
unfold S; |
| 56 |
asserts b3 ltac:(rewrite HR); |
| 57 |
asserts b4 ltac:(rewrite <- HR); |
| 58 |
unfold arrow, Basics.arrow; now rewrite <- HR | clear Ht ]. |
| 59 |
|
| 60 |
Goal True. |
| 61 |
Proof. |
| 62 |
test Ra true true true true. |
| 63 |
test Rb false false false false. |
| 64 |
test RBa true true true true. |
| 65 |
test RBb false false false false. |
| 66 |
test RTa true true true true. |
| 67 |
test RTb false false false false. |
| 68 |
test RRBa true true true true. |
| 69 |
test RRBb false false false false. |
| 70 |
test RRTa true true true true. |
| 71 |
test RRTb false false false false. |
| 72 |
apply I. |
| 73 |
Qed. |