intuition.
unfold DM_RC_G4, DM_RC_G5.
comp_skip.
comp_simp.
comp_skip.
symmetry.
eapply eqRat_trans.
comp_skip.
eapply compMap_filter.
intuition.
eapply eqRat_refl.
inline_first.
comp_skip.
dist_compute.
Qed.
Definition DM_RC_G6(c : A -> Comp B) :=
[a, s_A] <-$2 A1;
opt_b' <-$ (
b <-$ compMap B_EqDec (fun _ : nat => (c a)) (forNats n);
ret head (filter P b));
match opt_b' with
| Some b' => A2 s_A b'
| None => ret false
end.

(* Specifications: *)
Theorem DM_RC_G6_equiv :
forall (c : A -> Comp B),
evalDist (DM_RC_G5 c) (Some true) ==
evalDist (DM_RC_G6 c) true.