unfold ListHybrid_G, G_hybrid.
comp_skip.
comp_simp.
rewrite firstn_ge_all.
comp_skip.
rewrite skipn_ge_nil.
eapply comp_spec_eq_impl_eq.
simpl.
comp_simp.
rewrite app_nil_r.
eapply comp_spec_eq_refl.
eauto.
eauto.
Qed.
Definition B1 i :=
[lsA, s_A] <-$2 A1;
lsA1 <- firstn i lsA;
a <- nth i lsA defA;
lsA2 <- skipn (S i) lsA;
incla <- if (lt_dec i (length lsA)) then true else false;
ret (a, (incla, lsA1, lsA2, s_A)).
Definition B2 (e : bool * _ * _ * _) b :=
let '(incla, lsA1, lsA2, s_A) := e in
lsB1 <-$ compMap _ c1 lsA1;
lsB2 <-$ compMap _ c2 lsA2;
lsB <- if incla then (lsB1 ++ (b :: lsB2)) else lsB1;
A2 s_A lsB.
Local Open Scope list_scope.

Theorem compMap_unroll :
forall (A B : Set)(eqdb : EqDec B)(c : A -> Comp B)(ls : list A)(def : A),
ls <> nil ->
comp_spec eq (compMap _ c ls) (x <-$ c (hd def ls); y <-$ compMap _ c (tl ls); ret (x :: y)).