Library Coq.Arith.Min



Require Import Le.

Open Local Scope nat_scope.

Implicit Types m n : nat.

minimum of two natural numbers


Fixpoint min n m {struct n} : nat :=
  match n, m with
    | O, _ => 0
    | S n', O => 0
    | S n', S m' => S (min n' m')
  end.

Simplifications of min


Lemma min_0_l : forall n : nat, min 0 n = 0.

Lemma min_0_r : forall n : nat, min n 0 = 0.

Lemma min_SS : forall n m, S (min n m) = min (S n) (S m).

Lemma min_assoc : forall m n p : nat, min m (min n p) = min (min m n) p.

Lemma min_comm : forall n m, min n m = min m n.

min and le


Lemma min_l : forall n m, n <= m -> min n m = n.

Lemma min_r : forall n m, m <= n -> min n m = m.

Lemma le_min_l : forall n m, min n m <= n.

Lemma le_min_r : forall n m, min n m <= m.
Hint Resolve min_l min_r le_min_l le_min_r: arith v62.

min n m is equal to n or m


Lemma min_dec : forall n m, {min n m = n} + {min n m = m}.

Lemma min_case : forall n m (P:nat -> Type), P n -> P m -> P (min n m).

Notation min_case2 := min_case (only parsing).