Definition e_P2 (b : wsort) (U : TS b) : nat :=
  (fix F (w : wsort) (t : TS w) {struct t} : nat :=
     match t with
     | var _ => 1
     | app t0 t1 => S (F wt t0 + F wt t1)
     | lambda t0 => 2 * F wt t0
     | env t0 t1 => F wt t0 * S (F ws t1)
     | id => 1
     | shift => 1
     | cons t0 t1 => S (F wt t0 + F ws t1)
     | comp t0 t1 => F ws t0 * S (F ws t1)
     | lift t0 => 4 * F ws t0
     | meta_X _ => 1
     | meta_x _ => 1
     end) b U.(* var *) 
(* app *) 
(* lam *) 
(* env *) 
(*  id *) 
(*  |  *) 
(*  .  *) 
(*  o  *) 
(*  || *) 
(*  X  *) 
(*  x  *) 


Notation P2 := (e_P2 _) (only parsing).

Theorem P2_fvarcons : forall M N : terms, reg_fvarcons M N -> e_P2 _ M > e_P2 _ N.