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

« back to all changes in this revision

Viewing changes to theories/Numbers/Rational/SpecViaQ/QSig.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: QSig.v 11207 2008-07-04 16:50:32Z letouzey $ i*)
 
10
 
 
11
Require Import QArith Qpower.
 
12
 
 
13
Open Scope Q_scope.
 
14
 
 
15
(** * QSig *)
 
16
 
 
17
(** Interface of a rich structure about rational numbers.
 
18
    Specifications are written via translation to Q.
 
19
*)
 
20
 
 
21
Module Type QType.
 
22
 
 
23
 Parameter t : Type.
 
24
 
 
25
 Parameter to_Q : t -> Q.
 
26
 Notation "[ x ]" := (to_Q x).
 
27
 
 
28
 Definition eq x y := [x] == [y].
 
29
 
 
30
 Parameter of_Q : Q -> t.
 
31
 Parameter spec_of_Q: forall x, to_Q (of_Q x) == x.
 
32
 
 
33
 Parameter zero : t.
 
34
 Parameter one : t.
 
35
 Parameter minus_one : t.
 
36
 
 
37
 Parameter spec_0: [zero] == 0.
 
38
 Parameter spec_1: [one] == 1.
 
39
 Parameter spec_m1: [minus_one] == -(1).
 
40
 
 
41
 Parameter compare : t -> t -> comparison.
 
42
 
 
43
 Parameter spec_compare : forall x y, compare x y = ([x] ?= [y]).
 
44
 
 
45
 Definition lt n m := compare n m = Lt.
 
46
 Definition le n m := compare n m <> Gt.
 
47
 Definition min n m := match compare n m with Gt => m | _ => n end.
 
48
 Definition max n m := match compare n m with Lt => m | _ => n end.
 
49
 
 
50
 Parameter eq_bool : t -> t -> bool.
 
51
 
 
52
 Parameter spec_eq_bool : forall x y, 
 
53
  if eq_bool x y then [x]==[y] else ~([x]==[y]).
 
54
 
 
55
 Parameter red : t -> t.
 
56
 
 
57
 Parameter spec_red : forall x, [red x] == [x].
 
58
 Parameter strong_spec_red : forall x, [red x] = Qred [x].
 
59
 
 
60
 Parameter add : t -> t -> t.
 
61
 
 
62
 Parameter spec_add: forall x y, [add x y] == [x] + [y].
 
63
 
 
64
 Parameter sub : t -> t -> t.
 
65
 
 
66
 Parameter spec_sub: forall x y, [sub x y] == [x] - [y].
 
67
 
 
68
 Parameter opp : t -> t.
 
69
 
 
70
 Parameter spec_opp: forall x, [opp x] == - [x].
 
71
 
 
72
 Parameter mul : t -> t -> t.
 
73
 
 
74
 Parameter spec_mul: forall x y, [mul x y] == [x] * [y].
 
75
 
 
76
 Parameter square : t -> t.
 
77
 
 
78
 Parameter spec_square: forall x, [square x] == [x] ^ 2.
 
79
 
 
80
 Parameter inv : t -> t.
 
81
 
 
82
 Parameter spec_inv : forall x, [inv x] == / [x].
 
83
 
 
84
 Parameter div : t -> t -> t.
 
85
 
 
86
 Parameter spec_div: forall x y, [div x y] == [x] / [y].
 
87
 
 
88
 Parameter power : t -> Z -> t.
 
89
 
 
90
 Parameter spec_power: forall x z, [power x z] == [x] ^ z.
 
91
 
 
92
End QType.
 
93
 
 
94
(** NB: several of the above functions come with [..._norm] variants
 
95
     that expect reduced arguments and return reduced results. *)
 
96
 
 
97
(** TODO : also speak of specifications via Qcanon ... *)