aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jason Gross <jagro@google.com>2018-08-29 17:30:38 -0400
committerGravatar Jason Gross <jagro@google.com>2018-08-29 17:30:38 -0400
commit8810ec44a7f538b65624a31ed7fe53d0a1569e79 (patch)
treec56db27099887d55afdfdf04c356316102f2b852 /src
parentfd02de94fdbd176dc6b7f731e357c0d0d96014a6 (diff)
Add src/Util/PER.v
Diffstat (limited to 'src')
-rw-r--r--src/Util/PER.v8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Util/PER.v b/src/Util/PER.v
new file mode 100644
index 000000000..ab09652f7
--- /dev/null
+++ b/src/Util/PER.v
@@ -0,0 +1,8 @@
+Require Import Coq.Classes.RelationClasses Coq.Classes.Morphisms Coq.Relations.Relation_Definitions.
+
+Lemma PER_valid_l {A} {R : relation A} {HS : Symmetric R} {HT : Transitive R} x y (H : R x y) : Proper R x.
+Proof. hnf; etransitivity; eassumption || symmetry; eassumption. Qed.
+Lemma PER_valid_r {A} {R : relation A} {HS : Symmetric R} {HT : Transitive R} x y (H : R x y) : Proper R y.
+Proof. hnf; etransitivity; eassumption || symmetry; eassumption. Qed.
+Hint Extern 10 (Proper ?R ?x) => simple eapply (@PER_valid_l _ R); [ | | solve [ auto with nocore ] ] : typeclass_instances.
+Hint Extern 10 (Proper ?R ?x) => simple eapply (@PER_valid_r _ R); [ | | solve [ auto with nocore ] ] : typeclass_instances.