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

« back to all changes in this revision

Viewing changes to theories/Numbers/Cyclic/DoubleCyclic/DoubleType.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: DoubleType.v 10964 2008-05-22 11:08:13Z letouzey $ i*)
 
12
 
 
13
Set Implicit Arguments.
 
14
 
 
15
Require Import ZArith.
 
16
Open Local Scope Z_scope.
 
17
 
 
18
Definition base digits := Zpower 2 (Zpos digits).
 
19
 
 
20
Section Carry.
 
21
 
 
22
 Variable A : Type.
 
23
 
 
24
 Inductive carry :=
 
25
  | C0 : A -> carry
 
26
  | C1 : A -> carry.
 
27
 
 
28
 Definition interp_carry (sign:Z)(B:Z)(interp:A -> Z) c :=
 
29
  match c with
 
30
  | C0 x => interp x
 
31
  | C1 x => sign*B + interp x
 
32
  end.
 
33
 
 
34
End Carry.
 
35
 
 
36
Section Zn2Z.
 
37
 
 
38
 Variable znz : Type.
 
39
 
 
40
 (** From a type [znz] representing a cyclic structure Z/nZ, 
 
41
     we produce a representation of Z/2nZ by pairs of elements of [znz]
 
42
     (plus a special case for zero). High half of the new number comes 
 
43
     first. 
 
44
 *)
 
45
 
 
46
 Inductive zn2z :=
 
47
  | W0 : zn2z
 
48
  | WW : znz -> znz -> zn2z.
 
49
 
 
50
 Definition zn2z_to_Z (wB:Z) (w_to_Z:znz->Z) (x:zn2z) :=
 
51
  match x with
 
52
  | W0 => 0
 
53
  | WW xh xl => w_to_Z xh * wB + w_to_Z xl
 
54
  end.
 
55
 
 
56
End Zn2Z.
 
57
 
 
58
Implicit Arguments W0 [znz].
 
59
 
 
60
(** From a cyclic representation [w], we iterate the [zn2z] construct 
 
61
    [n] times, gaining the type of binary trees of depth at most [n], 
 
62
    whose leafs are either W0 (if depth < n) or elements of w 
 
63
    (if depth = n). 
 
64
*)
 
65
 
 
66
Fixpoint word (w:Type) (n:nat) : Type :=
 
67
 match n with
 
68
 | O => w
 
69
 | S n => zn2z (word w n)
 
70
 end.
 
71