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

Notation P1 := (e_P1 _) (only parsing).

Theorem P1_varshift2 : forall M N : terms, reg_varshift2 M N -> e_P1 _ M = e_P1 _ N.