(** * Recursion on the result of the function [x],
      with one function [h] taking [i] instead of two function [h]_[i] *)

Definition rec3 n s x g h : BC :=
  comp n s
    (rec1 n s g h)
    (x ::
     map (proj n 0) (seq 0 n))
    (map (proj n s) (seq n s)).

(* Specifications: *)
Lemma arities_rec3 n s x g h (Hx : arities x = ok_arities n 0) (Hg : arities g = ok_arities n s) (Hh : arities h = ok_arities (S n) (S s)) : arities (rec3 n s x g h) = ok_arities n s.
Lemma rec3_correct n s x g h vnl vsl : length vnl = n -> length vsl = s -> sem (rec3 n s x g h) vnl vsl = sem_rec1 g h (sem x vnl nil) vnl vsl.