Skip to content

Commit c32e340

Browse files
author
Gregory Malecha
committed
more definitions!
1 parent b5e3433 commit c32e340

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

theories/Data/Option.v

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Require Import Coq.Relations.Relation_Definitions.
22
Require Import Coq.Classes.RelationClasses.
3+
Require Import Coq.Classes.Morphisms.
34
Require Import ExtLib.Core.Type.
45
Require Import ExtLib.Core.RelDec.
56
Require 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+
70102
End relation.
71103

72104
Section type.

theories/Data/Pair.v

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
1+
Require Import Coq.Relations.Relation_Definitions.
2+
Require Import Coq.Classes.RelationClasses.
13
Require Import ExtLib.Core.RelDec.
24
Require Import ExtLib.Tactics.Consider.
35
Require Import ExtLib.Tactics.Injection.
46

57
Set Implicit Arguments.
68
Set 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+
834
Section PairWF.
935
Variables T U : Type.
1036
Variable RT : T -> T -> Prop.

theories/Data/Prop.v

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,25 @@ Proof. intuition. Qed.
4747
Lemma Or_True_iff : forall P, (P \/ True) <-> True.
4848
Proof. 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 **)
5170
Lemma forall_iff : forall T P Q,
5271
(forall x,

0 commit comments

Comments
 (0)