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
(************************************************************************)
10
Require Import BinNat.
13
Set Implicit Arguments.
15
Lemma natSRth : semi_ring_theory O (S O) plus mult (@eq nat).
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.
23
semi_morph 0 1 plus mult (eq (A:=nat))
24
0%N 1%N Nplus Nmult Neq_bool nat_of_N.
29
intros x y H;rewrite (Neq_bool_ok _ _ H);trivial.
34
true => constr:(N_of_nat t)
35
| _ => constr:InitialRing.NotConstant
38
Ltac Ss_to_add f acc :=
40
| S ?f1 => Ss_to_add f1 (S acc)
41
| _ => constr:(acc + f)%nat
46
|- context C [S ?p] =>
48
O => fail 1 (* avoid replacing 1 with 1+0 ! *)
49
| p => match isnatcst p with
51
| false => let v := Ss_to_add p (S 0) in
58
Add Ring natr : natSRth
59
(morphism nat_morph_N, constants [natcst], preprocess [natprering]).