Section tree_rect.
Variables
(P : tree -> Type)
(Q : list tree -> Type).
Hypotheses
(H1 : forall x, P (node x nil))
(H2 : forall f v, Q v -> P (node f v))
(H3 : Q nil)
(H4 : forall t v, P t -> Q v -> Q (t :: v)).
Fixpoint tree_rect_aux t : P t :=
match t as t return P t with
| node f v => H2 f
((fix vt_rect (v : list tree) : Q v :=
match v as v return Q v with
| nil => H3
| cons t' v' => H4 (tree_rect_aux t') (vt_rect v')
end) v)
end.
End tree_rect.
Set Elimination Schemes.
Inductive lforall (P : tree -> Type) : list tree -> Type :=
| lforall_nil : lforall P nil
| lforall_cons : forall a l, lforall P l -> P a -> lforall P (a::l).

Lemma tree_rect : forall P : tree -> Type,
(forall x, P (node x nil)) -> (forall f v, lforall P v -> P (node f v)) ->
forall t, P t.