~ubuntu-branches/ubuntu/wily/coq-doc/wily

« back to all changes in this revision

Viewing changes to theories/ZArith/auxiliary.v

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu, Stéphane Glondu, Samuel Mimram
  • Date: 2010-01-07 22:50:39 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100107225039-n3cq82589u0qt0s2
Tags: 8.2pl1-1
[ Stéphane Glondu ]
* New upstream release (Closes: #563669)
  - remove patches
* Packaging overhaul:
  - use git, advertise it in Vcs-* fields of debian/control
  - use debhelper 7 and dh with override
  - use source format 3.0 (quilt)
* debian/control:
  - set Maintainer to d-o-m, set Uploaders to Sam and myself
  - add Homepage field
  - bump Standards-Version to 3.8.3
* Register PDF documentation into doc-base
* Add debian/watch
* Update debian/copyright

[ Samuel Mimram ]
* Change coq-doc's description to mention that it provides documentation in
  pdf format, not postscript, closes: #543545.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(************************************************************************)
 
2
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
 
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
 
4
(*   \VV/  **************************************************************)
 
5
(*    //   *      This file is distributed under the terms of the       *)
 
6
(*         *       GNU Lesser General Public License Version 2.1        *)
 
7
(************************************************************************)
 
8
 
 
9
(*i $Id: auxiliary.v 11739 2009-01-02 19:33:19Z herbelin $ i*)
 
10
 
 
11
(** Binary Integers (Pierre Cr�gut, CNET, Lannion, France) *)
 
12
 
 
13
Require Export Arith_base.
 
14
Require Import BinInt.
 
15
Require Import Zorder.
 
16
Require Import Decidable.
 
17
Require Import Peano_dec.
 
18
Require Export Compare_dec.
 
19
 
 
20
Open Local Scope Z_scope.
 
21
 
 
22
(***************************************************************)
 
23
(** * Moving terms from one side to the other of an inequality *)
 
24
 
 
25
Theorem Zne_left : forall n m:Z, Zne n m -> Zne (n + - m) 0.
 
26
Proof.
 
27
  intros x y; unfold Zne in |- *; unfold not in |- *; intros H1 H2; apply H1;
 
28
    apply Zplus_reg_l with (- y); rewrite Zplus_opp_l; 
 
29
      rewrite Zplus_comm; trivial with arith.
 
30
Qed.
 
31
 
 
32
Theorem Zegal_left : forall n m:Z, n = m -> n + - m = 0.
 
33
Proof.
 
34
  intros x y H; apply (Zplus_reg_l y); rewrite Zplus_permute;
 
35
    rewrite Zplus_opp_r; do 2 rewrite Zplus_0_r; assumption.
 
36
Qed.
 
37
 
 
38
Theorem Zle_left : forall n m:Z, n <= m -> 0 <= m + - n.
 
39
Proof.
 
40
  intros x y H; replace 0 with (x + - x).
 
41
  apply Zplus_le_compat_r; trivial.
 
42
  apply Zplus_opp_r.
 
43
Qed.
 
44
 
 
45
Theorem Zle_left_rev : forall n m:Z, 0 <= m + - n -> n <= m.
 
46
Proof.
 
47
  intros x y H; apply Zplus_le_reg_r with (- x).
 
48
  rewrite Zplus_opp_r; trivial.
 
49
Qed.
 
50
 
 
51
Theorem Zlt_left_rev : forall n m:Z, 0 < m + - n -> n < m.
 
52
Proof.
 
53
  intros x y H; apply Zplus_lt_reg_r with (- x).
 
54
  rewrite Zplus_opp_r; trivial.
 
55
Qed.
 
56
 
 
57
Theorem Zlt_left : forall n m:Z, n < m -> 0 <= m + -1 + - n.
 
58
Proof.
 
59
  intros x y H; apply Zle_left; apply Zsucc_le_reg;
 
60
    change (Zsucc x <= Zsucc (Zpred y)) in |- *; rewrite <- Zsucc_pred;
 
61
      apply Zlt_le_succ; assumption.
 
62
Qed.
 
63
 
 
64
Theorem Zlt_left_lt : forall n m:Z, n < m -> 0 < m + - n.
 
65
Proof.
 
66
  intros x y H; replace 0 with (x + - x).
 
67
  apply Zplus_lt_compat_r; trivial.
 
68
  apply Zplus_opp_r.
 
69
Qed.
 
70
 
 
71
Theorem Zge_left : forall n m:Z, n >= m -> 0 <= n + - m.
 
72
Proof.
 
73
  intros x y H; apply Zle_left; apply Zge_le; assumption.
 
74
Qed.
 
75
 
 
76
Theorem Zgt_left : forall n m:Z, n > m -> 0 <= n + -1 + - m.
 
77
Proof.
 
78
  intros x y H; apply Zlt_left; apply Zgt_lt; assumption.
 
79
Qed.
 
80
 
 
81
Theorem Zgt_left_gt : forall n m:Z, n > m -> n + - m > 0.
 
82
Proof.
 
83
  intros x y H; replace 0 with (y + - y).
 
84
  apply Zplus_gt_compat_r; trivial.
 
85
  apply Zplus_opp_r.
 
86
Qed.
 
87
 
 
88
Theorem Zgt_left_rev : forall n m:Z, n + - m > 0 -> n > m.
 
89
Proof.
 
90
  intros x y H; apply Zplus_gt_reg_r with (- y).
 
91
  rewrite Zplus_opp_r; trivial.
 
92
Qed.
 
93
 
 
94
Theorem Zle_mult_approx :
 
95
  forall n m p:Z, n > 0 -> p > 0 -> 0 <= m -> 0 <= m * n + p.
 
96
Proof.
 
97
  intros x y z H1 H2 H3; apply Zle_trans with (m := y * x);
 
98
    [ apply Zmult_gt_0_le_0_compat; assumption
 
99
      | pattern (y * x) at 1 in |- *; rewrite <- Zplus_0_r;
 
100
        apply Zplus_le_compat_l; apply Zlt_le_weak; apply Zgt_lt; 
 
101
          assumption ].
 
102
Qed.
 
103
 
 
104
Theorem Zmult_le_approx :
 
105
  forall n m p:Z, n > 0 -> n > p -> 0 <= m * n + p -> 0 <= m.
 
106
Proof.
 
107
  intros x y z H1 H2 H3; apply Zlt_succ_le; apply Zmult_gt_0_lt_0_reg_r with x;
 
108
    [ assumption
 
109
      | apply Zle_lt_trans with (1 := H3); rewrite <- Zmult_succ_l_reverse;
 
110
        apply Zplus_lt_compat_l; apply Zgt_lt; assumption ].
 
111
Qed.
 
112