From 8e5cae9a9f8edbedc2fb2451d32dc18af89cfa40 Mon Sep 17 00:00:00 2001
From: letouzey
Date: Tue, 2 Nov 2010 15:10:50 +0000
Subject: NZLog : since spec is complete, no need for morphism axiom log2_wd
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13608 85f007b7-540e-0410-9357-904b9bb8a0f7
---
theories/Numbers/NatInt/NZLog.v | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
(limited to 'theories/Numbers/NatInt')
diff --git a/theories/Numbers/NatInt/NZLog.v b/theories/Numbers/NatInt/NZLog.v
index 34c57aad9d..4c8dcc8f3f 100644
--- a/theories/Numbers/NatInt/NZLog.v
+++ b/theories/Numbers/NatInt/NZLog.v
@@ -18,7 +18,6 @@ End Log2.
Module Type NZLog2Spec (A : NZOrdAxiomsSig')(B : Pow' A)(C : Log2 A).
Import A B C.
- Declare Instance log2_wd : Proper (eq==>eq) log2.
Axiom log2_spec : forall a, 0 2^(log2 a) <= a < 2^(S (log2 a)).
Axiom log2_nonpos : forall a, a<=0 -> log2 a == 0.
End NZLog2Spec.
@@ -74,6 +73,17 @@ Proof.
order.
Qed.
+(** Hence log2 is a morphism. *)
+
+Instance log2_wd : Proper (eq==>eq) log2.
+Proof.
+ intros x x' Hx.
+ destruct (le_gt_cases x 0).
+ rewrite 2 log2_nonpos; trivial. reflexivity. now rewrite <- Hx.
+ apply log2_unique. apply log2_nonneg.
+ rewrite Hx in *. now apply log2_spec.
+Qed.
+
(** An alternate specification *)
Lemma log2_spec_alt : forall a, 0 exists r,
--
cgit v1.2.3