(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
(** The type [nat] of Peano natural numbers (built from [O] and [S]) is defined in [Datatypes.v] *)
(** This module defines the following operations on natural numbers : - predecessor [pred] - addition [plus] - multiplication [mult] - less or equal order [le] - less [lt] - greater or equal [ge] - greater [gt]  It states various lemmas and theorems about natural numbers, including Peano's axioms of arithmetic (in Coq, these are provable). Case analysis on [nat] and induction on [nat * nat] are provided too *)
Require Coq.Init.Nat.
Open Scope nat_scope.
Local Notation "0" := O.
Definition eq_S := f_equal S.
Definition f_equal_nat := f_equal (A:=nat).
Hint Resolve f_equal_nat: core.
(** The predecessor function *)
Notation pred := Nat.pred (only parsing).
Definition f_equal_pred := f_equal pred.
(** Injectivity of successor *)
Definition eq_add_S n m (H: S n = S m): n = m := f_equal pred H.
Hint Immediate eq_add_S: core.
Hint Resolve not_eq_S: core.
Definition IsSucc (n:nat) : Prop :=
match n with
| O => False
| S p => True
end.
(** Zero is not the successor of a number *)
Hint Resolve O_S: core.
Hint Resolve n_Sn: core.
(** Addition *)
Notation plus := Nat.add (only parsing).
Infix "+" := Nat.add : nat_scope.
Definition f_equal2_plus := f_equal2 plus.
Definition f_equal2_nat := f_equal2 (A1:=nat) (A2:=nat).
Hint Resolve f_equal2_nat: core.
Remove Hints eq_refl : core.
Hint Resolve plus_n_O eq_refl: core.  (* We want eq_refl to have higher priority than plus_n_O *)
Hint Resolve plus_n_Sm: core.
(** Standard associated names *)
Notation plus_0_r_reverse := plus_n_O (only parsing).
Notation plus_succ_r_reverse := plus_n_Sm (only parsing).
(** Multiplication *)
Notation mult := Nat.mul (only parsing).
Infix "*" := Nat.mul : nat_scope.
Definition f_equal2_mult := f_equal2 mult.
Hint Resolve f_equal2_mult: core.

Lemma mult_n_O : forall n:nat, 0 = n * 0.