(************************************************************************)
(*         *      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)         *)
(************************************************************************)
(** * Properties of minimum and maximum specific to natural numbers *)
Module Type NMaxMinProp (Import N : NAxiomsMiniSig').
Include NSubProp N.
(** Zero *)

(* Specifications: *)
Lemma max_0_l : forall n, max 0 n == n.
Lemma max_0_r : forall n, max n 0 == n.
Lemma min_0_l : forall n, min 0 n == 0.
Lemma min_0_r : forall n, min n 0 == 0.
(** The following results are concrete instances of [max_monotone] and similar lemmas. *)
(** Succ *)
Lemma succ_max_distr n m : S (max n m) == max (S n) (S m).
Lemma succ_min_distr n m : S (min n m) == min (S n) (S m).
(** Add *)
Lemma add_max_distr_l n m p : max (p + n) (p + m) == p + max n m.
Lemma add_max_distr_r n m p : max (n + p) (m + p) == max n m + p.
Lemma add_min_distr_l n m p : min (p + n) (p + m) == p + min n m.
Lemma add_min_distr_r n m p : min (n + p) (m + p) == min n m + p.
(** Mul *)
Lemma mul_max_distr_l n m p : max (p * n) (p * m) == p * max n m.
Lemma mul_max_distr_r n m p : max (n * p) (m * p) == max n m * p.
Lemma mul_min_distr_l n m p : min (p * n) (p * m) == p * min n m.
Lemma mul_min_distr_r n m p : min (n * p) (m * p) == min n m * p.
(** Sub *)
Lemma sub_max_distr_l n m p : max (p - n) (p - m) == p - min n m.
Lemma sub_max_distr_r n m p : max (n - p) (m - p) == max n m - p.
Lemma sub_min_distr_l n m p : min (p - n) (p - m) == p - max n m.
Lemma sub_min_distr_r n m p : min (n - p) (m - p) == min n m - p.
End NMaxMinProp.