(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \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)         *)
(************************************************************************)
(*                      Evgeny Makarov, INRIA, 2007                     *)
(************************************************************************)
Attributes deprecated(since="8.20", note="Use PeanoNat or BinInt instead.").
Require Export NStrongRec.
(** In this module, we derive generic implementations of usual operators just via the use of a [recursion] function. *)
Module NdefOpsProp (Import N : NAxiomsRecSig').
Include NStrongRecProp N.
(** Nullity Test *)
Definition if_zero (A : Type) (a b : A) (n : N.t) : A :=
recursion a (fun _ _ => b) n.
Arguments if_zero [A] a b n.
#[global]
Instance if_zero_wd (A : Type) :
Proper (Logic.eq ==> Logic.eq ==> N.eq ==> Logic.eq) (@if_zero A).

(* Specifications: *)
Theorem if_zero_0 : forall (A : Type) (a b : A), if_zero a b 0 = a.
Theorem if_zero_succ :
forall (A : Type) (a b : A) (n : N.t), if_zero a b (S n) = b.