(* 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 )  *)
Inductive RMAX (t t' : nat_tree) (n : nat) : Prop :=
rmax_intro :
occ t n ->
(forall p : nat, occ t p -> p <= n) ->
(forall q : nat, occ t' q -> occ t q) ->
(forall q : nat, occ t q -> occ t' q \/ n = q) ->
~ occ t' n -> search t' -> RMAX t t' n.
Hint Resolve rmax_intro: searchtrees.
(* base cases *)
(*******************************************************)
Hint Resolve rmax_1: searchtrees.
Remark rmax_2 : n < p.
(**********************)
Hint Resolve rmax_2: searchtrees.
Remark rmax_3 : min n t'.
(************************)
Hint Resolve rmax_3: searchtrees.
Remark rmax_4 : search (bin n t1 t').
(************************************)
Hint Resolve rmax_4: searchtrees.
Remark rmax_5 : n < q.
(**********************)
Hint Resolve rmax_5: searchtrees.
Remark rmax_6 :
forall p0 : nat, occ (bin n t1 (bin p t2 t3)) p0 -> p0 <= q.
(******************************************************************)
Hint Resolve rmax_6: searchtrees.
Remark rmax_7 :
forall q' : nat,
occ (bin n t1 t') q' -> occ (bin n t1 (bin p t2 t3)) q'.
(*******************************************************)
Hint Resolve rmax_7: searchtrees.
Remark rmax_8 : ~ occ (bin n t1 t') q.
(************************************)
Hint Resolve rmax_8: searchtrees.
Remark rmax_9 :
forall q0 : nat,
occ (bin n t1 (bin p t2 t3)) q0 -> occ (bin n t1 t') q0 \/ q = q0.
(****************************************)
Hint Resolve rmax_9: searchtrees.

Lemma rmax_t1_t2t3 : RMAX (bin n t1 (bin p t2 t3)) (bin n t1 t') q.