Fixpoint rec_simulation sl (e : Cobham) : pol :=
  match e with
    | Zero => pcst sl 0
    | Proj i n => pcst sl 0
    | Succ b => pcst sl 0
    | Smash => (pplus (pplus (pproj sl 1) (pproj sl 1))
        (pplus (pcst sl 16) (pplus (pproj sl 0) (pcst sl 2)))) 
    | Rec g h0 h1 j => 
       let bf := poly_Cobham j in
        let ph := pplus (rec_simulation (S sl) h0)  (rec_simulation (S sl) h1) in
          let pg := rec_simulation (sl - 1) g in
            pplus (pcomp ph (pproj sl 0 :: bf :: (map (pproj sl) (seq 1 (sl - 1)))))
            (pplus (pshift pg) (pplus (pproj sl 0) (pcst sl 2)))
    | Comp n h l => 
      pplus (pcst sl 0)
      (pplus (pcomp (rec_simulation (length l) h)
        (map poly_Cobham l)) (pplusl (map (rec_simulation sl) l)))
  end.

(* Specifications: *)
Lemma rec_simulation_arity : forall (e : Cobham) n, arity e = ok_arity n -> parity (rec_simulation n e) = n.
Lemma pWF_rec_simulation : forall (e : Cobham) n, arity e = ok_arity n -> pWF (rec_simulation n e).