Library Stdlib.Numbers.Integer.Abstract.ZMaxMin


Require Import ZAxioms ZMulOrder GenericMinMax.

Properties of minimum and maximum specific to integer numbers


Module Type ZMaxMinProp (Import Z : ZAxiomsMiniSig').
Include ZMulOrderProp Z.

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).

Pred

Lemma pred_max_distr n m : P (max n m) == max (P n) (P m).

Lemma pred_min_distr n m : P (min n m) == min (P n) (P 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.

Opp

Lemma opp_max_distr n m : -(max n m) == min (-n) (-m).

Lemma opp_min_distr n m : -(min n m) == max (-n) (-m).

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.

Mul

Lemma mul_max_distr_nonneg_l n m p : 0 <= p ->
 max (p * n) (p * m) == p * max n m.

Lemma mul_max_distr_nonneg_r n m p : 0 <= p ->
 max (n * p) (m * p) == max n m * p.

Lemma mul_min_distr_nonneg_l n m p : 0 <= p ->
 min (p * n) (p * m) == p * min n m.

Lemma mul_min_distr_nonneg_r n m p : 0 <= p ->
 min (n * p) (m * p) == min n m * p.

Lemma mul_max_distr_nonpos_l n m p : p <= 0 ->
 max (p * n) (p * m) == p * min n m.

Lemma mul_max_distr_nonpos_r n m p : p <= 0 ->
 max (n * p) (m * p) == min n m * p.

Lemma mul_min_distr_nonpos_l n m p : p <= 0 ->
 min (p * n) (p * m) == p * max n m.

Lemma mul_min_distr_nonpos_r n m p : p <= 0 ->
 min (n * p) (m * p) == max n m * p.

End ZMaxMinProp.