unfold DM_RC_G5, DM_RC_G6.
intuition.
comp_skip.
comp_simp.
inline_first.
comp_skip.
rewrite compMap_head.
comp_simp.
destruct (hd_error (filter P x)).
symmetry.
rewrite <- evalDist_right_ident.
comp_skip.
dist_compute.
dist_compute.
intuition.
Grab Existential Variables.
intuition.
Qed.
Definition DM_RC_B2 s_A (b : list B) :=
core_b <- filter P b;
opt_b' <- head core_b;
match opt_b' with
| None => ret false
| Some b' => A2 s_A b'
end.

Theorem DistMult_G_equiv :
forall c,
Pr[DM_RC_G6 c] == Pr[DistMult_G _ A1 DM_RC_B2 n c] .