aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories/ZArith/auxiliary.v
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-06-27 14:22:37 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-06-27 14:22:37 +0000
commitaabccf49938d5727cc1c7a53882ce1f5108bbed5 (patch)
tree091945168595d81915b695e68a690352b22a6b22 /theories/ZArith/auxiliary.v
parentdd866fe3894d3d7542b45fb881aa2280378b2ae4 (diff)
Some more cleanups (Zeven, auxiliary, Zbool, Zmisc, ZArith_base)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14241 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'theories/ZArith/auxiliary.v')
-rw-r--r--theories/ZArith/auxiliary.v83
1 files changed, 33 insertions, 50 deletions
diff --git a/theories/ZArith/auxiliary.v b/theories/ZArith/auxiliary.v
index 95d378785..742f4bde3 100644
--- a/theories/ZArith/auxiliary.v
+++ b/theories/ZArith/auxiliary.v
@@ -16,96 +16,79 @@ Require Import Decidable.
Require Import Peano_dec.
Require Export Compare_dec.
-Open Local Scope Z_scope.
+Local Open Scope Z_scope.
(***************************************************************)
(** * Moving terms from one side to the other of an inequality *)
-Theorem Zne_left : forall n m:Z, Zne n m -> Zne (n + - m) 0.
+Theorem Zne_left n m : Zne n m -> Zne (n + - m) 0.
Proof.
- intros x y; unfold Zne in |- *; unfold not in |- *; intros H1 H2; apply H1;
- apply Zplus_reg_l with (- y); rewrite Zplus_opp_l;
- rewrite Zplus_comm; trivial with arith.
+ unfold Zne. now rewrite <- Z.sub_move_0_r.
Qed.
-Theorem Zegal_left : forall n m:Z, n = m -> n + - m = 0.
+Theorem Zegal_left n m : n = m -> n + - m = 0.
Proof.
- intros x y H; apply (Zplus_reg_l y); rewrite Zplus_permute;
- rewrite Zplus_opp_r; do 2 rewrite Zplus_0_r; assumption.
+ apply Z.sub_move_0_r.
Qed.
-Theorem Zle_left : forall n m:Z, n <= m -> 0 <= m + - n.
+Theorem Zle_left n m : n <= m -> 0 <= m + - n.
Proof.
- intros x y H; replace 0 with (x + - x).
- apply Zplus_le_compat_r; trivial.
- apply Zplus_opp_r.
+ apply Z.le_0_sub.
Qed.
-Theorem Zle_left_rev : forall n m:Z, 0 <= m + - n -> n <= m.
+Theorem Zle_left_rev n m : 0 <= m + - n -> n <= m.
Proof.
- intros x y H; apply Zplus_le_reg_r with (- x).
- rewrite Zplus_opp_r; trivial.
+ apply Z.le_0_sub.
Qed.
-Theorem Zlt_left_rev : forall n m:Z, 0 < m + - n -> n < m.
+Theorem Zlt_left_rev n m : 0 < m + - n -> n < m.
Proof.
- intros x y H; apply Zplus_lt_reg_r with (- x).
- rewrite Zplus_opp_r; trivial.
+ apply Z.lt_0_sub.
Qed.
-Theorem Zlt_left : forall n m:Z, n < m -> 0 <= m + -1 + - n.
+Theorem Zlt_left_lt n m : n < m -> 0 < m + - n.
Proof.
- intros x y H; apply Zle_left; apply Zsucc_le_reg;
- change (Zsucc x <= Zsucc (Zpred y)) in |- *; rewrite <- Zsucc_pred;
- apply Zlt_le_succ; assumption.
+ apply Z.lt_0_sub.
Qed.
-Theorem Zlt_left_lt : forall n m:Z, n < m -> 0 < m + - n.
+Theorem Zlt_left n m : n < m -> 0 <= m + -1 + - n.
Proof.
- intros x y H; replace 0 with (x + - x).
- apply Zplus_lt_compat_r; trivial.
- apply Zplus_opp_r.
+ intros. rewrite Z.add_shuffle0. change (-1) with (- Z.succ 0).
+ now apply Z.le_0_sub, Z.le_succ_l, Z.lt_0_sub.
Qed.
-Theorem Zge_left : forall n m:Z, n >= m -> 0 <= n + - m.
+Theorem Zge_left n m : n >= m -> 0 <= n + - m.
Proof.
- intros x y H; apply Zle_left; apply Zge_le; assumption.
+ Z.swap_greater. apply Z.le_0_sub.
Qed.
-Theorem Zgt_left : forall n m:Z, n > m -> 0 <= n + -1 + - m.
+Theorem Zgt_left n m : n > m -> 0 <= n + -1 + - m.
Proof.
- intros x y H; apply Zlt_left; apply Zgt_lt; assumption.
+ Z.swap_greater. apply Zlt_left.
Qed.
-Theorem Zgt_left_gt : forall n m:Z, n > m -> n + - m > 0.
+Theorem Zgt_left_gt n m : n > m -> n + - m > 0.
Proof.
- intros x y H; replace 0 with (y + - y).
- apply Zplus_gt_compat_r; trivial.
- apply Zplus_opp_r.
+ Z.swap_greater. apply Z.lt_0_sub.
Qed.
-Theorem Zgt_left_rev : forall n m:Z, n + - m > 0 -> n > m.
+Theorem Zgt_left_rev n m : n + - m > 0 -> n > m.
Proof.
- intros x y H; apply Zplus_gt_reg_r with (- y).
- rewrite Zplus_opp_r; trivial.
+ Z.swap_greater. apply Z.lt_0_sub.
Qed.
-Theorem Zle_mult_approx :
- forall n m p:Z, n > 0 -> p > 0 -> 0 <= m -> 0 <= m * n + p.
+Theorem Zle_mult_approx n m p :
+ n > 0 -> p > 0 -> 0 <= m -> 0 <= m * n + p.
Proof.
- intros x y z H1 H2 H3; apply Zle_trans with (m := y * x);
- [ apply Zmult_gt_0_le_0_compat; assumption
- | pattern (y * x) at 1 in |- *; rewrite <- Zplus_0_r;
- apply Zplus_le_compat_l; apply Zlt_le_weak; apply Zgt_lt;
- assumption ].
+ Z.swap_greater. intros. Z.order_pos.
Qed.
-Theorem Zmult_le_approx :
- forall n m p:Z, n > 0 -> n > p -> 0 <= m * n + p -> 0 <= m.
+Theorem Zmult_le_approx n m p :
+ n > 0 -> n > p -> 0 <= m * n + p -> 0 <= m.
Proof.
- intros x y z H1 H2 H3; apply Zlt_succ_le; apply Zmult_gt_0_lt_0_reg_r with x;
- [ assumption
- | apply Zle_lt_trans with (1 := H3); rewrite <- Zmult_succ_l_reverse;
- apply Zplus_lt_compat_l; apply Zgt_lt; assumption ].
+ Z.swap_greater. intros. apply Z.lt_succ_r.
+ apply Z.mul_pos_cancel_r with n; trivial. Z.nzsimpl.
+ apply Z.le_lt_trans with (m*n+p); trivial.
+ now apply Z.add_lt_mono_l.
Qed.