destruct ls; intuition.
unfold compMap.
unfold hd_error.
unfold error.
comp_simp.
intuition.
unfold compMap. fold compMap.
unfold hd_error. fold hd_error.
unfold value.
inline_first.
comp_skip.
inline_first.
comp_irr_l.
eapply compMap_wf.
intuition.
intuition.
Qed.

Theorem compMap_filter :
forall (A B : Set)(eqda : EqDec A)(eqdb : EqDec B)(ls : list A)(c : A -> Comp B)(P : A -> bool) x,
(forall a, In a ls -> well_formed_comp (c a)) ->
evalDist (compMap _ c (filter P ls)) x ==
evalDist (ps <-$ compMap _ (fun a => b <-$ (c a); ret (a, b)) ls; ret (snd (unzip (filter (fun p => P (fst p)) ps)))) x.