aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Coqlib.v
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2007-03-02 09:15:46 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2007-03-02 09:15:46 +0000
commit9b11be0dc297779d899a7ca586513ee64236be0c (patch)
treeb45f507278cd1d00947ffe4ef7b1929cd3f27128 /lib/Coqlib.v
parentbec3724294f7d83d8c96a1e9c97df3dcdb2a0e1b (diff)
downloadcompcert-kvx-9b11be0dc297779d899a7ca586513ee64236be0c.tar.gz
compcert-kvx-9b11be0dc297779d899a7ca586513ee64236be0c.zip
Ajout lemmes utiles sur egalite decidable
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@178 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'lib/Coqlib.v')
-rw-r--r--lib/Coqlib.v31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/Coqlib.v b/lib/Coqlib.v
index 0fc8613c..184fe28f 100644
--- a/lib/Coqlib.v
+++ b/lib/Coqlib.v
@@ -846,3 +846,34 @@ Proof.
intros P Q a. destruct a; simpl. auto. congruence.
Qed.
+Section DECIDABLE_EQUALITY.
+
+Variable A: Set.
+Variable dec_eq: forall (x y: A), {x=y} + {x<>y}.
+Variable B: Set.
+
+Lemma dec_eq_true:
+ forall (x: A) (ifso ifnot: B),
+ (if dec_eq x x then ifso else ifnot) = ifso.
+Proof.
+ intros. destruct (dec_eq x x). auto. congruence.
+Qed.
+
+Lemma dec_eq_false:
+ forall (x y: A) (ifso ifnot: B),
+ x <> y -> (if dec_eq x y then ifso else ifnot) = ifnot.
+Proof.
+ intros. destruct (dec_eq x y). congruence. auto.
+Qed.
+
+Lemma dec_eq_sym:
+ forall (x y: A) (ifso ifnot: B),
+ (if dec_eq x y then ifso else ifnot) =
+ (if dec_eq y x then ifso else ifnot).
+Proof.
+ intros. destruct (dec_eq x y).
+ subst y. rewrite dec_eq_true. auto.
+ rewrite dec_eq_false; auto.
+Qed.
+
+End DECIDABLE_EQUALITY.