Inductive Const_leq (s : nat) : term -> Prop :=
| IdLe : forall x, Const_leq s (Id x)
| ConstLe : forall n, n <= s -> Const_leq s (Const n)
| AppLe :
forall t1 t2,
Const_leq s t1 -> Const_leq s t2 ->
Const_leq s (App t1 t2)
| AbsLe :
forall t,
Const_leq s t -> Const_leq s (Abs t).
Fixpoint max_const (t : term) : nat :=
match t with
| Id _ => 0
| Const n => n
| App t1 t2 => max (max_const t1) (max_const t2)
| Abs t => max_const t
end.

Lemma gen_term_no_app_correctSize :
forall (tau : type) (e : env) (s: nat),
semGenSize (gen_term_no_app tau e) s <-->
[set t | typing e t tau /\ app_free t /\ Const_leq s t].