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

« back to all changes in this revision

Viewing changes to theories/Numbers/Integer/BigZ/BigZ.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
(*            Benjamin Gregoire, Laurent Thery, INRIA, 2007             *)
 
9
(************************************************************************)
 
10
 
 
11
(*i $Id: BigZ.v 11576 2008-11-10 19:13:15Z msozeau $ i*)
 
12
 
 
13
Require Export BigN.
 
14
Require Import ZMulOrder.
 
15
Require Import ZSig.
 
16
Require Import ZSigZAxioms.
 
17
Require Import ZMake.
 
18
 
 
19
Module BigZ <: ZType := ZMake.Make BigN.
 
20
 
 
21
(** Module [BigZ] implements [ZAxiomsSig] *)
 
22
 
 
23
Module Export BigZAxiomsMod := ZSig_ZAxioms BigZ.
 
24
Module Export BigZMulOrderPropMod := ZMulOrderPropFunct BigZAxiomsMod.
 
25
 
 
26
(** Notations about [BigZ] *)
 
27
 
 
28
Notation bigZ := BigZ.t.
 
29
 
 
30
Delimit Scope bigZ_scope with bigZ.
 
31
Bind Scope bigZ_scope with bigZ.
 
32
Bind Scope bigZ_scope with BigZ.t.
 
33
Bind Scope bigZ_scope with BigZ.t_.
 
34
 
 
35
Notation Local "0" := BigZ.zero : bigZ_scope.
 
36
Infix "+" := BigZ.add : bigZ_scope.
 
37
Infix "-" := BigZ.sub : bigZ_scope.
 
38
Notation "- x" := (BigZ.opp x) : bigZ_scope.
 
39
Infix "*" := BigZ.mul : bigZ_scope.
 
40
Infix "/" := BigZ.div : bigZ_scope.
 
41
Infix "?=" := BigZ.compare : bigZ_scope.
 
42
Infix "==" := BigZ.eq (at level 70, no associativity) : bigZ_scope.
 
43
Infix "<" := BigZ.lt : bigZ_scope.
 
44
Infix "<=" := BigZ.le : bigZ_scope.
 
45
Notation "x > y" := (BigZ.lt y x)(only parsing) : bigZ_scope.
 
46
Notation "x >= y" := (BigZ.le y x)(only parsing) : bigZ_scope.
 
47
Notation "[ i ]" := (BigZ.to_Z i) : bigZ_scope.
 
48
 
 
49
Open Scope bigZ_scope.
 
50
 
 
51
(** Some additional results about [BigZ] *)
 
52
 
 
53
Theorem spec_to_Z: forall n:bigZ,
 
54
  BigN.to_Z (BigZ.to_N n) = ((Zsgn [n]) * [n])%Z.
 
55
Proof.
 
56
intros n; case n; simpl; intros p;
 
57
  generalize (BigN.spec_pos p); case (BigN.to_Z p); auto.
 
58
intros p1 H1; case H1; auto.
 
59
intros p1 H1; case H1; auto.
 
60
Qed.
 
61
 
 
62
Theorem spec_to_N n:
 
63
 ([n] = Zsgn [n] * (BigN.to_Z (BigZ.to_N n)))%Z.
 
64
Proof.
 
65
intros n; case n; simpl; intros p;
 
66
  generalize (BigN.spec_pos p); case (BigN.to_Z p); auto.
 
67
intros p1 H1; case H1; auto.
 
68
intros p1 H1; case H1; auto.
 
69
Qed.
 
70
 
 
71
Theorem spec_to_Z_pos: forall n, (0 <= [n])%Z ->
 
72
  BigN.to_Z (BigZ.to_N n) = [n].
 
73
Proof.
 
74
intros n; case n; simpl; intros p;
 
75
  generalize (BigN.spec_pos p); case (BigN.to_Z p); auto.
 
76
intros p1 _ H1; case H1; auto.
 
77
intros p1 H1; case H1; auto.
 
78
Qed.
 
79
 
 
80
Lemma sub_opp : forall x y : bigZ, x - y == x + (- y).
 
81
Proof.
 
82
red; intros; zsimpl; auto.
 
83
Qed.
 
84
 
 
85
Lemma add_opp : forall x : bigZ, x + (- x) == 0.
 
86
Proof.
 
87
red; intros; zsimpl; auto with zarith.
 
88
Qed.
 
89
 
 
90
(** [BigZ] is a ring *)
 
91
 
 
92
Lemma BigZring :
 
93
 ring_theory BigZ.zero BigZ.one BigZ.add BigZ.mul BigZ.sub BigZ.opp BigZ.eq.
 
94
Proof.
 
95
constructor.
 
96
exact Zadd_0_l.
 
97
exact Zadd_comm.
 
98
exact Zadd_assoc.
 
99
exact Zmul_1_l.
 
100
exact Zmul_comm.
 
101
exact Zmul_assoc.
 
102
exact Zmul_add_distr_r.
 
103
exact sub_opp.
 
104
exact add_opp.
 
105
Qed.
 
106
 
 
107
Add Ring BigZr : BigZring.
 
108
 
 
109
(** Todo: tactic translating from [BigZ] to [Z] + omega *)
 
110
 
 
111
(** Todo: micromega *)