File tree Expand file tree Collapse file tree 3 files changed +77
-0
lines changed
Expand file tree Collapse file tree 3 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 11Require Import Coq.Relations.Relation_Definitions.
22Require Import Coq.Classes .RelationClasses.
3+ Require Import Coq.Classes .Morphisms.
34Require Import ExtLib.Core.Type .
45Require Import ExtLib.Core.RelDec.
56Require Import ExtLib.Structures.Reducible.
@@ -67,6 +68,37 @@ Section relation.
6768 destruct H0; auto.
6869 inversion H1. constructor; auto. subst. eapply H; eassumption.
6970 Qed .
71+
72+ Global Instance Injective_Roption_None
73+ : Injective (Roption None None) :=
74+ { result := True }.
75+ auto.
76+ Defined .
77+
78+ Global Instance Injective_Roption_None_Some a
79+ : Injective (Roption None (Some a)) :=
80+ { result := False }.
81+ inversion 1.
82+ Defined .
83+
84+ Global Instance Injective_Roption_Some_None a
85+ : Injective (Roption (Some a) None) :=
86+ { result := False }.
87+ inversion 1.
88+ Defined .
89+
90+ Global Instance Injective_Roption_Some_Some a b
91+ : Injective (Roption (Some a) (Some b)) :=
92+ { result := R a b }.
93+ inversion 1. auto.
94+ Defined .
95+
96+ Global Instance Injective_Proper_Roption_Some x
97+ : Injective (Proper Roption (Some x)) :=
98+ { result := R x x }.
99+ abstract (inversion 1; assumption).
100+ Defined .
101+
70102End relation.
71103
72104Section type.
Original file line number Diff line number Diff line change 1+ Require Import Coq.Relations.Relation_Definitions.
2+ Require Import Coq.Classes .RelationClasses.
13Require Import ExtLib.Core.RelDec.
24Require Import ExtLib.Tactics.Consider.
35Require Import ExtLib.Tactics.Injection.
46
57Set Implicit Arguments .
68Set Strict Implicit .
79
10+ Section Eqpair.
11+ Context {T U} (rT : relation T) (rU : relation U).
12+
13+ Inductive Eqpair : relation (T * U) :=
14+ | Eqpair_both : forall a b c d, rT a b -> rU c d -> Eqpair (a,c) (b,d).
15+
16+ Global Instance Reflexive_Eqpair {RrT : Reflexive rT} {RrU : Reflexive rU}
17+ : Reflexive Eqpair.
18+ Proof . red. destruct x. constructor; reflexivity. Qed .
19+
20+ Global Instance Symmetric_Eqpair {RrT : Symmetric rT} {RrU : Symmetric rU}
21+ : Symmetric Eqpair.
22+ Proof . red. inversion 1; constructor; symmetry; assumption. Qed .
23+
24+ Global Instance Transitive_Eqpair {RrT : Transitive rT} {RrU : Transitive rU}
25+ : Transitive Eqpair.
26+ Proof . red. inversion 1; inversion 1; constructor; etransitivity; eauto. Qed .
27+
28+ Global Instance Injective_Eqpair a b c d : Injective (Eqpair (a,b) (c,d)) :=
29+ { result := rT a c /\ rU b d }.
30+ abstract (inversion 1; auto).
31+ Defined .
32+ End Eqpair.
33+
834Section PairWF.
935 Variables T U : Type.
1036 Variable RT : T -> T -> Prop.
Original file line number Diff line number Diff line change @@ -47,6 +47,25 @@ Proof. intuition. Qed.
4747Lemma Or_True_iff : forall P, (P \/ True) <-> True.
4848Proof . intuition. Qed .
4949
50+ Lemma Impl_iff
51+ : forall P Q R S : Prop,
52+ (P <-> R) ->
53+ (P -> (Q <-> S)) ->
54+ ((P -> Q) <-> (R -> S)).
55+ Proof . clear. intuition. Qed .
56+
57+ Lemma And_iff
58+ : forall P Q R S : Prop,
59+ (P <-> R) ->
60+ (P -> (Q <-> S)) ->
61+ ((P /\ Q) <-> (R /\ S)).
62+ Proof . clear; intuition. Qed .
63+
64+ Lemma Impl_True_iff : forall (P : Prop), (True -> P) <-> P.
65+ Proof .
66+ clear; intros; tauto.
67+ Qed .
68+
5069(** Forall * *)
5170Lemma forall_iff : forall T P Q,
5271 (forall x,
You can’t perform that action at this time.
0 commit comments