(****************************************************************************)
(*                 The Calculus of Inductive Constructions                  *)
(*                                                                          *)
(*                                Projet Coq                                *)
(*                                                                          *)
(*                     INRIA        LRI-CNRS        ENS-CNRS                *)
(*              Rocquencourt         Orsay          Lyon                    *)
(*                                                                          *)
(*                                 Coq V6.2                                 *)
(*                               May 1st 1998                               *)
(*                                                                          *)
(****************************************************************************)
(*                                  Min.v                                   *)
(****************************************************************************)
Require Arith.

(* minimum of two natural numbers *)

(*
Fixpoint min [n:nat] : nat -> nat := 
[m:nat]Case n of
      (* O *) O
   (* S n' *) [n':nat]
              Case m of (* O *) O (* S m' *) [m':nat](S (min n' m')) end end.
*)

Fixpoint min [n:nat] : nat -> nat :=  
[m:nat]Cases n m of
          O      _     => O
       | (S n')  O     => O
       | (S n') (S m') => (S (min n' m'))
       end.



Lemma min_SS : (n,m:nat)((S (min n m))=(min (S n) (S m))).
Proof.
Auto.
Qed.

Lemma le_min_l : (n,m:nat)(le (min n m) n).
Proof.
Induction n; Intros; Simpl; Auto.
Elim m; Intros; Simpl; Auto.
Qed.
Hint le_min_l.

Lemma le_min_r : (n,m:nat)(le (min n m) m).
Proof.
Induction n; Simpl; Auto.
Induction m; Simpl; Auto.
Qed.
Hint le_min_r.

(* min n m is equal to n or m *)

Lemma min_case : (n,m:nat)(P:nat->Set)(P n)->(P m)->(P (min n m)).
Proof.
Induction n; Simpl; Auto.
Induction m; Intros; Simpl; Auto.
Pattern (min n0 n1); Apply H ; Auto.
Qed.


(* $Id: Min.v,v 1.6 1998/04/30 16:45:44 mohring Exp $ *)
