Fixpoint lst_length (l : term_list) : nat :=
match l with
| tnil => 0
| tcons _ l' => S (lst_length l')
end.
Fixpoint term_high (t : term) : nat :=
match t with
| app a l => S (term_high_0 l)
end
with term_high_0 (l : term_list) : nat :=
match l with
| tnil => 0
| tcons hd tl => max (term_high hd) (term_high_0 tl)
end.

(* Specifications: *)
Lemma high_aux_0 :
forall (a : ad) (l : term_list), S (term_high_0 l) <= term_high (app a l).
Lemma high_aux_1 :
forall (a : ad) (l : term_list), S (term_high_0 l) = term_high (app a l).
Lemma high_aux_2 : forall (l : term_list) (c : ad), 1 <= term_high (app c l).
Lemma high_aux_3 :
forall (t : term) (tl : term_list), term_high t <= term_high_0 (tcons t tl).
Lemma high_aux_4 :
forall (t : term) (tl : term_list),
term_high_0 tl <= term_high_0 (tcons t tl).