unfold lowDistApprox_ls.
intuition.
exists (listRepeat (ca_done a1) (length (getAllBlists n))).
destruct (eqd a1 a2); subst.
exists (length (getAllBlists n)).
intuition.
eapply rel_map_listRepeat.
intuition.
eapply evalDet_app_eq.
trivial.
eapply pred_count_eq_all; intuition.
symmetry.
eapply in_listRepeat_inv.
eauto.
rewrite listRepeat_length.
trivial.
destruct (eqd a2 a2); try congruence.
rewrite getAllBlists_length.
apply num_dem_same_rat1.
unfold natToPosnat, posnatToNat.
trivial.
exists O.
intuition.
eapply rel_map_listRepeat.
intuition.
eapply evalDet_app_eq.
trivial.
eapply pred_count_eq_none; intuition.
subst.
assert (ca_done a2 = ca_done a1).
eapply in_listRepeat_inv.
eauto.
inversion H1; subst; clear H1.
intuition.
destruct (eqd a2 a1); subst; try congruence.
apply rat_num_0.
Qed.

(* Specifications: *)
Lemma evalDet_lowDistApprox_ls_not_done:
forall (A : Set) (c : Comp A) (s : Blist)
(a2 : A) (n : nat),
well_formed_comp c ->
(forall s' (a : A), In s' (getAllBlists n) -> evalDet c (s ++ s') (ca_done a) -> False) ->
lowDistApprox_ls c a2 n s 0.