(* 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 datRepeat_func_eq : forall n (A : Set)(t1 t2 : DistApproxTree A) f P (P' : DistApproxTree A -> Prop), datRepeat f P n t1 t2 -> (forall t, f t -> P' t) -> datRepeat P' P n t1 t2.
Lemma dat_better_antisymm : forall (A : Set)(t1 t2 : DistApproxTree A), dat_better t1 t2 -> dat_better t2 t1 -> t1 = t2.
Lemma dat_correct_h_repeat_app : forall (A : Set) t (c : Comp A)(P : A -> bool) n ls1 ls2 a, evalDet_steps (cs_more c ls1) (cs_done a nil) -> P a = false -> dat_correct_h (Repeat c P) (ls1 ++ ls2) n t -> dat_correct_h (Repeat c P) ls2 n t.