(*       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.(*       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.(*       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).(*
    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).

(* Specifications: *)
Lemma NIL_not_bin : ~ binp NIL.
Lemma diff_nil_bin : forall (n : nat) (t1 t2 : nat_tree), bin n t1 t2 <> NIL.