(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(* Contribution to the Coq Library   V6.3 (July 1999)                    *)
(*     A development written by Pierre Castéran for Coq V6.1  Coq : A product of inria : "http://pauillac.inria.fr/coq/coq-eng.html"  Pierre Castéran : A product of LaBRI :   LaBRI, Universite Bordeaux-I      |    12 place Puy Paulin 351 Cours de la Liberation        |    33000 Bordeaux F-33405 TALENCE Cedex             |    France France                            |    (+ 33) 5 56 81 15 80 tel : (+ 33) 5 56 84 69 31 fax : (+ 33) 5 56 84 66 69 email: casteran@labri.u-bordeaux.fr www: http://dept-info.labri.u-bordeaux.fr/~casteran  "Les rêves sont aussi beaux que la réalité, mais ils ne sont pas mieux". ( J.L.Borges )    *)
Require Export nat_trees.
(* Definitions **************)
(* p is less than every member of t *)
Inductive min (p : nat) (t : nat_tree) : Prop :=
min_intro : (forall q : nat, occ t q -> p < q) -> min p t.
Hint Resolve min_intro: searchtrees.
(* p is greater than every member of t *)
Inductive maj (p : nat) (t : nat_tree) : Prop :=
maj_intro : (forall q : nat, occ t q -> q < p) -> maj p t.
Hint Resolve maj_intro: searchtrees.
Inductive search : nat_tree -> Prop :=
| nil_search : search NIL
| bin_search :
forall (n : nat) (t1 t2 : nat_tree),
search t1 -> search t2 -> maj n t1 -> min n t2 -> search (bin n t1 t2).
Hint Resolve nil_search bin_search: searchtrees.
(* technical lemmas about maj and min *)
(*********************************)
Hint Resolve min_nil: searchtrees.
(*********************************)
Hint Resolve maj_nil: searchtrees.
(**********************************************************)
Hint Resolve maj_not_occ: searchtrees.

Lemma min_not_occ : forall (p : nat) (t : nat_tree), min p t -> ~ occ t p.