Definition naive_sch : forall (n : Z) (t : Z_btree), {occ n t} + {~ occ n t}.(*
let rec naive_sch n = function
  Z_leaf -> right
| Z_bnode (z1, z0, z) ->
    (match Z_eq_dec n z1 with
       left -> left
     | right ->
         (match naive_sch n z0 with
            left -> left
          | right -> naive_sch n z))
*)




Inductive min (z : Z) (t : Z_btree) : Prop :=
    min_intro : (forall z' : Z, occ z' t -> (z < z')%Z) -> min z t.(*
let rec naive_sch n = function
  Z_leaf -> right
| Z_bnode (z1, z0, z) ->
    (match Z_eq_dec n z1 with
       left -> left
     | right ->
         (match naive_sch n z0 with
            left -> left
          | right -> naive_sch n z))
*)




Inductive min (z : Z) (t : Z_btree) : Prop :=
    min_intro : (forall z' : Z, occ z' t -> (z < z')%Z) -> min z t.(* p is greater than every member of t *)

Inductive maj (z : Z) (t : Z_btree) : Prop :=
    maj_intro : (forall z' : Z, occ z' t -> (z' < z)%Z) -> maj z t.(* p is greater than every member of t *)

Inductive maj (z : Z) (t : Z_btree) : Prop :=
    maj_intro : (forall z' : Z, occ z' t -> (z' < z)%Z) -> maj z t.Inductive search : Z_btree -> Prop :=
  | leaf_search : search Z_leaf
  | bnode_search :
      forall (z : Z) (t1 t2 : Z_btree),
      search t1 ->
      search t2 -> maj z t1 -> min z t2 -> search (Z_bnode z t1 t2).Inductive search : Z_btree -> Prop :=
  | leaf_search : search Z_leaf
  | bnode_search :
      forall (z : Z) (t1 t2 : Z_btree),
      search t1 ->
      search t2 -> maj z t1 -> min z t2 -> search (Z_bnode z t1 t2).Inductive search : Z_btree -> Prop :=
  | leaf_search : search Z_leaf
  | bnode_search :
      forall (z : Z) (t1 t2 : Z_btree),
      search t1 ->
      search t2 -> maj z t1 -> min z t2 -> search (Z_bnode z t1 t2).

Lemma min_leaf : forall z : Z, min z Z_leaf.