induction n.
induction t; intuition.
destruct o.
case_eq (P a); intuition.
econstructor.
econstructor.
trivial.
econstructor.
eapply datRepeat_leaf_Some_no.
trivial.
econstructor.
econstructor.
edestruct IHt1.
eauto.
edestruct IHt2.
eauto.
econstructor.
econstructor; eauto.
induction t; intuition.
destruct o.
destruct H.
edestruct (IHn _ eqd x).
eauto.
case_eq (P a); intuition.
econstructor.
econstructor.
trivial.
edestruct IHn; eauto.
econstructor.
eapply datRepeat_leaf_Some_repeat.
eauto.
trivial.
eauto.
econstructor.
econstructor.
edestruct IHt1; eauto.
edestruct IHt2; eauto.
econstructor.
econstructor; eauto.
Grab Existential Variables.
eapply P.
trivial.
Qed.

(* Specifications: *)
Lemma dat_exists_repeat2 : forall (A : Set)(c : Comp A)(P : A -> bool)(n : nat),
well_formed_comp c ->
exists t : DistApproxTree A, dat_correct_repeat2 c P n t.