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

« back to all changes in this revision

Viewing changes to contrib/setoid_ring/ArithRing.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
Require Import Mult.
 
10
Require Import BinNat.
 
11
Require Import Nnat.
 
12
Require Export Ring.
 
13
Set Implicit Arguments.
 
14
 
 
15
Lemma natSRth : semi_ring_theory O (S O) plus mult (@eq nat).
 
16
 Proof.
 
17
  constructor. exact plus_0_l. exact plus_comm. exact plus_assoc.
 
18
  exact mult_1_l. exact mult_0_l. exact mult_comm. exact mult_assoc.
 
19
  exact mult_plus_distr_r. 
 
20
 Qed.
 
21
 
 
22
Lemma nat_morph_N : 
 
23
   semi_morph 0 1 plus mult (eq (A:=nat)) 
 
24
          0%N 1%N Nplus Nmult Neq_bool nat_of_N.
 
25
Proof.
 
26
  constructor;trivial.
 
27
  exact nat_of_Nplus.
 
28
  exact nat_of_Nmult.
 
29
  intros x y H;rewrite (Neq_bool_ok _ _ H);trivial.
 
30
Qed.
 
31
 
 
32
Ltac natcst t :=
 
33
  match isnatcst t with
 
34
    true => constr:(N_of_nat t)
 
35
  | _ => constr:InitialRing.NotConstant
 
36
  end.
 
37
 
 
38
Ltac Ss_to_add f acc :=
 
39
  match f with
 
40
  | S ?f1 => Ss_to_add f1 (S acc)
 
41
  | _ => constr:(acc + f)%nat
 
42
  end.
 
43
 
 
44
Ltac natprering :=
 
45
  match goal with
 
46
    |- context C [S ?p] =>
 
47
    match p with
 
48
      O => fail 1 (* avoid replacing 1 with 1+0 ! *)
 
49
    | p => match isnatcst p with 
 
50
           | true => fail 1
 
51
           | false => let v := Ss_to_add p (S 0) in
 
52
                         fold v; natprering
 
53
           end
 
54
    end
 
55
  | _ => idtac
 
56
  end.
 
57
 
 
58
Add Ring natr : natSRth
 
59
  (morphism nat_morph_N, constants [natcst], preprocess [natprering]).
 
60