Definition cond2_correct n s x g h0 h1 vnl vsl :
length vnl = n ->
length vsl = s ->
sem (cond2 n s x g h0 h1) vnl vsl =
match sem x vnl vsl with
| nil => sem g vnl vsl
| true  :: _ => sem h0 vnl (tl (sem x vnl vsl) :: vsl)
| false :: _ => sem h1 vnl (tl (sem x vnl vsl) :: vsl)
end.
(** * Recursion with one function [h] taking [i] instead of two function [h]_[i] *)
Definition rec1 n s g h :=
rec
g
(comp (S n) (S s) h
(comp (S n) 0 (succ false) nil [proj (S n) 0 0] ::
map (proj (S n) 0)     (seq 1     n))
(map (proj (S n) (S s)) (seq (S n) (S s))))
(comp (S n) (S s) h
(comp (S n) 0 (succ true) nil [proj (S n) 0 0] ::
map (proj (S n) 0)     (seq 1     n))
(map (proj (S n) (S s)) (seq (S n) (S s)))).

Lemma sem_rec_false g h0 h1 vnl vsl v :
sem (rec g h0 h1) ((false :: v) :: vnl) vsl =
sem h0 (v :: vnl) (sem (rec g h0 h1) (v :: vnl) vsl :: vsl).