intuition.
unfold DM_RC_G3, DM_RC_G4.
comp_skip.
symmetry.
comp_simp.
rewrite <- evalDist_assoc; intuition.
comp_skip.
eapply comp_spec_eq_impl_eq.
eapply (@compMap_fission_eq _ _ _ _ _ _ _ _ _ _ _ _ eq); intuition.
simpl.
eapply comp_spec_eq_refl.
subst.
simpl.
eapply eq_impl_comp_spec_eq.
intuition.
comp_at comp_inline rightc 1%nat.
comp_swap_r.
inline_first.
comp_skip.
comp_skip.
comp_simp.
intuition.
Qed.
Definition DM_RC_G5(c : A -> Comp B) :=
[a, s_A] <-$2 A1;
allB <-$ compMap _ (fun _ => (c a)) (forNats n);
allG <-$ compMap _ (A2 s_A) (filter P allB);
ret hd_error allG.

(* Specifications: *)
Theorem DM_RC_G5_equiv :
forall (c : A -> Comp B) x,
evalDist (DM_RC_G4 c) x ==
evalDist (DM_RC_G5 c) x.