aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories/Numbers/Natural/BigN/BigN.v
blob: db4cd896503d3c15086bf9e2c66e9f43252e1230 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(*i $Id$ i*)

(** * Natural numbers in base 2^31 *)

(**
Author: Arnaud Spiwack
*)

Require Export Int31.
Require Import Z31Z.
Require Import NMake.
Require Import ZnZ.

Open Scope int31_scope.

Module BigN := NMake.Make Int31_words.

Definition bigN := BigN.t.

Delimit Scope bigN_scope with bigN.
Bind Scope bigN_scope with bigN.
Bind Scope bigN_scope with BigN.t.
Bind Scope bigN_scope with BigN.t_.

Notation " i + j " := (BigN.add i j) : bigN_scope.
Notation " i - j " := (BigN.sub i j) : bigN_scope.
Notation " i * j " := (BigN.mul i j) : bigN_scope.
Notation " i / j " := (BigN.div i j) : bigN_scope.
Notation " i ?= j " := (BigN.compare i j) : bigN_scope.

 Theorem succ_pred: forall q,
  (0 < BigN.to_Z q -> 
     BigN.to_Z (BigN.succ (BigN.pred q)) = BigN.to_Z q)%Z.
 intros q Hq.
 rewrite BigN.spec_succ.
 rewrite BigN.spec_pred; auto.
 generalize Hq; set (a := BigN.to_Z q).
 ring_simplify (a - 1 + 1)%Z; auto.
 Qed.