From e86587b3f0590e3cc4aa005bf4577a9f84cc1056 Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Fri, 12 May 2017 23:41:12 -0400 Subject: Split off Proper ZUtil lemmas --- src/Util/ZUtil.v | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) (limited to 'src/Util/ZUtil.v') diff --git a/src/Util/ZUtil.v b/src/Util/ZUtil.v index 54ab65115..7dec68884 100644 --- a/src/Util/ZUtil.v +++ b/src/Util/ZUtil.v @@ -13,6 +13,7 @@ Require Import Coq.Lists.List. Require Export Crypto.Util.FixCoqMistakes. Require Export Crypto.Util.ZUtil.Notations. Require Export Crypto.Util.ZUtil.Definitions. +Require Export Crypto.Util.ZUtil.Morphisms. Import Nat. Local Open Scope Z. @@ -241,46 +242,6 @@ Hint Rewrite Bool.andb_true_r Bool.andb_false_r Bool.orb_true_r Bool.orb_false_r Bool.andb_true_l Bool.andb_false_l Bool.orb_true_l Bool.orb_false_l : Ztestbit. Module Z. - Section proper. - (** We prove a bunch of [Proper] lemmas, but do not make them - instances; making them instances would slow typeclass search - unacceptably. In files where we use these, we add them with - [Local Existing Instances]. *) - Lemma add_le_Proper : Proper (Z.le ==> Z.le ==> Z.le) Z.add. - Proof. repeat (omega || intro). Qed. - Lemma sub_le_ge_Proper : Proper (Z.le ==> Z.ge ==> Z.le) Z.sub. - Proof. repeat (omega || intro). Qed. - Lemma sub_le_flip_le_Proper : Proper (Z.le ==> Basics.flip Z.le ==> Z.le) Z.sub. - Proof. unfold Basics.flip; repeat (omega || intro). Qed. - Lemma sub_le_eq_Proper : Proper (Z.le ==> Logic.eq ==> Z.le) Z.sub. - Proof. repeat (omega || intro). Qed. - Lemma log2_up_le_Proper : Proper (Z.le ==> Z.le) Z.log2_up. - Proof. intros ???; apply Z.log2_up_le_mono; assumption. Qed. - Lemma log2_le_Proper : Proper (Z.le ==> Z.le) Z.log2. - Proof. intros ???; apply Z.log2_le_mono; assumption. Qed. - Lemma pow_Zpos_le_Proper x : Proper (Z.le ==> Z.le) (Z.pow (Z.pos x)). - Proof. intros ???; apply Z.pow_le_mono_r; try reflexivity; try assumption. Qed. - Lemma lt_le_flip_Proper_flip_impl - : Proper (Z.le ==> Basics.flip Z.le ==> Basics.flip Basics.impl) Z.lt. - Proof. unfold Basics.flip; repeat (omega || intro). Qed. - Lemma le_Proper_ge_le_flip_impl : Proper (Z.le ==> Z.ge ==> Basics.flip Basics.impl) Z.le. - Proof. intros ???????; omega. Qed. - Lemma add_le_Proper_flip : Proper (Basics.flip Z.le ==> Basics.flip Z.le ==> Basics.flip Z.le) Z.add. - Proof. unfold Basics.flip; repeat (omega || intro). Qed. - Lemma sub_le_ge_Proper_flip : Proper (Basics.flip Z.le ==> Basics.flip Z.ge ==> Basics.flip Z.le) Z.sub. - Proof. unfold Basics.flip; repeat (omega || intro). Qed. - Lemma sub_flip_le_le_Proper_flip : Proper (Basics.flip Z.le ==> Z.le ==> Basics.flip Z.le) Z.sub. - Proof. unfold Basics.flip; repeat (omega || intro). Qed. - Lemma sub_le_eq_Proper_flip : Proper (Basics.flip Z.le ==> Logic.eq ==> Basics.flip Z.le) Z.sub. - Proof. unfold Basics.flip; repeat (omega || intro). Qed. - Lemma log2_up_le_Proper_flip : Proper (Basics.flip Z.le ==> Basics.flip Z.le) Z.log2_up. - Proof. intros ???; apply Z.log2_up_le_mono; assumption. Qed. - Lemma log2_le_Proper_flip : Proper (Basics.flip Z.le ==> Basics.flip Z.le) Z.log2. - Proof. intros ???; apply Z.log2_le_mono; assumption. Qed. - Lemma pow_Zpos_le_Proper_flip x : Proper (Basics.flip Z.le ==> Basics.flip Z.le) (Z.pow (Z.pos x)). - Proof. intros ???; apply Z.pow_le_mono_r; try reflexivity; try assumption. Qed. - End proper. - Ltac peel_le_step := match goal with | [ |- ?x + _ <= ?x + _ ] -- cgit v1.2.3