intuition.
destruct (@dat_exists n _ c).
trivial.
edestruct (@datRepeat_left_total n A (comp_eq_dec c) x  (* was (pred n ) *)
(dat_correct c n) P).
eapply dat_exists; eauto.
econstructor.
unfold dat_correct_repeat2.
econstructor.
intuition.
eauto.
eauto.
Qed.
(* A function that computes the total empty space in a distribution approximation. *)
Fixpoint computeEmptySpace(A : Set)(t : DistApproxTree A)(P : A -> bool) :=
match t with
| dat_leaf o =>
match o with
| Some a => indicator (fun a' => (negb (P a'))) a
| None => 0
end
| dat_internal t1 t2 =>
(1 / 2) * (computeEmptySpace t1 P)  + (1 / 2) * (computeEmptySpace t2 P)
end.

(* Specifications: *)
Lemma computeEmptySpace_correct : forall (A : Set)(eqd : eq_dec A)(t : DistApproxTree A) P,
sumList (filter (fun a => negb (P a)) (getTreeSupport eqd t)) (lowDistApproxFromTree eqd t) == (computeEmptySpace t P).