(* 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 )    *)
(* binary nat trees *)
Global Set Asymmetric Patterns.
Require Export Peano_dec.
(*       II The binary tree data structure ****************************************** ******************************************   We define here the "nat_tree" inductive data type. In the remaining of this file, the term "binary tree" will denote a complete binary tree, the internal nodes of which are labeled by natural integers. *)
Inductive nat_tree : Set :=
| NIL : nat_tree
| bin : nat -> nat_tree -> nat_tree -> nat_tree.
(* Example:   3 /  \ /    \ 7      8          Coq representation: / \    / \ NIL \  NIL NIL      (bin three (bin seven NIL (bin nine NIL NIL)) 9                         (bin eight NIL NIL)) / \             where three is the term (S (S (S O))) and so on ... /   \ NIL  NIL *)
(* II.1   Some definitions and lemmas ************************************)
(* (binp t) means "t is not NIL"  *)
Inductive binp : nat_tree -> Prop :=
binp_intro : forall (n : nat) (t1 t2 : nat_tree), binp (bin n t1 t2).
Hint Resolve binp_intro: searchtrees.

(* Specifications: *)
Lemma NIL_not_bin : ~ binp NIL.
Hint Resolve NIL_not_bin: searchtrees.