Inductive Tree : Set :=
    node : A -> Forest -> Tree
with Forest : Set :=
  | Nil_Forest : Forest
  | Cons_Forest : Tree -> Forest -> Forest.Inductive Tree : Set :=
    node : A -> Forest -> Tree
with Forest : Set :=
  | Nil_Forest : Forest
  | Cons_Forest : Tree -> Forest -> Forest.Inductive Tree : Set :=
    node : A -> Forest -> Tree
with Forest : Set :=
  | Nil_Forest : Forest
  | Cons_Forest : Tree -> Forest -> Forest.Inductive Tree : Set :=
    node : A -> Forest -> Tree
with Forest : Set :=
  | Nil_Forest : Forest
  | Cons_Forest : Tree -> Forest -> Forest.Inductive Tree : Set :=
    node : A -> Forest -> Tree
with Forest : Set :=
  | Nil_Forest : Forest
  | Cons_Forest : Tree -> Forest -> Forest.Fixpoint height_tree (t : Tree) : nat :=
  match t with
  | node a succs => S (height_forest succs)
  end
 
 with height_forest (succs : Forest) : nat :=
  match succs with
  | Nil_Forest => 0
  | Cons_Forest t0 succs => max (height_tree t0) (height_forest succs)
  end.(*
Inductive Tree : Set :=
| node : A -> (list Tree) -> Tree.

Fixpoint height_tree [t:Tree] : nat :=
  Cases t of
  | (node a succs) => (S (height_forest succs))
  end
with height_forest[succs:(list Tree)] : nat :=
  Cases succs of
  | nil => O
  | (cons t0 succs) => (max (height_tree t0) (height_forest succs))
  end.
Does not work!!
*)


Definition root (t : Tree) := match t with
                              | node a _ => a
                              end.Definition successors (t : Tree) := match t with
                                    | node _ succs => succs
                                    end.Inductive In_Forest (t0 : Tree) : Forest -> Prop :=
  | in_forest_head :
      forall succs : Forest, In_Forest t0 (Cons_Forest t0 succs)
  | in_forest_tail :
      forall (t1 : Tree) (succs : Forest),
      In_Forest t0 succs -> In_Forest t0 (Cons_Forest t1 succs).Inductive In_Forest (t0 : Tree) : Forest -> Prop :=
  | in_forest_head :
      forall succs : Forest, In_Forest t0 (Cons_Forest t0 succs)
  | in_forest_tail :
      forall (t1 : Tree) (succs : Forest),
      In_Forest t0 succs -> In_Forest t0 (Cons_Forest t1 succs).Inductive In_Forest (t0 : Tree) : Forest -> Prop :=
  | in_forest_head :
      forall succs : Forest, In_Forest t0 (Cons_Forest t0 succs)
  | in_forest_tail :
      forall (t1 : Tree) (succs : Forest),
      In_Forest t0 succs -> In_Forest t0 (Cons_Forest t1 succs).

(* Specifications: *)
Lemma height_in_le : forall (t : Tree) (succs : Forest), In_Forest t succs -> height_tree t <= height_forest succs.
Lemma My_Tree_ind : forall P : Tree -> Prop, (forall (a : A) (succs : Forest), (forall t : Tree, In_Forest t succs -> P t) -> P (node a succs)) -> forall t : Tree, P t.
Lemma My_Tree_rec : forall P : Tree -> Set, (forall (a : A) (succs : Forest), (forall t : Tree, In_Forest t succs -> P t) -> P (node a succs)) -> forall t : Tree, P t.