Fixpoint poly_time n (e:BC) : pol :=
  match e with
    | zero => ptime_zero
    | succ _ => ptime_succ
    | pred => ptime_pred
    | cond  => ptime_cond
    | proj n s i => ptime_proj n s i
    | rec g h0 h1 => 
      pplus (pshift (poly_time (n - 1) g))
      (pmult (pproj n 0) (pplus (poly_time n h0) (poly_time n h1)))
    | comp n0 s h rl tl =>
      pplus (pplus (pcst n0 0) (pcomp (poly_time (length rl) h) (map (poly_BC n0) rl)))
      (pplus (pplusl (map (poly_time n0) rl)) (pplusl (map (poly_time n0) tl)))
  end.

(* Specifications: *)
Lemma poly_time_WF : forall e n s, arities e = ok_arities n s -> pWF (poly_time n e).
Lemma arity_poly_time : forall e n s, arities e = ok_arities n s -> parity (poly_time n e) = n.
Lemma sem_cost_bounded : forall e n s, arities e = ok_arities n s -> (forall vnl vsl, length vnl = n -> length vsl = s -> snd (sem_cost e vnl vsl) <= peval (poly_time n e) (List.map (@length _) vnl)).