Debian Codegraph @

src/Util/Sorting/Sorted/Proper.v

raw
1 From Coq Require Import List.
2 From Coq Require Import SetoidList.
3 From Coq Require Import SetoidPermutation.
4 From Coq Require Import Morphisms.
5 From Coq Require Import Sorted.
6 Require Import Crypto.Util.Tactics.SplitInContext.
7
8 Local Set Implicit Arguments.
9
10 Local Ltac t' :=
11 repeat first [ progress cbv [Proper respectful impl flip] in *
12 | progress intros
13 | progress invlist HdRel
14 | progress invlist Sorted
15 | progress invlist StronglySorted
16 | progress split_iff
17 | solve [ eauto ] ].
18 Local Ltac t :=
19 first [ induction 1; progress repeat constructor; t'
20 | intro; t ].
21
22 Global Instance HdRel_Proper_impl A R
23 : Proper ((R ==> R ==> impl) ==> R ==> eqlistA R ==> impl) (@HdRel A).
24 Proof. t. Qed.
25 Global Instance HdRel_Proper_flip_impl A R
26 : Proper ((R ==> R ==> flip impl) ==> R ==> eqlistA R ==> flip impl) (@HdRel A).
27 Proof. t. Qed.
28 Global Instance HdRel_Proper_iff A R
29 : Proper ((R ==> R ==> iff) ==> R ==> eqlistA R ==> iff) (@HdRel A).
30 Proof. t. Qed.
31 Global Instance HdRel_Proper_impl_sym A R {_: Symmetric R}
32 : Proper ((R ==> R ==> impl) ==> R ==> flip (eqlistA R) ==> impl) (@HdRel A).
33 Proof. t. Qed.
34 Global Instance HdRel_Proper_flip_impl_sym A R {_: Symmetric R}
35 : Proper ((R ==> R ==> flip impl) ==> R ==> flip (eqlistA R) ==> flip impl) (@HdRel A).
36 Proof. t. Qed.
37 Global Instance HdRel_Proper_iff_sym A R {_: Symmetric R}
38 : Proper ((R ==> R ==> iff) ==> R ==> flip (eqlistA R) ==> iff) (@HdRel A).
39 Proof. t. Qed.
40 Global Instance Sorted_Proper_impl A R
41 : Proper ((R ==> R ==> impl) ==> eqlistA R ==> impl) (@Sorted A).
42 Proof. t. eapply HdRel_Proper_impl; eassumption. Qed.
43 Global Instance Sorted_Proper_flip_impl A R
44 : Proper ((R ==> R ==> flip impl) ==> eqlistA R ==> flip impl) (@Sorted A).
45 Proof. t. eapply HdRel_Proper_flip_impl; eassumption. Qed.
46 Global Instance Sorted_Proper_iff A R
47 : Proper ((R ==> R ==> iff) ==> eqlistA R ==> iff) (@Sorted A).
48 Proof.
49 repeat intro; split; [ eapply Sorted_Proper_impl | eapply Sorted_Proper_flip_impl ]; try eassumption; t'.
50 Qed.
51 Global Instance Sorted_Proper_impl_sym A R {_: Symmetric R}
52 : Proper ((R ==> R ==> impl) ==> flip (eqlistA R) ==> impl) (@Sorted A).
53 Proof. t. eapply HdRel_Proper_impl_sym; (idtac + symmetry); eassumption. Qed.
54 Global Instance Sorted_Proper_flip_impl_sym A R {_: Symmetric R}
55 : Proper ((R ==> R ==> flip impl) ==> flip (eqlistA R) ==> flip impl) (@Sorted A).
56 Proof. t. eapply HdRel_Proper_flip_impl_sym; (idtac + symmetry); eassumption. Qed.
57 Global Instance Sorted_Proper_iff_sym A R {_: Symmetric R}
58 : Proper ((R ==> R ==> iff) ==> flip (eqlistA R) ==> iff) (@Sorted A).
59 Proof.
60 repeat intro; split; [ eapply Sorted_Proper_impl_sym | eapply Sorted_Proper_flip_impl_sym ]; try eassumption; t'.
61 Qed.